summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-01-29 21:26:07 +1100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-30 06:46:52 +1100
commit14524d8e1dcb60b58ddbd117d19298b19255d1f3 (patch)
tree944ccd0a3688e550d8f67fa716cf402f8966aa6a /divelist.c
parent8cbe2af4e950d73df5ffe35e0657e9d6ac097564 (diff)
downloadsubsurface-14524d8e1dcb60b58ddbd117d19298b19255d1f3.tar.gz
Fix cursor up/down logic
The dive selection rewrite didn't set the selected dive index, breaking the cursor key logic. Reported-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/divelist.c b/divelist.c
index b31c9ac25..440c88922 100644
--- a/divelist.c
+++ b/divelist.c
@@ -2595,11 +2595,13 @@ static void sort_column_change_cb(GtkTreeSortable *treeview, gpointer data)
}
}
-static void select_dive(struct dive *dive)
+static void select_dive(int idx)
{
+ struct dive *dive = get_dive(idx);
if (dive && !dive->selected) {
dive->selected = 1;
amount_selected++;
+ selected_dive = idx;
}
}
@@ -2624,10 +2626,10 @@ static void entry_selected(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *
/* Otherwise, consider each dive under it selected */
for_each_dive(i, dive) {
if (dive->divetrip == trip)
- select_dive(dive);
+ select_dive(i);
}
} else {
- select_dive(get_dive(idx));
+ select_dive(idx);
}
}