[gnome-control-center] datetime: Check the retval of GtkBuilder function



commit a3b899160dea546f8515aff1a442b549476d6db5
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Sep 21 11:04:11 2010 +0100

    datetime: Check the retval of GtkBuilder function
    
    And don't just check the error itself.

 panels/datetime/cc-datetime-panel.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index 5cc7409..c884f36 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -440,18 +440,20 @@ cc_date_time_panel_init (CcDateTimePanel *self)
   struct tm *ltime;
   time_t t;
   GtkTreeModelFilter *city_modelfilter;
+  int ret;
 
   priv = self->priv = DATE_TIME_PANEL_PRIVATE (self);
 
   priv->builder = gtk_builder_new ();
 
-  gtk_builder_add_objects_from_file (priv->builder, DATADIR"/datetime.ui",
-                                     objects, &err);
+  ret = gtk_builder_add_objects_from_file (priv->builder, DATADIR"/datetime.ui",
+                                           objects, &err);
 
-  if (err)
+  if (ret == 0)
     {
-      g_warning ("Could not load ui: %s", err->message);
-      g_error_free (err);
+      g_warning ("Could not load ui: %s", err ? err->message : "No reason");
+      if (err)
+        g_error_free (err);
       return;
     }
 



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