Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gtk gtk
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,437
    • Issues 1,437
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 246
    • Merge requests 246
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOME
  • gtkgtk
  • Issues
  • #3488

Closed
Open
Created Dec 17, 2020 by Emmanuele Bassi@ebassi👣Maintainer

Decouple GtkEditable insert-text and delete-text signals from virtual functions

We have an over-abundance of signals and virtual functions inside GtkEditable, and it all gets worse when throwing delegates into the mix.

Calling gtk_editable_insert_text() runs the GtkEditableInterface.do_insert_text() virtual function, which will emit the GtkEditable::insert-text signal, whose default handler will call gtk_editable_insert_text() on the delegate function, if one is set.

graph TD;
  editable.insert_text-->editable.do_insert_text;
  editable.do_insert_text-->editable.insert-text;
  editable.insert-text-->delegate.insert_text;

This prevents us from hoisting the GtkEditable::insert-text signal from the delegate to the wrapper editable, because then the wrapper will emit the signal on the delegate, which will then emit it on the wrapper, and so on, and so forth.

The same happens for GtkEditable::delete-text.

This prevents us from completely fulfilling the contract of GtkEditable on implementations that have a delegate. Sadly, we documented that the appropriate way to deal with editable signals is to connect to the signal and stop the emission from the callback. This means that any attempt at fixing this mess is going to break existing code.

Ideally, we should decouple signals from virtual functions; eliminating signals altogether might be the best option, in favour of some sort of filter object attached to the GtkEditable in case you want to transform the text.

Assignee
Assign to
Time tracking