[gtk/builder-tool-nodisplay] gtk-builder-tool: Operate without display
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/builder-tool-nodisplay] gtk-builder-tool: Operate without display
- Date: Mon, 14 Mar 2022 19:42:07 +0000 (UTC)
commit 525f96f2f8d03937354bb1b625727139c8fc0d6b
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Mar 14 15:40:12 2022 -0400
gtk-builder-tool: Operate without display
The simplify and validate commands can function
without a display connection, only preview absolutely
needs one. Allow this, by using gtk_init_check().
tools/gtk-builder-tool.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/tools/gtk-builder-tool.c b/tools/gtk-builder-tool.c
index bc89207049..b62773738a 100644
--- a/tools/gtk-builder-tool.c
+++ b/tools/gtk-builder-tool.c
@@ -109,11 +109,13 @@ 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);
- gtk_init ();
+ has_display = gtk_init_check ();
gtk_test_register_all_types ();
@@ -133,7 +135,15 @@ main (int argc, const char *argv[])
else if (strcmp (argv[0], "enumerate") == 0)
do_enumerate (&argc, &argv);
else if (strcmp (argv[0], "preview") == 0)
- do_preview (&argc, &argv);
+ {
+ if (!has_display)
+ {
+ g_printerr ("Could not initialize windowing system\n");
+ return 1;
+ }
+
+ do_preview (&argc, &argv);
+ }
else
usage ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]