diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2012-09-22 23:31:55 +0300 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2012-09-22 23:31:55 +0300 |
commit | 6458057599e6b80a8a04a29d2aa975347f69ff8c (patch) | |
tree | 140a4b4aa5e6f91b5957e2a594f4d04e211f2213 /divelist.c | |
parent | c4c636fb4ffa942f282d57556a579de311b96c43 (diff) | |
download | subsurface-6458057599e6b80a8a04a29d2aa975347f69ff8c.tar.gz |
Added different delete label when right clicking multiple drives
When clicking multiple dives in the list, check if more than one
are selected and if so show the text "Delete dives".
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'divelist.c')
-rw-r--r-- | divelist.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/divelist.c b/divelist.c index 810b5be7c..a62f259d5 100644 --- a/divelist.c +++ b/divelist.c @@ -1900,6 +1900,7 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int { GtkWidget *menu, *menuitem, *image; char editlabel[] = "Edit dives"; + char deletelabel[] = "Delete dives"; GtkTreePath *path, *prevpath, *nextpath; GtkTreeIter iter, previter, nextiter; int idx, previdx, nextidx; @@ -1946,18 +1947,26 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int g_signal_connect(menuitem, "activate", G_CALLBACK(remove_trip_cb), path); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); } else { - menuitem = gtk_menu_item_new_with_label("Delete Dive"); - g_signal_connect(menuitem, "activate", G_CALLBACK(delete_dive_cb), path); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); dive = get_dive(idx); - /* if we right click on selected dive(s), edit those */ + /* if we right click on selected dive(s), edit or delete those */ if (dive->selected) { - if (amount_selected == 1) + if (amount_selected == 1) { + deletelabel[strlen(deletelabel) - 1] = '\0'; editlabel[strlen(editlabel) - 1] = '\0'; + } + menuitem = gtk_menu_item_new_with_label(deletelabel); + g_signal_connect(menuitem, "activate", G_CALLBACK(NULL), path); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + menuitem = gtk_menu_item_new_with_label(editlabel); g_signal_connect(menuitem, "activate", G_CALLBACK(edit_selected_dives_cb), NULL); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); } else { + deletelabel[strlen(deletelabel) - 1] = '\0'; + menuitem = gtk_menu_item_new_with_label(deletelabel); + g_signal_connect(menuitem, "activate", G_CALLBACK(delete_dive_cb), path); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + editlabel[strlen(editlabel) - 1] = '\0'; menuitem = gtk_menu_item_new_with_label(editlabel); g_signal_connect(menuitem, "activate", G_CALLBACK(edit_dive_from_path_cb), path); |