GTK+ modules to the rescue
GTK+ has this very simple module API:
is called to initialize the module.
GTK+ modules are a very easy and effective way to add functionality to GTK+ that requires features from components way higher in the stack. They can also be quite handy as debugging tools.
Say, we want to measure it takes for an application to finish starting up. I've seen many people do this in one of two ways:
- Add an idle callback to the application code and recompile
- Using a stopwatch
I wrote a small gtk module
) to do just that. The whole thing is only 50 lines. You can run it with:
- IDLE_ACTION="time" for it to print time it takes from gtk init to the idle callback
- IDLE_ACTION="quit" for it to call
gtk_main_quit() in the idle callback
- IDLE_ACTION="kill" for it to send
SIGINT to the process in the idle callback