summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-08-18 20:06:04 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-08-18 20:06:04 -0700
commit38f92f780ac3a9345bcb34d297ade0eadbd903ea (patch)
tree2fb11bbd6bd7278af7faff640927907b2ebd9e78 /divelist.c
parentd7ea559d8b590beda174d7d8d2d06a257e879f65 (diff)
downloadsubsurface-38f92f780ac3a9345bcb34d297ade0eadbd903ea.tar.gz
divelist: add 'Expand all' and 'Collapse all' menu items
This adds the ability to expand/collapse all the dive groupings in the divelist from the divelist right-click context menu. Should we perhaps add it to the top 'Dive' menu too? Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/divelist.c b/divelist.c
index 99f3446ce..0cb03f326 100644
--- a/divelist.c
+++ b/divelist.c
@@ -1101,6 +1101,16 @@ void edit_dive_cb(GtkWidget *menuitem, gpointer data)
edit_multi_dive_info(amount_selected, selectiontracker);
}
+static void expand_all_cb(GtkWidget *menuitem, GtkTreeView *tree_view)
+{
+ gtk_tree_view_expand_all(tree_view);
+}
+
+static void collapse_all_cb(GtkWidget *menuitem, GtkTreeView *tree_view)
+{
+ gtk_tree_view_collapse_all(tree_view);
+}
+
static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int button)
{
GtkWidget *menu, *menuitem, *image;
@@ -1119,6 +1129,12 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
g_signal_connect(menuitem, "activate", G_CALLBACK(edit_dive_cb), model);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
+ menuitem = gtk_menu_item_new_with_label("Expand all");
+ g_signal_connect(menuitem, "activate", G_CALLBACK(expand_all_cb), tree_view);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+ menuitem = gtk_menu_item_new_with_label("Collapse all");
+ g_signal_connect(menuitem, "activate", G_CALLBACK(collapse_all_cb), tree_view);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_show_all(menu);
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,