From e15d5313af8bc1fd4f68e7ddc59cd73a3a2c9502 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 5 Oct 2010 14:01:05 +0100 Subject: [PATCH] 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 --- docs/reference/glib/glib-sections.txt | 4 ++++ glib/gmain.h | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt index 069270c..13f3526 100644 --- a/docs/reference/glib/glib-sections.txt +++ b/docs/reference/glib/glib-sections.txt @@ -447,6 +447,10 @@ G_PRIORITY_DEFAULT_IDLE G_PRIORITY_LOW +G_SOURCE_CONTINUE +G_SOURCE_REMOVE + + GMainContext g_main_context_new g_main_context_ref diff --git a/glib/gmain.h b/glib/gmain.h index e6336b8..80895e2 100644 --- a/glib/gmain.h +++ b/glib/gmain.h @@ -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); -- 2.7.4