Updating branch refs/heads/master
         to 7c3beeff528b524d3c524ff69b660ef12ca592b3 (commit)
       from 8f7c31f3de85c8a973be2ca3d93eb963de0ef3c3 (commit)

commit 7c3beeff528b524d3c524ff69b660ef12ca592b3
Author: Harald Judt <h.j...@gmx.at>
Date:   Thu Jan 31 17:36:22 2013 +0100

    Save initial timezone for later usage.
    
    Check if the TZ environment variable is set and save its value.
    We might need to restore it later, in case the user doesn't provide
    a valid timezone or leaves the timezone field in the config dialog empty.

 panel-plugin/weather-debug.c |    2 ++
 panel-plugin/weather.c       |    5 +++++
 panel-plugin/weather.h       |    1 +
 3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/panel-plugin/weather-debug.c b/panel-plugin/weather-debug.c
index a075ca3..6ced8c0 100644
--- a/panel-plugin/weather-debug.c
+++ b/panel-plugin/weather-debug.c
@@ -425,6 +425,7 @@ weather_dump_plugindata(const plugin_data *data)
                            "  longitude: %s\n"
                            "  msl: %d\n"
                            "  timezone: %s\n"
+                           "  initial timezone: %s\n"
                            "  night time: %s\n"
                            "  --------------------------------------------\n"
                            "  icon theme dir: %s\n"
@@ -459,6 +460,7 @@ weather_dump_plugindata(const plugin_data *data)
                            data->lon,
                            data->msl,
                            data->timezone,
+                           data->timezone_initial,
                            YESNO(data->night_time),
                            (data->icon_theme) ? (data->icon_theme->dir) : NULL,
                            data->tooltip_style,
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 694447a..12360f1 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -1763,6 +1763,7 @@ xfceweather_free(XfcePanelPlugin *plugin,
     g_free(data->location_name);
     g_free(data->scrollbox_font);
     g_free(data->timezone);
+    g_free(data->timezone_initial);
 
     /* free update infos */
     g_slice_free(update_info, data->weather_update);
@@ -1923,6 +1924,10 @@ weather_construct(XfcePanelPlugin *plugin)
 
     xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
     data = xfceweather_create_control(plugin);
+
+    /* save initial timezone so we can reset it later */
+    data->timezone_initial = g_strdup(g_getenv("TZ"));
+
     xfceweather_read_config(plugin, data);
     read_cache_file(data);
     scrollbox_set_visible(data);
diff --git a/panel-plugin/weather.h b/panel-plugin/weather.h
index 317960a..e8250e8 100644
--- a/panel-plugin/weather.h
+++ b/panel-plugin/weather.h
@@ -99,6 +99,7 @@ typedef struct {
     gchar *lon;
     gint msl;
     gchar *timezone;
+    gchar *timezone_initial;
     gint cache_file_max_age;
     gboolean night_time;
 
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to