[gnome-control-center] datetime: Fix city combobox filtering



commit 570c97ab266a5ab30af464ca499f93239035ff55
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Feb 8 23:13:08 2011 +0000

    datetime: Fix city combobox filtering
    
    The city combo box's filter was never refiltered after setting
    the original timezone, so we always got the whole list of cities.

 panels/datetime/cc-datetime-panel.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index ce3ba39..63f8723 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -436,6 +436,7 @@ update_timezone (CcDateTimePanel *self)
   widget = (GtkWidget *) gtk_builder_get_object (priv->builder,
                                                  "city_combobox");
   model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
+  gtk_tree_model_filter_refilter ((GtkTreeModelFilter *) gtk_builder_get_object (priv->builder, "city-modelfilter"));
   gtk_tree_model_get_iter_first (model, &iter);
 
   do
@@ -562,9 +563,10 @@ city_model_filter_func (GtkTreeModel *model,
   gchar *city_region = NULL;
   gboolean result;
 
+  if (gtk_combo_box_get_active_iter (combo, &combo_iter) == FALSE)
+    return FALSE;
 
   combo_model = gtk_combo_box_get_model (combo);
-  gtk_combo_box_get_active_iter (combo, &combo_iter);
   gtk_tree_model_get (combo_model, &combo_iter,
                       CITY_COL_CITY, &active_region, -1);
 
@@ -842,8 +844,6 @@ cc_date_time_panel_init (CcDateTimePanel *self)
 
   update_time (self);
 
-  get_system_timezone_async ((GetTimezoneFunc) get_timezone_cb, self, NULL);
-
   priv->locations = (GtkTreeModel*) gtk_builder_get_object (priv->builder,
                                                             "region-liststore");
 
@@ -864,6 +864,10 @@ cc_date_time_panel_init (CcDateTimePanel *self)
                                           widget,
                                           NULL);
 
+  /* After the initial setup, so we can be sure that
+   * the model is filled up */
+  get_system_timezone_async ((GetTimezoneFunc) get_timezone_cb, self, NULL);
+
   queue_clock_update (self);
 
   /* add the lock button */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]