[Xfce4-commits] <xfce4-weather-plugin:master> Use timezone provided in config dialog.

Harald Judt noreply at xfce.org
Fri Feb 1 16:20:08 CET 2013


Updating branch refs/heads/master
         to 12cfe8cb47126c869b5efd0a760f9f44b0b9c7ae (commit)
       from 7c3beeff528b524d3c524ff69b660ef12ca592b3 (commit)

commit 12cfe8cb47126c869b5efd0a760f9f44b0b9c7ae
Author: Harald Judt <h.judt at gmx.at>
Date:   Thu Jan 31 18:12:35 2013 +0100

    Use timezone provided in config dialog.
    
    If the timezone entry is empty, use the initial timezone, else use
    the timezone provided. If it is an invalid entry, then most likely
    UTC will be used, but that may depend on the system.

 panel-plugin/weather-config.c |    1 +
 panel-plugin/weather.c        |   19 +++++++++++++++++++
 panel-plugin/weather.h        |    2 ++
 3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index eac0fd0..5145467 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -468,6 +468,7 @@ text_timezone_changed(const GtkWidget *entry,
     if (dialog->pd->timezone)
         g_free(dialog->pd->timezone);
     dialog->pd->timezone = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
+    schedule_delayed_data_update(dialog);
 }
 
 
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 12360f1..9db161d 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -261,6 +261,20 @@ get_tooltip_icon_size(plugin_data *data)
 
 
 void
+update_timezone(plugin_data *data)
+{
+    if (data->timezone && strlen(data->timezone) > 0)
+        g_setenv("TZ", data->timezone, TRUE);
+    else {
+        if (data->timezone_initial && strlen(data->timezone_initial) > 0)
+            g_setenv("TZ", data->timezone_initial, TRUE);
+        else
+            g_unsetenv("TZ");
+    }
+}
+
+
+void
 update_icon(plugin_data *data)
 {
     GdkPixbuf *icon;
@@ -1289,6 +1303,10 @@ update_weatherdata_with_reset(plugin_data *data, gboolean clear)
         data->update_timer = 0;
     }
 
+    /* set location timezone */
+    if (clear)
+        update_timezone(data);
+
     /* reset update times */
     init_update_infos(data);
 
@@ -1929,6 +1947,7 @@ weather_construct(XfcePanelPlugin *plugin)
     data->timezone_initial = g_strdup(g_getenv("TZ"));
 
     xfceweather_read_config(plugin, data);
+    update_timezone(data);
     read_cache_file(data);
     scrollbox_set_visible(data);
     gtk_scrollbox_set_fontname(GTK_SCROLLBOX(data->scrollbox),
diff --git a/panel-plugin/weather.h b/panel-plugin/weather.h
index e8250e8..5b5e084 100644
--- a/panel-plugin/weather.h
+++ b/panel-plugin/weather.h
@@ -127,6 +127,8 @@ void forecast_click(GtkWidget *widget,
 
 gchar *get_cache_directory(void);
 
+void update_timezone(plugin_data *data);
+
 void update_icon(plugin_data *data);
 
 void update_scrollbox(plugin_data *data,


More information about the Xfce4-commits mailing list