[Xfce4-commits] <xfce4-weather-plugin:master> Initialize units combo boxes with current plugin data.
Harald Judt
noreply at xfce.org
Tue Nov 27 16:46:11 CET 2012
Updating branch refs/heads/master
to eb682f84044aaba3c78ed0dfc2ba98fcddb16fbb (commit)
from b0190ba92c70d3a45a82e96e535426214f2e1d57 (commit)
commit eb682f84044aaba3c78ed0dfc2ba98fcddb16fbb
Author: Harald Judt <h.judt at gmx.at>
Date: Fri Nov 23 11:47:02 2012 +0100
Initialize units combo boxes with current plugin data.
panel-plugin/weather-config.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index 64067c7..10e18ff 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -66,6 +66,9 @@
#define ADD_COMBO_VALUE(combo, text) \
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), text);
+#define SET_COMBO_VALUE(combo, val) \
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo), val);
+
#define ADD_LABEL_EDIT_BUTTON(button, text, icon, cb_func) \
button = gtk_button_new_with_mnemonic(text); \
image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON); \
@@ -284,6 +287,17 @@ sanitize_location_name(const gchar *location_name)
}
+static void
+setup_units(xfceweather_dialog *dialog,
+ units_config *units)
+{
+ SET_COMBO_VALUE(dialog->combo_unit_temperature, units->temperature);
+ SET_COMBO_VALUE(dialog->combo_unit_pressure, units->pressure);
+ SET_COMBO_VALUE(dialog->combo_unit_windspeed, units->windspeed);
+ SET_COMBO_VALUE(dialog->combo_unit_precipitations, units->precipitations);
+ SET_COMBO_VALUE(dialog->combo_unit_altitude, units->altitude);
+}
+
void
apply_options(xfceweather_dialog *dialog)
{
@@ -661,6 +675,10 @@ create_units_page(xfceweather_dialog *dialog)
_("Feet (ft)"));
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, BORDER);
+ /* initialize widgets with current data */
+ if (dialog->wd)
+ setup_units(dialog, dialog->wd->units);
+
gtk_box_pack_start(GTK_BOX(page), vbox, FALSE, FALSE, 0);
g_object_unref(G_OBJECT(sg_label));
return palign;
More information about the Xfce4-commits
mailing list