From 440289403e0b3429fc1f429b7b40aec8215c40d2 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 6 Mar 2006 17:42:35 +0000 Subject: [PATCH] Set error when returning FALSE. (#333268, Paolo Maggi, Christian Persch) 2006-03-06 Matthias Clasen * gtk/gtkmain.c (post_parse_hook): Set error when returning FALSE. (#333268, Paolo Maggi, Christian Persch) --- ChangeLog | 3 +++ ChangeLog.pre-2-10 | 3 +++ gtk/gtkmain.c | 18 ++++++++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8817cbab75..59bdbcd37b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-03-06 Matthias Clasen + * gtk/gtkmain.c (post_parse_hook): Set error when returning + FALSE. (#333268, Paolo Maggi, Christian Persch) + * gtk/gtkpixmap.c (gtk_pixmap_set): Check that the pixmap has the right depth. (#333363, Ed Catmur) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 8817cbab75..59bdbcd37b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,8 @@ 2006-03-06 Matthias Clasen + * gtk/gtkmain.c (post_parse_hook): Set error when returning + FALSE. (#333268, Paolo Maggi, Christian Persch) + * gtk/gtkpixmap.c (gtk_pixmap_set): Check that the pixmap has the right depth. (#333363, Ed Catmur) diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 8c211bab14..31d766c638 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -548,13 +548,23 @@ post_parse_hook (GOptionContext *context, { OptionGroupInfo *info = data; - do_post_parse_initialization (NULL, NULL); if (info->open_default_display) - return gdk_display_open_default_libgtk_only () != NULL; - else - return TRUE; + { + if (gdk_display_open_default_libgtk_only () == NULL) + { + g_set_error (error, + G_OPTION_ERROR, + G_OPTION_ERROR_FAILED, + "cannot open display: %s", + gdk_get_display_arg_name ()); + + return FALSE; + } + } + + return TRUE; }