From 0d2903f1c4768052f0670ae65d7ce1dada515cf9 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Fri, 11 Mar 2011 13:01:23 +0000 Subject: [PATCH] datetime: Change combobox when map is clicked https://bugzilla.redhat.com/show_bug.cgi?id=684072 --- panels/datetime/cc-datetime-panel.c | 39 ++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c index 327036148..ce82778dd 100644 --- a/panels/datetime/cc-datetime-panel.c +++ b/panels/datetime/cc-datetime-panel.c @@ -338,18 +338,6 @@ change_date (CcDateTimePanel *self) queue_set_datetime (self); } -static void -location_changed_cb (CcTimezoneMap *map, - TzLocation *location, - CcDateTimePanel *self) -{ - g_debug ("location changed"); - - self->priv->current_location = location; - - queue_set_timezone (self); -} - static void region_changed_cb (GtkComboBox *box, CcDateTimePanel *self) @@ -454,6 +442,33 @@ update_timezone (CcDateTimePanel *self) g_strfreev (split); } +static void +location_changed_cb (CcTimezoneMap *map, + TzLocation *location, + CcDateTimePanel *self) +{ + CcDateTimePanelPrivate *priv = self->priv; + GtkWidget *region_combo, *city_combo; + + g_debug ("location changed to %s/%s", location->country, location->zone); + + self->priv->current_location = location; + + /* Update the combo boxes */ + region_combo = W("region_combobox"); + city_combo = W("city_combobox"); + + g_signal_handlers_block_by_func (region_combo, region_changed_cb, self); + g_signal_handlers_block_by_func (city_combo, city_changed_cb, self); + + update_timezone (self); + + g_signal_handlers_unblock_by_func (region_combo, region_changed_cb, self); + g_signal_handlers_unblock_by_func (city_combo, city_changed_cb, self); + + queue_set_timezone (self); +} + static void get_timezone_cb (CcDateTimePanel *self, const gchar *timezone,