[gtk/assorted-menu-fixes: 1/3] widget-factory: Catch errors



commit 4a20a3fdb24e368023538de2e836f2eea9d88fb6
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Apr 17 08:55:56 2020 -0400

    widget-factory: Catch errors
    
    This speeds up the debugging when doing quick experimental
    changes to widget-factory.ui.

 demos/widget-factory/widget-factory.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index 40ce3e286c..8752760c88 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -1736,6 +1736,7 @@ activate (GApplication *app)
   gint i;
   GPermission *permission;
   GAction *action;
+  GError *error = NULL;
 
   g_object_get (gtk_settings_get_default (),
                 "gtk-theme-name", &current_theme,
@@ -1768,7 +1769,11 @@ activate (GApplication *app)
           NULL);
   gtk_builder_set_scope (builder, scope);
   g_object_unref (scope);
-  gtk_builder_add_from_resource (builder, "/org/gtk/WidgetFactory4/widget-factory.ui", NULL);
+  if (!gtk_builder_add_from_resource (builder, "/org/gtk/WidgetFactory4/widget-factory.ui", &error))
+    {
+      g_critical ("%s", error->message);
+      g_clear_error (&error);
+    }
 
   window = (GtkWindow *)gtk_builder_get_object (builder, "window");
   gtk_application_add_window (GTK_APPLICATION (app), window);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]