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.

https://bugzilla.gnome.org/show_bug.cgi?id=631413
This commit is contained in:
Emmanuele Bassi 2010-10-05 14:01:05 +01:00 committed by Ryan Lortie
parent e5653c0050
commit e15d5313af
2 changed files with 24 additions and 0 deletions

View File

@ -446,6 +446,10 @@ G_PRIORITY_HIGH_IDLE
G_PRIORITY_DEFAULT_IDLE
G_PRIORITY_LOW
<SUBSECTION>
G_SOURCE_CONTINUE
G_SOURCE_REMOVE
<SUBSECTION>
GMainContext
g_main_context_new

View File

@ -258,6 +258,26 @@ struct _GSourceFuncs
*/
#define G_PRIORITY_LOW 300
/**
* G_SOURCE_REMOVE:
*
* Use this macro as the return value of a #GSourceFunc to remove
* the #GSource from the main loop.
*
* Since: 2.28
*/
#define G_SOURCE_REMOVE FALSE
/**
* G_SOURCE_CONTINUE:
*
* Use this macro as the return value of a #GSourceFunc to leave
* the #GSource in the main loop.
*
* Since: 2.28
*/
#define G_SOURCE_CONTINUE TRUE
/* GMainContext: */
GMainContext *g_main_context_new (void);