gtk+ r22094 - in branches/gtk-2-14: . gdk
- From: tml svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r22094 - in branches/gtk-2-14: . gdk
- Date: Mon, 12 Jan 2009 12:00:08 +0000 (UTC)
Author: tml
Date: Mon Jan 12 12:00:08 2009
New Revision: 22094
URL: http://svn.gnome.org/viewvc/gtk+?rev=22094&view=rev
Log:
2009-01-12 Tor Lillqvist <tml iki fi>
* gdk/gdk.c (gdk_arg_debug_cb) (gdk_arg_no_debug_cb): A
GOptionArgFunc should return gboolean and take also a GError
pointer parameter, so make these two functions do that. Return
FALSE (and set the GError) if the parsing of the debug string
failed completely. Note that g_parse_debug_string() doesn't really
have any way to return parsing status, and accepts partially
incorrect strings, though.
Modified:
branches/gtk-2-14/ChangeLog
branches/gtk-2-14/gdk/gdk.c
Modified: branches/gtk-2-14/gdk/gdk.c
==============================================================================
--- branches/gtk-2-14/gdk/gdk.c (original)
+++ branches/gtk-2-14/gdk/gdk.c Mon Jan 12 12:00:08 2009
@@ -88,20 +88,44 @@
#endif /* G_ENABLE_DEBUG */
#ifdef G_ENABLE_DEBUG
-static void
-gdk_arg_debug_cb (const char *key, const char *value, gpointer user_data)
+static gboolean
+gdk_arg_debug_cb (const char *key, const char *value, gpointer user_data, GError **error)
{
- _gdk_debug_flags |= g_parse_debug_string (value,
+ guint debug_value = g_parse_debug_string (value,
(GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys);
+
+ if (debug_value == 0 && value != NULL && strcmp (value, "") != 0)
+ {
+ g_set_error (error,
+ G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
+ "Error parsing option --gdk-debug");
+ return FALSE;
+ }
+
+ _gdk_debug_flags |= debug_value;
+
+ return TRUE;
}
-static void
-gdk_arg_no_debug_cb (const char *key, const char *value, gpointer user_data)
+static gboolean
+gdk_arg_no_debug_cb (const char *key, const char *value, gpointer user_data, GError **error)
{
- _gdk_debug_flags &= ~g_parse_debug_string (value,
- (GDebugKey *) gdk_debug_keys,
- gdk_ndebug_keys);
+ guint debug_value = g_parse_debug_string (value,
+ (GDebugKey *) gdk_debug_keys,
+ gdk_ndebug_keys);
+
+ if (debug_value == 0 && value != NULL && strcmp (value, "") != 0)
+ {
+ g_set_error (error,
+ G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
+ "Error parsing option --gdk-no-debug");
+ return FALSE;
+ }
+
+ _gdk_debug_flags &= ~debug_value;
+
+ return TRUE;
}
#endif /* G_ENABLE_DEBUG */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]