[gnome-bluetooth/fedora-11] Print out errors when GtkBuilder files fail parsing



commit fbd08ce783b8d25514e6436d05865267385c6834
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jul 30 16:02:08 2009 +0100

    Print out errors when GtkBuilder files fail parsing

 applet/main.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/applet/main.c b/applet/main.c
index f9ea351..c849e17 100644
--- a/applet/main.c
+++ b/applet/main.c
@@ -309,10 +309,23 @@ killswitch_state_changed (BluetoothKillswitch *killswitch, KillswitchState state
 static GtkWidget *create_popupmenu(void)
 {
 	GObject *object;
+	GError *error = NULL;
 
 	xml = gtk_builder_new ();
-	if (gtk_builder_add_from_file (xml, "popup-menu.ui", NULL) == 0)
-		gtk_builder_add_from_file (xml, PKGDATADIR "/popup-menu.ui", NULL);
+	if (gtk_builder_add_from_file (xml, "popup-menu.ui", &error) == 0) {
+		if (error->domain == GTK_BUILDER_ERROR) {
+			g_warning ("Failed to load popup-menu.ui: %s", error->message);
+			g_error_free (error);
+			return NULL;
+		}
+		g_error_free (error);
+		error = NULL;
+		if (gtk_builder_add_from_file (xml, PKGDATADIR "/popup-menu.ui", &error) == 0) {
+			g_warning ("Failed to load popup-menu.ui: %s", error->message);
+			g_error_free (error);
+			return NULL;
+		}
+	}
 
 	gtk_builder_connect_signals (xml, NULL);
 



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