[gnome-control-center] datetime: Return FALSE when we fail to find a timezone



commit cb3c0af71de8f64bc61acba434ccbf5882b29034
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Mar 15 00:49:00 2011 +0000

    datetime: Return FALSE when we fail to find a timezone

 panels/datetime/cc-timezone-map.c |   10 ++++++++--
 panels/datetime/cc-timezone-map.h |    4 ++--
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/panels/datetime/cc-timezone-map.c b/panels/datetime/cc-timezone-map.c
index 5f7a0db..4699841 100644
--- a/panels/datetime/cc-timezone-map.c
+++ b/panels/datetime/cc-timezone-map.c
@@ -636,17 +636,19 @@ cc_timezone_map_new (void)
   return g_object_new (CC_TYPE_TIMEZONE_MAP, NULL);
 }
 
-void
+gboolean
 cc_timezone_map_set_timezone (CcTimezoneMap *map,
                               const gchar   *timezone)
 {
   GPtrArray *locations;
   guint i;
   char *real_tz;
+  gboolean ret;
 
   real_tz = g_hash_table_lookup (map->priv->alias_db, timezone);
 
   locations = tz_get_locations (map->priv->tzdb);
+  ret = FALSE;
 
   for (i = 0; i < locations->len; i++)
     {
@@ -655,11 +657,15 @@ cc_timezone_map_set_timezone (CcTimezoneMap *map,
       if (!g_strcmp0 (loc->zone, real_tz ? real_tz : timezone))
         {
           set_location (map, loc);
+          ret = TRUE;
           break;
         }
     }
 
-  gtk_widget_queue_draw (GTK_WIDGET (map));
+  if (ret)
+    gtk_widget_queue_draw (GTK_WIDGET (map));
+
+  return ret;
 }
 
 TzLocation *
diff --git a/panels/datetime/cc-timezone-map.h b/panels/datetime/cc-timezone-map.h
index 3c57b27..bb15def 100644
--- a/panels/datetime/cc-timezone-map.h
+++ b/panels/datetime/cc-timezone-map.h
@@ -70,8 +70,8 @@ GType cc_timezone_map_get_type (void) G_GNUC_CONST;
 
 CcTimezoneMap *cc_timezone_map_new (void);
 
-void cc_timezone_map_set_timezone (CcTimezoneMap *map,
-                                   const gchar   *timezone);
+gboolean cc_timezone_map_set_timezone (CcTimezoneMap *map,
+                                       const gchar   *timezone);
 TzLocation * cc_timezone_map_get_location (CcTimezoneMap *map);
 
 G_END_DECLS



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