diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-17 08:23:07 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-17 08:34:45 -0700 |
commit | 831656435616edc6f2fc3bf863b1f115b2ee35fe (patch) | |
tree | 3477d6471c616f3b9ece305fd16565303eddbaae /divelist-gtk.c | |
parent | 2742d59b368e9a039f822eea5686186a27866e18 (diff) | |
download | subsurface-831656435616edc6f2fc3bf863b1f115b2ee35fe.tar.gz |
Fix yet another selection issue
If we manually deselect dives without changing Gtk's notion of what is
selected and then want to simply recreate the dive list, Gtk re-selects
the unselected dives in the process of clearing out the dive list. How
very strange.
Also, after making changes to the selection we need to make sure that we
update the stats.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist-gtk.c')
-rw-r--r-- | divelist-gtk.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/divelist-gtk.c b/divelist-gtk.c index 3f96193c5..1a47feb51 100644 --- a/divelist-gtk.c +++ b/divelist-gtk.c @@ -56,6 +56,7 @@ static struct DiveList dive_list; #define LISTSTORE(_dl) GTK_TREE_STORE((_dl).listmodel) short autogroup = FALSE; +static gboolean ignore_selection_changes = FALSE; static gboolean in_set_cursor = FALSE; static gboolean set_selected(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data); @@ -780,8 +781,10 @@ static void restore_tree_state(void); void dive_list_update_dives(void) { dive_table.preexisting = dive_table.nr; + ignore_selection_changes = TRUE; gtk_tree_store_clear(TREESTORE(dive_list)); gtk_tree_store_clear(LISTSTORE(dive_list)); + ignore_selection_changes = FALSE; fill_dive_list(); restore_tree_state(); repaint_dive(); @@ -2056,6 +2059,9 @@ static void selection_cb(GtkTreeSelection *selection, GtkTreeModel *model) int i, fixup; struct dive *dive; + if (ignore_selection_changes) + return; + gtk_tree_selection_selected_foreach(selection, entry_selected, model); /* |