main: Set the error if gtk_init_with_args fails
This fixes a fallout from 8a7d0ab481 where the error wasn't being
set when a display couldn't be opened right after parsing the
commandline.
It also fixes an older bug where the error would be left unset if the
commandline had already been parsed before (ie. when gtk_initialized
is TRUE).
https://bugzilla.gnome.org/show_bug.cgi?id=771959
This commit is contained in:
@@ -992,15 +992,22 @@ gtk_init_with_args (gint *argc,
|
||||
return FALSE;
|
||||
|
||||
done:
|
||||
if (GDK_PRIVATE_CALL (gdk_display_open_default) () != NULL)
|
||||
if (GDK_PRIVATE_CALL (gdk_display_open_default) () == NULL)
|
||||
{
|
||||
if (gtk_get_debug_flags () & GTK_DEBUG_INTERACTIVE)
|
||||
gtk_window_set_interactive_debugging (TRUE);
|
||||
const char *display_name = gdk_get_display_arg_name ();
|
||||
g_set_error (error,
|
||||
G_OPTION_ERROR,
|
||||
G_OPTION_ERROR_FAILED,
|
||||
_("Cannot open display: %s"),
|
||||
display_name ? display_name : "" );
|
||||
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
if (gtk_get_debug_flags () & GTK_DEBUG_INTERACTIVE)
|
||||
gtk_window_set_interactive_debugging (TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user