mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 01:33:23 +00:00
Check if multi-dive editing is actually needed
Context menu callbacks always invoke edit_multi_dive_info(-1) instead of edit_dive_info. Since -1 means "all selected", it was impossible to edit dive notes through the context menus. This commit makes the function check if multiple dives are actually selected. Signed-off-by: Mikko Rasa <tdb@tdb.fi>
This commit is contained in:
parent
c6be2404da
commit
df1f506b4e
1 changed files with 18 additions and 1 deletions
19
info.c
19
info.c
|
@ -496,6 +496,7 @@ int edit_multi_dive_info(int index)
|
|||
GtkWidget *dialog, *vbox;
|
||||
struct dive_info info;
|
||||
struct dive *master;
|
||||
gboolean multi;
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons("Dive Info",
|
||||
GTK_WINDOW(main_window),
|
||||
|
@ -508,7 +509,23 @@ int edit_multi_dive_info(int index)
|
|||
master = get_dive(index);
|
||||
if (!master)
|
||||
master = current_dive;
|
||||
dive_info_widget(vbox, master, &info, index < 0);
|
||||
|
||||
/* See if we should use multi dive mode */
|
||||
multi = FALSE;
|
||||
if (index < 0)
|
||||
{
|
||||
int i;
|
||||
struct dive *dive;
|
||||
|
||||
for (i = 0; (dive = get_dive(i)) != NULL; i++) {
|
||||
if (dive != master && dive->selected) {
|
||||
multi = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dive_info_widget(vbox, master, &info, multi);
|
||||
show_dive_equipment(master, W_IDX_SECONDARY);
|
||||
save_equipment_data(master);
|
||||
gtk_widget_show_all(dialog);
|
||||
|
|
Loading…
Add table
Reference in a new issue