aboutsummaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-17 08:23:07 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-17 08:34:45 -0700
commit831656435616edc6f2fc3bf863b1f115b2ee35fe (patch)
tree3477d6471c616f3b9ece305fd16565303eddbaae /gtk-gui.c
parent2742d59b368e9a039f822eea5686186a27866e18 (diff)
downloadsubsurface-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 'gtk-gui.c')
-rw-r--r--gtk-gui.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 04f31a9cb..be985a85a 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -1035,12 +1035,8 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
* invalid dives that were selected before hiding them */
if (oldprefs.display_invalid_dives && !prefs.display_invalid_dives) {
for_each_dive(j, d)
- if (d->selected && d->dive_tags && DTAG_INVALID) {
- d->selected = 0;
- amount_selected--;
- }
- if (amount_selected == 0)
- selected_dive = -1;
+ if (d->selected && d->dive_tags && DTAG_INVALID)
+ deselect_dive(j);
}
prefs.divelist_font = strdup(gtk_font_button_get_font_name(GTK_FONT_BUTTON(font)));
set_divelist_font(prefs.divelist_font);
@@ -1160,16 +1156,13 @@ static void selecttags_dialog(GtkWidget *w, gpointer data)
dive_mask |= (1 << i);
/* deselect dives filtered by tags before hiding */
- for_each_dive(i, d) {
- if (d->selected && (d->dive_tags & dive_mask) != dive_mask) {
- d->selected = 0;
- amount_selected--;
- }
- }
- if (amount_selected == 0)
- selected_dive = -1;
+ for_each_dive(i, d)
+ if (d->selected && (d->dive_tags & dive_mask) != dive_mask)
+ deselect_dive(i);
dive_list_update_dives();
+ process_selected_dives();
+ show_dive_stats(current_dive);
} else {
/* restore tags selection from dive_mask */
for (i = 0; i < DTAG_NR; i++) {