mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add trip above adds all consecutive selected dives to the new trip
Before this commit we had the odd behavior that if we right clicked in the middle of a group of selected dives, the trip was added above the dive we clicked on, not above the group. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
14856aab4b
commit
856e10ddb2
1 changed files with 15 additions and 0 deletions
15
divelist.c
15
divelist.c
|
@ -1632,6 +1632,21 @@ static void insert_trip_before_cb(GtkWidget *menuitem, GtkTreePath *path)
|
|||
GtkTreePath *next_path;
|
||||
|
||||
dive = dive_from_path(path);
|
||||
if (dive->selected) {
|
||||
next_path = gtk_tree_path_copy(path);
|
||||
for (;;) {
|
||||
/* let's find the first dive in a block of selected dives */
|
||||
if (gtk_tree_path_prev(next_path)) {
|
||||
next_dive = dive_from_path(next_path);
|
||||
if (next_dive && next_dive->selected) {
|
||||
path = gtk_tree_path_copy(next_path);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* now path points at the first selected dive in a consecutive block */
|
||||
turn_dive_into_trip(path);
|
||||
/* if the dive was selected and the next dive was selected, too,
|
||||
* then all of them should be part of the new trip */
|
||||
|
|
Loading…
Add table
Reference in a new issue