Search code examples
gtk3

How to track down in which application is signal handler defined gtk/gtkmm for some button


The problem: You wanna contribute to the some gnome/gtk/gtkmm project since you've noticed and know a way that things could be made better / you wanna fix some bug. Here are steps to get you started.

Example problem: "Clean" button in Gnome Builder isn't doing anything to my project and since at this point I believe it is just empty function with placeholder button I wanna implement actual action.


Solution

  • Here are steps:

    1. open application that you wanna modify in terminal where environment GTK_DEBUG=interactive environment variable is set. so run GTK_DEBUG=interactive gnome-builder
    2. Gtk inspector should have opened and you should see bunch of Objects displayed. If you click on Object in inspector, that object should light up in your application
    3. Gtk has clear hierarchy, so parent contains children, and your job is to detect in which parent is child that you want to modify
    4. When you figure which parent you want click on arrow next to the name of that parent to reveal its children
    5. Repeat steps 3. and 4. by applying 2. to get to the child that you want to modify
    6. For example my path is IdePrimaryWorkspace -> GtkPopover -> GtkBox -> DzlPriorityBox -> GbpBuilduiOmniBarSection -> GtkBox -> GtkBox -> GtkButton
      1. Double click last interactive entry (such as GtkButton
      2. on the left, in drop-down switch to Properties view
      3. find property that you want, mine is GtkActionable, and it's value is builder-manager.clean
      4. open source folder in terminal of application that you are interested in (clone source of that application)
      5. type in command tree | grep build-manager
      6. if there are entries with that filename type in find . --name=filenameof.your.file
      7. get file path, open that file in text editor/IDE, change stuff inside
      8. submit patches