[Xfce4-commits] <xfce4-weather-plugin:master> Config dialog: Remove timezone-related code (UI only).

Harald Judt noreply at xfce.org
Mon Jan 14 18:08:11 CET 2013


Updating branch refs/heads/master
         to 0e4a2bee11fb3ac73f65ee2e75704cd47bce1f63 (commit)
       from 7c4d1dfafaea08facd7aeb2e89abafb7d3e12251 (commit)

commit 0e4a2bee11fb3ac73f65ee2e75704cd47bce1f63
Author: Harald Judt <h.judt at gmx.at>
Date:   Sat Jan 12 12:44:20 2013 +0100

    Config dialog: Remove timezone-related code (UI only).
    
    For the next release, this is useless as it doesn't do anything,
    so hide it from the user and prevent HTTP requests to EarthTools.
    Also avoid reading and writing timezone stuff to the config file.
    
    This removes that stuff in a way that it can be reverted easily.

 panel-plugin/weather-config.c |   51 ++++++----------------------------------
 panel-plugin/weather-debug.c  |    2 -
 panel-plugin/weather.c        |   20 +--------------
 3 files changed, 10 insertions(+), 63 deletions(-)

diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index 0b49a71..01cfbcd 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -273,7 +273,7 @@ cb_lookup_timezone(SoupSession *session,
 
 
 static void
-lookup_altitude_timezone(const gpointer user_data)
+lookup_altitude(const gpointer user_data)
 {
     xfceweather_dialog *dialog = (xfceweather_dialog *) user_data;
     gchar *url, *latstr, *lonstr;
@@ -293,13 +293,6 @@ lookup_altitude_timezone(const gpointer user_data)
                                cb_lookup_altitude, user_data);
     g_free(url);
 
-    /* lookup timezone */
-    url = g_strdup_printf("http://www.earthtools.org/timezone/%s/%s",
-                          latstr, lonstr);
-    weather_http_queue_request(dialog->pd->session, url,
-                               cb_lookup_timezone, user_data);
-    g_free(url);
-
     g_free(lonstr);
     g_free(latstr);
 }
@@ -320,7 +313,7 @@ auto_locate_cb(const gchar *loc_name,
                                   string_to_double(lat, 0));
         gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->spin_lon),
                                   string_to_double(lon, 0));
-        lookup_altitude_timezone(user_data);
+        lookup_altitude(user_data);
     } else
         gtk_entry_set_text(GTK_ENTRY(dialog->text_loc_name), _("Unset"));
     setup_units(dialog, units);
@@ -367,7 +360,7 @@ cb_findlocation(GtkButton *button,
     }
     free_search_dialog(sdialog);
 
-    lookup_altitude_timezone(user_data);
+    lookup_altitude(user_data);
     gtk_widget_set_sensitive(GTK_WIDGET(button), TRUE);
 
     return FALSE;
@@ -460,17 +453,6 @@ spin_alt_value_changed(const GtkWidget *spin,
 }
 
 
-static void
-spin_timezone_value_changed(const GtkWidget *spin,
-                            gpointer user_data)
-{
-    xfceweather_dialog *dialog = (xfceweather_dialog *) user_data;
-
-    dialog->pd->timezone =
-        gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin));
-}
-
-
 static GtkWidget *
 create_location_page(xfceweather_dialog *dialog)
 {
@@ -523,7 +505,7 @@ create_location_page(xfceweather_dialog *dialog)
     SET_TOOLTIP(dialog->spin_lat,
                 _("Latitude specifies the north-south position of a point on "
                   "the Earth's surface. If you change this value manually, "
-                  "you need to provide altitude and timezone manually too."));
+                  "you should provide the correct altitude too."));
     label = gtk_label_new("°");
     gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
@@ -537,7 +519,7 @@ create_location_page(xfceweather_dialog *dialog)
     SET_TOOLTIP(dialog->spin_lon,
                 _("Longitude specifies the east-west position of a point on "
                   "the Earth's surface. If you change this value manually, "
-                  "you need to provide altitude and timezone manually too."));
+                  "you should provide the correct altitude too."));
     label = gtk_label_new("°");
     gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
@@ -566,28 +548,13 @@ create_location_page(xfceweather_dialog *dialog)
     gtk_box_pack_start(GTK_BOX(hbox), dialog->label_alt_unit, FALSE, FALSE, 0);
     gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, BORDER);
 
