Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Treebrowser expand/collapse with spacebar

  • Loading branch information...
commit 04bf45f28c9bcffccdebdd9d7f6062e245296d11 1 parent aef9af9
Steven Blatnick authored
Showing with 17 additions and 1 deletion.
  1. +17 −1 treebrowser/src/treebrowser.c
View
18 treebrowser/src/treebrowser.c
@@ -1422,6 +1422,22 @@ on_treeview_mouseclick(GtkWidget *widget, GdkEventButton *event, GtkTreeSelectio
static gboolean
on_treeview_keypress(GtkWidget *widget, GdkEventKey *event)
{
+ if (event->keyval == GDK_space)
+ {
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ GtkTreePath *path;
+
+ if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)), &model, &iter))
+ {
+ path = gtk_tree_model_get_path(model, &iter);
+ if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(widget), path))
+ gtk_tree_view_collapse_row(GTK_TREE_VIEW(widget), path);
+ else
+ gtk_tree_view_expand_row(GTK_TREE_VIEW(widget), path, FALSE);
+ return TRUE;
+ }
+ }
if (event->keyval == GDK_BackSpace)
{
on_button_go_up();
@@ -1734,7 +1750,7 @@ create_sidebar(void)
g_signal_connect(treeview, "row-activated", G_CALLBACK(on_treeview_row_activated), NULL);
g_signal_connect(treeview, "row-collapsed", G_CALLBACK(on_treeview_row_collapsed), NULL);
g_signal_connect(treeview, "row-expanded", G_CALLBACK(on_treeview_row_expanded), NULL);
- g_signal_connect(treeview, "key-release-event", G_CALLBACK(on_treeview_keypress), NULL);
+ g_signal_connect(treeview, "key-press-event", G_CALLBACK(on_treeview_keypress), NULL);
g_signal_connect(addressbar, "activate", G_CALLBACK(on_addressbar_activate), NULL);
g_signal_connect(filter, "activate", G_CALLBACK(on_filter_activate), NULL);
Please sign in to comment.
Something went wrong with that request. Please try again.