aboutsummaryrefslogtreecommitdiffstats
path: root/my-evolution/e-summary-weather.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2003-03-08 03:46:38 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2003-03-08 03:46:38 +0800
commitfd2588484f46784b87881626d598c7b6fe8712c7 (patch)
treedc1fb07f75e3763e36f9996913d561540085a153 /my-evolution/e-summary-weather.c
parent36d9b4794e8e811b8f854d97dcc3f2dd946a7bf8 (diff)
downloadgsoc2013-evolution-fd2588484f46784b87881626d598c7b6fe8712c7.tar
gsoc2013-evolution-fd2588484f46784b87881626d598c7b6fe8712c7.tar.gz
gsoc2013-evolution-fd2588484f46784b87881626d598c7b6fe8712c7.tar.bz2
gsoc2013-evolution-fd2588484f46784b87881626d598c7b6fe8712c7.tar.lz
gsoc2013-evolution-fd2588484f46784b87881626d598c7b6fe8712c7.tar.xz
gsoc2013-evolution-fd2588484f46784b87881626d598c7b6fe8712c7.tar.zst
gsoc2013-evolution-fd2588484f46784b87881626d598c7b6fe8712c7.zip
Add some escapes to the newly added locations so they get split properly.
* Locations (name): Add some escapes to the newly added locations so they get split properly. * e-summary-weather.c (e_summary_weather_init_locations): Fetch the Locations file from the right path. If you find an invalid entry in the Locations file, complain with an informative g_warning() instead of just returning FALSE. (e_summary_weather_fill_etable): Do the same thing here. svn path=/trunk/; revision=20220
Diffstat (limited to 'my-evolution/e-summary-weather.c')
-rw-r--r--my-evolution/e-summary-weather.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/my-evolution/e-summary-weather.c b/my-evolution/e-summary-weather.c
index f6071f32f7..00dbb25198 100644
--- a/my-evolution/e-summary-weather.c
+++ b/my-evolution/e-summary-weather.c
@@ -368,7 +368,6 @@ e_summary_weather_add_location (ESummary *summary,
static gboolean
e_summary_weather_init_locations (void)
{
- char *key, *path;
int nregions, iregions;
char **regions;
@@ -377,13 +376,8 @@ e_summary_weather_init_locations (void)
}
locations_hash = g_hash_table_new (g_str_hash, g_str_equal);
- path = g_strdup (LOCATIONDIR);
- key = g_strdup_printf ("=%s=/", path);
- g_free (path);
-
- gnome_config_push_prefix (key);
- g_free (key);
+ gnome_config_push_prefix ("=" LOCATIONDIR "/Locations=/");
gnome_config_get_vector ("Main/regions", &nregions, &regions);
for (iregions = nregions - 1; iregions >= 0; iregions--) {
@@ -419,7 +413,13 @@ e_summary_weather_init_locations (void)
gnome_config_make_vector (iter_val,
&nlocdata,
&locdata);
- g_return_val_if_fail (nlocdata == 4, FALSE);
+
+ if (nlocdata != 4) {
+ g_warning ("Invalid location in Locations file: %s\n", iter_val);
+ g_free (iter_key);
+ g_free (iter_val);
+ continue;
+ }
if (!g_hash_table_lookup (locations_hash, locdata[1])) {
location = weather_location_new (locdata);
@@ -660,17 +660,10 @@ e_summary_weather_fill_etable (ESummaryShown *ess)
{
ETreePath region, state, location;
ESummaryShownModelEntry *entry;
- char *key, *path;
int nregions, iregions;
char **regions;
- path = g_strdup (LOCATIONDIR);
-
- key = g_strdup_printf ("=%s=/", path);
- g_free (path);
-
- gnome_config_push_prefix (key);
- g_free (key);
+ gnome_config_push_prefix ("=" LOCATIONDIR "/Locations=/");
gnome_config_get_vector ("Main/regions", &nregions, &regions);
region = NULL;
@@ -722,7 +715,12 @@ e_summary_weather_fill_etable (ESummaryShown *ess)
gnome_config_make_vector (iter_val,
&nlocdata,
&locdata);
- g_return_if_fail (nlocdata == 4);
+ if (nlocdata != 4) {
+ g_warning ("Invalid location in Locations file: %s\n", iter_val);
+ g_free (iter_key);
+ g_free (iter_val);
+ continue;
+ }
entry = g_new (ESummaryShownModelEntry, 1);
entry->location = g_strdup (locdata[1]);