-    /* timezone */
-    hbox = gtk_hbox_new(FALSE, BORDER);
-    ADD_LABEL(_("_Timezone:"), sg_label);
-    ADD_SPIN(dialog->spin_timezone, -25, 25, 0.5,
-             dialog->pd->timezone, 1, sg_spin);
-    SET_TOOLTIP
-        (dialog->spin_timezone,
-         _("If the chosen location is not in your current timezone, this "
-           "value which is auto-detected using the EarthTools web service "
-           "will be used for correcting the time differences. Please adjust "
-           "it manually to accomodate for daylight summer time or if it "
-           "is not correct."));
-    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, BORDER);
-
-    /* instructions for correction of altitude and timezone */
+    /* instructions for correction of altitude */
     hbox = gtk_hbox_new(FALSE, BORDER);
     label = gtk_label_new(NULL);
     gtk_label_set_markup
         (GTK_LABEL(label),
-         _("<i>Please change location name to your liking and "
-           "correct\naltitude and timezone if they are "
-           "not auto-detected correctly.</i>"));
+         _("\n\n\n\n<i>Please change the location name to your liking and\n"
+           "revise the altitude if not auto-detected correctly.</i>"));
     gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, BORDER/2);
     gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, BORDER/2);
@@ -1913,8 +1880,6 @@ setup_notebook_signals(xfceweather_dialog *dialog)
                      G_CALLBACK(spin_lon_value_changed), dialog);
     g_signal_connect(GTK_SPIN_BUTTON(dialog->spin_alt), "value-changed",
                      G_CALLBACK(spin_alt_value_changed), dialog);
-    g_signal_connect(GTK_SPIN_BUTTON(dialog->spin_timezone), "value-changed",
-                     G_CALLBACK(spin_timezone_value_changed), dialog);
 
     /* units page */
     g_signal_connect(dialog->combo_unit_temperature, "changed",
diff --git a/panel-plugin/weather-debug.c b/panel-plugin/weather-debug.c
index 6f0937c..95fc028 100644
--- a/panel-plugin/weather-debug.c
+++ b/panel-plugin/weather-debug.c
@@ -430,7 +430,6 @@ weather_dump_plugindata(const plugin_data *data)
                            "  latitude: %s\n"
                            "  longitude: %s\n"
                            "  msl: %d\n"
-                           "  timezone: %.1f\n"
                            "  night time: %s\n"
                            "  --------------------------------------------\n"
                            "  icon theme dir: %s\n"
@@ -464,7 +463,6 @@ weather_dump_plugindata(const plugin_data *data)
                            data->lat,
                            data->lon,
                            data->msl,
-                           data->timezone,
                            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 9b7e02d..99fca3c 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -750,13 +750,6 @@ xfceweather_read_config(XfcePanelPlugin *plugin,
     data->msl = xfce_rc_read_int_entry(rc, "msl", 0);
     constrain_to_limits(&data->msl, -420, 10000);
 
-    value = xfce_rc_read_entry(rc, "timezone", 0);
-    data->timezone = string_to_double(value, 0);
-    if (data->timezone < -25.0)
-        data->timezone = -25;
-    if (data->timezone > 25.0)
-        data->timezone = 25;
-
     data->cache_file_max_age =
         xfce_rc_read_int_entry(rc, "cache_file_max_age", CACHE_FILE_MAX_AGE);
 
@@ -867,10 +860,6 @@ xfceweather_write_config(XfcePanelPlugin *plugin,
 
     xfce_rc_write_int_entry(rc, "msl", data->msl);
 
-    value = double_to_string(data->timezone, "%.1f");
-    xfce_rc_write_entry(rc, "timezone", value);
-    g_free(value);
-
     xfce_rc_write_int_entry(rc, "cache_file_max_age",
                             data->cache_file_max_age);
 
@@ -966,9 +955,6 @@ write_cache_file(plugin_data *data)
     CACHE_APPEND("lon=%s\n", data->lon);
     g_string_append_printf(out, "msl=%d\n", data->msl);
     g_string_append_printf(out, "timeslices=%d\n", wd->timeslices->len);
-    value = double_to_string(data->timezone, "%.1f");
-    CACHE_APPEND("timezone=%s\n", value);
-    g_free(value);
     if (G_LIKELY(data->weather_update)) {
         value = format_date(data->weather_update->last, date_format, FALSE);
         CACHE_APPEND("last_weather_download=%s\n", value);
@@ -1072,7 +1058,7 @@ read_cache_file(plugin_data *data)
     struct tm cache_date_tm;
     gchar *file, *locname = NULL, *lat = NULL, *lon = NULL, *group = NULL;
     gchar *timestring;
-    gdouble timezone, diff;
+    gdouble diff;
     gint msl, num_timeslices, i, j;
 
     g_assert(data != NULL);
@@ -1114,12 +1100,10 @@ read_cache_file(plugin_data *data)
     }
     msl = g_key_file_get_integer(keyfile, group, "msl", err);
     if (!err)
-        timezone = g_key_file_get_double(keyfile, group, "timezone", err);
-    if (!err)
         num_timeslices = g_key_file_get_integer(keyfile, group,
                                                 "timeslices", err);
     if (err || strcmp(lat, data->lat) || strcmp(lon, data->lon) ||
-        msl != data->msl || timezone != data->timezone || num_timeslices < 1) {
+        msl != data->msl || num_timeslices < 1) {
         CACHE_FREE_VARS();
         weather_debug("The required values are not present in the cache file "
                       "or do not match the current plugin data. Reading "


More information about the Xfce4-commits mailing list