From: Matthias Clasen Date: Sun, 17 Apr 2022 15:19:07 +0000 (-0400) Subject: gtk-builder-tool: Small reshuffle X-Git-Tag: archive/raspbian/4.8.3+ds-2+rpi1~3^2~20^2~4^2~246^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b88ac0890eaeb4294d41ba409cbd8460d575fcad;p=gtk4.git gtk-builder-tool: Small reshuffle Move the display check into the preview command. --- diff --git a/tools/gtk-builder-tool-preview.c b/tools/gtk-builder-tool-preview.c index db345c7bca..df6e29976f 100644 --- a/tools/gtk-builder-tool-preview.c +++ b/tools/gtk-builder-tool-preview.c @@ -180,6 +180,12 @@ do_preview (int *argc, }; GError *error = NULL; + if (gdk_display_get_default () == NULL) + { + g_printerr ("Could not initialize windowing system\n"); + exit (1); + } + context = g_option_context_new (NULL); g_option_context_set_help_enabled (context, FALSE); g_option_context_add_main_entries (context, entries, NULL); diff --git a/tools/gtk-builder-tool.c b/tools/gtk-builder-tool.c index b62773738a..7de50fc283 100644 --- a/tools/gtk-builder-tool.c +++ b/tools/gtk-builder-tool.c @@ -109,13 +109,11 @@ log_writer_func (GLogLevelFlags level, int main (int argc, const char *argv[]) { - gboolean has_display; - g_set_prgname ("gtk-builder-tool"); g_log_set_writer_func (log_writer_func, NULL, NULL); - has_display = gtk_init_check (); + gtk_init_check (); gtk_test_register_all_types (); @@ -135,15 +133,7 @@ main (int argc, const char *argv[]) else if (strcmp (argv[0], "enumerate") == 0) do_enumerate (&argc, &argv); else if (strcmp (argv[0], "preview") == 0) - { - if (!has_display) - { - g_printerr ("Could not initialize windowing system\n"); - return 1; - } - - do_preview (&argc, &argv); - } + do_preview (&argc, &argv); else usage ();