[gnome-control-center] datetime: Don't crash when the timezone is unknown



commit 56cd9069eed492655c3d79f21a89b987432d3a3c
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Mar 15 01:57:15 2011 +0000

    datetime: Don't crash when the timezone is unknown
    
    Passing "posixrules" to cc_timezone_map_set_timezone() certainly
    won't work that well.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=684593

 panels/datetime/cc-datetime-panel.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index e753cbd..5eba086 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -33,6 +33,8 @@
 #include <libintl.h>
 #include <polkit/polkit.h>
 
+/* FIXME: This should be "Etc/GMT" instead */
+#define DEFAULT_TZ "Europe/London"
 #define GETTEXT_PACKAGE_TIMEZONES GETTEXT_PACKAGE "-timezones"
 
 G_DEFINE_DYNAMIC_TYPE (CcDateTimePanel, cc_date_time_panel, CC_TYPE_PANEL)
@@ -482,7 +484,11 @@ get_timezone_cb (CcDateTimePanel *self,
     }
   else
     {
-      cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), timezone);
+      if (!cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), timezone))
+        {
+          g_warning ("Timezone '%s' is unhandled, setting %s as default", timezone, DEFAULT_TZ);
+          cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), DEFAULT_TZ);
+        }
       self->priv->current_location = cc_timezone_map_get_location (CC_TIMEZONE_MAP (self->priv->map));
       update_timezone (self);
     }



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