[Xfce4-commits] <xfce4-weather-plugin:master> Handle timezone change events in config dialog.
Harald Judt
noreply at xfce.org
Tue Nov 27 16:46:19 CET 2012
Updating branch refs/heads/master
to efe7ceac96868e3b0ec6d5a4d36166ccc765fed9 (commit)
from 94759972eb2a13f9f01a81bc5454a1e78906fd61 (commit)
commit efe7ceac96868e3b0ec6d5a4d36166ccc765fed9
Author: Harald Judt <h.judt at gmx.at>
Date: Sat Nov 24 01:56:49 2012 +0100
Handle timezone change events in config dialog.
panel-plugin/weather-config.c | 15 ++++++++++++++-
panel-plugin/weather.c | 4 ++++
panel-plugin/weather.h | 1 +
3 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index d24729c..22049ca 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -594,6 +594,16 @@ 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->wd->timezone =
+ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
+}
+
+
static GtkWidget *
create_location_page(xfceweather_dialog *dialog)
{
@@ -669,8 +679,11 @@ create_location_page(xfceweather_dialog *dialog)
/* timezone */
hbox = gtk_hbox_new(FALSE, BORDER);
ADD_LABEL(_("_Timezone:"), sg_label);
- ADD_SPIN(dialog->spin_timezone, -24, 24, 1, 0, 0, sg_spin);
+ ADD_SPIN(dialog->spin_timezone, -24, 24, 1,
+ dialog->wd->timezone, 0, sg_spin);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, BORDER);
+ g_signal_connect(GTK_SPIN_BUTTON(dialog->spin_timezone), "value-changed",
+ G_CALLBACK(spin_timezone_value_changed), dialog);
/* instructions for correction of altitude and timezone */
hbox = gtk_hbox_new(FALSE, BORDER);
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index c1b8e7a..26e0d8c 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -521,6 +521,8 @@ xfceweather_read_config(XfcePanelPlugin *plugin,
data->msl = xfce_rc_read_int_entry(rc, "msl", 0);
+ data->timezone = xfce_rc_read_int_entry(rc, "timezone", 0);
+
if (data->units)
g_slice_free(units_config, data->units);
data->units = g_slice_new0(units_config);
@@ -598,6 +600,8 @@ xfceweather_write_config(XfcePanelPlugin *plugin,
xfce_rc_write_int_entry(rc, "msl", data->msl);
+ xfce_rc_write_int_entry(rc, "timezone", data->timezone);
+
xfce_rc_write_int_entry(rc, "units_temperature", data->units->temperature);
xfce_rc_write_int_entry(rc, "units_pressure", data->units->pressure);
xfce_rc_write_int_entry(rc, "units_windspeed", data->units->windspeed);
diff --git a/panel-plugin/weather.h b/panel-plugin/weather.h
index d3c15a9..f40478a 100644
--- a/panel-plugin/weather.h
+++ b/panel-plugin/weather.h
@@ -61,6 +61,7 @@ typedef struct {
gchar *lat;
gchar *lon;
gint msl;
+ gint timezone;
units_config *units;
gboolean round;
More information about the Xfce4-commits
mailing list