Branch: refs/heads/master Author: Roland Pallai rpallai@magex.hu Committer: Frank Lanitz frank@frank.uvena.de Date: Mon, 28 Oct 2013 07:14:55 UTC Commit: e0a630ef51ff284f0aba990fa55ea38576bd07ba https://github.com/geany/geany-plugins/commit/e0a630ef51ff284f0aba990fa55ea3...
Log Message: ----------- treebrowser: sensible left/right arrows
Collapse- or select parent row on left arrow, expand row on right arrow.
Modified Paths: -------------- treebrowser/src/treebrowser.c
Modified: treebrowser/src/treebrowser.c 36 files changed, 29 insertions(+), 7 deletions(-) =================================================================== @@ -1428,12 +1428,12 @@ enum static gboolean on_treeview_keypress(GtkWidget *widget, GdkEventKey *event) { + GtkTreeIter iter; + GtkTreeModel *model; + GtkTreePath *path; + 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); @@ -1451,9 +1451,6 @@ enum } if (event->keyval == GDK_Menu) { - GtkTreeIter iter; - GtkTreeModel *model; - GtkTreePath *path; gchar *name = NULL, *uri = NULL; GtkWidget *menu; @@ -1471,6 +1468,31 @@ enum return TRUE; } + if (event->keyval == GDK_Left) + { + 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 if (gtk_tree_path_get_depth(path) > 1) { + gtk_tree_path_up(path); + gtk_tree_view_set_cursor(GTK_TREE_VIEW(widget), path, NULL, FALSE); + gtk_tree_selection_select_path(gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)), path); + } + } + return TRUE; + } + if (event->keyval == GDK_Right) + { + 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_expand_row(GTK_TREE_VIEW(widget), path, FALSE); + } + return TRUE; + }
return FALSE; }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org