diff options
author | Michael Terry <mike@mterry.name> | 2011-02-24 11:01:03 -0500 |
---|---|---|
committer | Michael Terry <mike@mterry.name> | 2011-02-24 11:01:03 -0500 |
commit | 671bcdaf530e6723c2208bb98ae9cae1b1dc23c8 (patch) | |
tree | dd850a1ed94b9ee723eb587400b3d68c04fa1d95 | |
parent | e1ed5129d99c0b7d6f8829a146173b940ce8890d (diff) | |
download | ayatana-indicator-datetime-671bcdaf530e6723c2208bb98ae9cae1b1dc23c8.tar.gz ayatana-indicator-datetime-671bcdaf530e6723c2208bb98ae9cae1b1dc23c8.tar.bz2 ayatana-indicator-datetime-671bcdaf530e6723c2208bb98ae9cae1b1dc23c8.zip |
don't update locations dialog's times when editing
-rw-r--r-- | src/datetime-prefs-locations.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/datetime-prefs-locations.c b/src/datetime-prefs-locations.c index ce3acaa..0c9a93c 100644 --- a/src/datetime-prefs-locations.c +++ b/src/datetime-prefs-locations.c @@ -152,9 +152,17 @@ handle_edit_started (GtkCellRendererText * renderer, GtkCellEditable * editable, } static gboolean -update_times (GtkListStore * store) +update_times (TimezoneCompletion * completion) { /* For each entry, check zone in column 2 and set column 1 to it's time */ + GtkListStore * store = GTK_LIST_STORE (g_object_get_data (G_OBJECT (completion), "store")); + GObject * cell = G_OBJECT (g_object_get_data (G_OBJECT (completion), "name-cell")); + + gboolean editing; + g_object_get (cell, "editing", &editing, NULL); + if (editing) { /* No updates while editing, it cancels the edit */ + return TRUE; + } GDateTime * now = g_date_time_new_now_local (); @@ -299,6 +307,7 @@ datetime_setup_locations_dialog (GtkWindow * parent, CcTimezoneMap * map) "text", 0, NULL); GtkTreeViewColumn * loc_col = gtk_tree_view_get_column (GTK_TREE_VIEW (tree), 0); gtk_tree_view_column_set_expand (loc_col, TRUE); + g_object_set_data (G_OBJECT (completion), "name-cell", cell); cell = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1, @@ -315,8 +324,8 @@ datetime_setup_locations_dialog (GtkWindow * parent, CcTimezoneMap * map) fill_from_settings (store, conf); - guint time_id = g_timeout_add_seconds (2, (GSourceFunc)update_times, store); - update_times (GTK_LIST_STORE (store)); + guint time_id = g_timeout_add_seconds (2, (GSourceFunc)update_times, completion); + update_times (completion); g_object_set_data_full (G_OBJECT (dlg), "conf", g_object_ref (conf), g_object_unref); g_object_set_data_full (G_OBJECT (dlg), "completion", completion, g_object_unref); |