gnome-panel r11037 - trunk/applets/clock



Author: vuntz
Date: Thu Apr 10 11:52:28 2008
New Revision: 11037
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11037&view=rev

Log:
2008-04-10  Vincent Untz  <vuntz gnome org>

	* clock-zonetable.c: (clock_zonetable_load_zonetab),
	(clock_zonetable_load_iso3166): do not assume the timezone and country
	data files exist, so don't crash when they're not present. We still
	need to define a proper behavior when we don't have timezone data,
	though.
	Fix bug #527309.


Modified:
   trunk/applets/clock/ChangeLog
   trunk/applets/clock/clock-zonetable.c

Modified: trunk/applets/clock/clock-zonetable.c
==============================================================================
--- trunk/applets/clock/clock-zonetable.c	(original)
+++ trunk/applets/clock/clock-zonetable.c	Thu Apr 10 11:52:28 2008
@@ -285,8 +285,13 @@
 
         channel = g_io_channel_new_file (ZONETAB_FILE, "r", NULL);
 
-        /* FIXME: be more solid than just crashing */
-        g_assert (channel != NULL);
+        /* If the file cannot be read, then it means we won't know anything
+         * about timezones. Ouch. FIXME: should we hide all the timezone
+         * feature in this case? */
+        if (!channel) {
+                g_warning ("No timezone data installed.");
+                return;
+        }
 
         old_line = NULL;
         while (g_io_channel_read_line (channel, &line, NULL,
@@ -332,8 +337,11 @@
 
         channel = g_io_channel_new_file (ISO3166_FILE, "r", NULL);
 
-        /* FIXME: be more solid than just crashing */
-        g_assert (channel != NULL);
+        /* If the file cannot be read, then it means we won't have any country
+         * name in the user interface. It's a minor problem that we can live
+         * with. */
+        if (!channel)
+                return;
 
         old_line = NULL;
         while (g_io_channel_read_line (channel, &line, NULL,



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