GNOME Bugzilla – Bug 631413
Add macros for GSourceFunc return values
Last modified: 2011-09-10 02:09:28 UTC
Even after 10 years of developing with GLib and GNOME, I still have to look at Devhelp to remember the return values for GSourceFunc, like g_timeout_add() and g_idle_add(). The Perl bindings for GLib have two nice constants for these occasions that remove some of the confusion out of the boolean return value: G_SOURCE_CONTINUE and G_SOURCE_REMOVE. It would be a good idea to poach them, and have them directly inside GLib.
Created attachment 171762 [details] [review] Add macros for GSourceFunc return values The boolean values to be returned by a GSourceFunc are always ambiguous, and even in case of experienced developers then can lead to confusion. The Perl bindings for GLib have two simple constants, mapping to TRUE and FALSE, that make the return values less confusing: G_SOURCE_CONTINUE and G_SOURCE_REMOVE respectively.
Question: Can we get an enum in an API-stable way? It shouldn't be a problem in C code, but I'm not sure what bindings would do if functions suddenly returned an enum with two values mapped to TRUE and FALSE.