gnome-panel r11440 - branches/gnome-2-24/applets/clock
- From: mattk svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-panel r11440 - branches/gnome-2-24/applets/clock
- Date: Mon, 12 Jan 2009 16:00:50 +0000 (UTC)
Author: mattk
Date: Mon Jan 12 16:00:49 2009
New Revision: 11440
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11440&view=rev
Log:
* clock-location.c: (clock_location_new): use
clock_location_get_valid_weather_code()
(clock_location_get_valid_weather_code): new, to use "-" for empty code
(clock_location_set_weather_code): use
clock_location_get_valid_weather_code()
(setup_weather_updates): update to use WEATHER_EMPTY_CODE
Fix bug #560200 (crash on Solaris when the weather code is empty)
Fix taken from trunk implemented by vuntz
Modified:
branches/gnome-2-24/applets/clock/ChangeLog
branches/gnome-2-24/applets/clock/clock-location.c
Modified: branches/gnome-2-24/applets/clock/clock-location.c
==============================================================================
--- branches/gnome-2-24/applets/clock/clock-location.c (original)
+++ branches/gnome-2-24/applets/clock/clock-location.c Mon Jan 12 16:00:49 2009
@@ -52,6 +52,7 @@
#define WEATHER_TIMEOUT_BASE 30
#define WEATHER_TIMEOUT_MAX 1800
+#define WEATHER_EMPTY_CODE "-"
enum {
WEATHER_UPDATED,
@@ -67,6 +68,7 @@
static void setup_weather_updates (ClockLocation *loc);
static void add_to_network_monitor (ClockLocation *loc);
static void remove_from_network_monitor (ClockLocation *loc);
+static gchar* clock_location_get_valid_weather_code (const gchar *code);
#define PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CLOCK_LOCATION_TYPE, ClockLocationPrivate))
@@ -119,7 +121,7 @@
priv->latitude = latitude;
priv->longitude = longitude;
- priv->weather_code = g_strdup (code);
+ priv->weather_code = clock_location_get_valid_weather_code(code);
if (prefs) {
priv->temperature_unit = prefs->temperature_unit;
@@ -538,6 +540,15 @@
g_free (filename);
}
+static gchar *
+clock_location_get_valid_weather_code (const gchar *code)
+{
+ if (!code || code[0] == '\0')
+ return g_strdup (WEATHER_EMPTY_CODE);
+ else
+ return g_strdup (code);
+}
+
const gchar *
clock_location_get_weather_code (ClockLocation *loc)
{
@@ -552,7 +563,7 @@
ClockLocationPrivate *priv = PRIVATE (loc);
g_free (priv->weather_code);
- priv->weather_code = g_strdup (code);
+ priv->weather_code = clock_location_get_valid_weather_code (code);
setup_weather_updates (loc);
}
@@ -807,7 +818,7 @@
priv->weather_timeout = 0;
}
- if (!priv->weather_code || strcmp (priv->weather_code, "-") == 0)
+ if (!priv->weather_code || strcmp (priv->weather_code, WEATHER_EMPTY_CODE) == 0)
return;
dms = rad2dms (priv->latitude, priv->longitude);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]