summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@mail.utexas.edu>2005-12-05 00:44:48 +0000
committerPhilip Langdale <philipl@src.gnome.org>2005-12-05 00:44:48 +0000
commit4feffdf186e04ed262b004cabf40aa57f25b1f79 (patch)
treee91fed468398b654221bc8cfbafba9ee33bcfd92
parent26266ba738f14e0aa5f8fa0e734bd585284dc60f (diff)
See the library ChangeLog for details.
2005-12-04 Philip Langdale <philipl@mail.utexas.edu> * libgweatherprefs: See the library ChangeLog for details.
-rw-r--r--ChangeLog4
-rw-r--r--libgweatherprefs/ChangeLog10
-rw-r--r--libgweatherprefs/gweather-gconf.c8
-rw-r--r--libgweatherprefs/gweather-gconf.h3
-rw-r--r--libgweatherprefs/gweather-prefs.c25
5 files changed, 41 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 14b6ab649..6dc5167b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-12-04 Philip Langdale <philipl@mail.utexas.edu>
+
+ * libgweatherprefs: See the library ChangeLog for details.
+
2005-11-30 Philip Langdale <philipl@mail.utexas.edu>
* gweather: Updated gweather to use libgweather and
diff --git a/libgweatherprefs/ChangeLog b/libgweatherprefs/ChangeLog
index 49b42720a..206480fb7 100644
--- a/libgweatherprefs/ChangeLog
+++ b/libgweatherprefs/ChangeLog
@@ -1,3 +1,13 @@
+2005-12-04 Philip Langdale <philipl@mail.utexas.edu>
+
+ * gweather-gconf.c
+ * gweather-gconf.h: Add gweather_gconf_get_client
+ to provide access to the GConfClient.
+
+ * gweather-prefs.c: make gweather_prefs_load work
+ correctly when called multiple times. The old
+ radar url was not previously being freed.
+
2005-11-27 Philip Langdale <philipl@mail.utexas.edu>
Initial checkin of libgweatherprefs.
diff --git a/libgweatherprefs/gweather-gconf.c b/libgweatherprefs/gweather-gconf.c
index 49dca4ce9..d8ad52c60 100644
--- a/libgweatherprefs/gweather-gconf.c
+++ b/libgweatherprefs/gweather-gconf.c
@@ -29,7 +29,6 @@
#include <string.h>
#include <glib/gi18n.h>
-#include <gconf/gconf-client.h>
#include <libgweatherprefs/gweather-gconf.h>
struct _GWeatherGConf
@@ -59,6 +58,13 @@ gweather_gconf_free(GWeatherGConf *ctx)
}
+GConfClient *
+gweather_gconf_get_client(GWeatherGConf *ctx)
+{
+ return ctx->gconf;
+}
+
+
gchar *
gweather_gconf_get_full_key (GWeatherGConf *ctx,
const gchar *key)
diff --git a/libgweatherprefs/gweather-gconf.h b/libgweatherprefs/gweather-gconf.h
index edf53018c..e5446a29d 100644
--- a/libgweatherprefs/gweather-gconf.h
+++ b/libgweatherprefs/gweather-gconf.h
@@ -28,6 +28,7 @@
#include <glib/gmacros.h>
#include <glib/gerror.h>
+#include <gconf/gconf-client.h>
#include <gconf/gconf-value.h>
#include <libgweather/weather.h>
@@ -39,6 +40,8 @@ typedef struct _GWeatherGConf GWeatherGConf;
GWeatherGConf * gweather_gconf_new (const char *prefix);
void gweather_gconf_free (GWeatherGConf *ctx);
+GConfClient * gweather_gconf_get_client (GWeatherGConf *ctx);
+
WeatherLocation * gweather_gconf_get_location (GWeatherGConf *ctx);
gchar * gweather_gconf_get_full_key (GWeatherGConf *ctx,
diff --git a/libgweatherprefs/gweather-prefs.c b/libgweatherprefs/gweather-prefs.c
index 0bc9dcb62..464bea29f 100644
--- a/libgweatherprefs/gweather-prefs.c
+++ b/libgweatherprefs/gweather-prefs.c
@@ -236,6 +236,11 @@ void gweather_prefs_load (GWeatherPrefs *prefs, GWeatherGConf *ctx)
GError *error = NULL;
gchar *gconf_str = NULL;
+ if (prefs->location) {
+ weather_location_free(prefs->location);
+ }
+ prefs->location = gweather_gconf_get_location(ctx);
+
/* Assume we use unit defaults */
prefs->use_temperature_default = TRUE;
prefs->use_speed_default = TRUE;
@@ -256,26 +261,30 @@ void gweather_prefs_load (GWeatherPrefs *prefs, GWeatherGConf *ctx)
gweather_gconf_get_bool(ctx, "enable_detailed_forecast", NULL);
prefs->radar_enabled =
gweather_gconf_get_bool(ctx, "enable_radar_map", NULL);
- prefs->location = gweather_gconf_get_location(ctx);
prefs->use_custom_radar_url =
gweather_gconf_get_bool(ctx, "use_custom_radar_url", NULL);
+
+ if (prefs->radar) {
+ g_free(prefs->radar);
+ prefs->radar = NULL;
+ }
prefs->radar = gweather_gconf_get_string (ctx, "radar", NULL);
gconf_str = gweather_gconf_get_string (ctx, GCONF_TEMP_UNIT, NULL);
parse_temp_string(gconf_str, prefs);
- g_free (gconf_str);
+ g_free (gconf_str);
gconf_str = gweather_gconf_get_string (ctx, GCONF_SPEED_UNIT, NULL);
- parse_speed_string(gconf_str, prefs);
- g_free (gconf_str);
+ parse_speed_string(gconf_str, prefs);
+ g_free (gconf_str);
gconf_str = gweather_gconf_get_string (ctx, GCONF_PRESSURE_UNIT, NULL);
- parse_pressure_string(gconf_str, prefs);
- g_free (gconf_str);
+ parse_pressure_string(gconf_str, prefs);
+ g_free (gconf_str);
gconf_str = gweather_gconf_get_string (ctx, GCONF_DISTANCE_UNIT, NULL);
- parse_distance_string(gconf_str, prefs);
- g_free (gconf_str);
+ parse_distance_string(gconf_str, prefs);
+ g_free (gconf_str);
return;
}