[Commits] [SCM] claws branch, master, updated. 3.14.1-62-g5305715

ticho at claws-mail.org ticho at claws-mail.org
Mon Dec 19 21:31:39 CET 2016


The branch, master has been updated
       via  53057151deb0b63df65fa570df40407effc814c0 (commit)
      from  5a66116ee95c1ceae362074be6cc286a6c70ecc3 (commit)

Summary of changes:
 src/foldersel.c |   32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)


- Log -----------------------------------------------------------------
commit 53057151deb0b63df65fa570df40407effc814c0
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Mon Dec 19 21:30:45 2016 +0100

    Use left/right keys to collapse/expand rows in foldersel dialog.
    
    Further keypress will move the cursor to parent
    or first child, respectively.

diff --git a/src/foldersel.c b/src/foldersel.c
index 8d8295b..5470906 100644
--- a/src/foldersel.c
+++ b/src/foldersel.c
@@ -655,8 +655,38 @@ static gint delete_event(GtkWidget *widget, GdkEventAny *event, gpointer data)
 
 static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
 {
-	if (event && event->keyval == GDK_KEY_Escape)
+	if (!event)
+		return FALSE;
+
+	if (event->keyval == GDK_KEY_Escape)
 		foldersel_cancel(NULL, NULL);
+
+	GtkTreePath *path = NULL;
+	gtk_tree_view_get_cursor(GTK_TREE_VIEW(treeview), &path, NULL);
+	if (path == NULL)
+		return FALSE;
+
+	switch (event->keyval) {
+		case GDK_KEY_Left:
+			if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(treeview), path)) {
+				gtk_tree_view_collapse_row(GTK_TREE_VIEW(treeview), path);
+			} else {
+				gtk_tree_path_up(path);
+				gtk_tree_view_set_cursor(GTK_TREE_VIEW(treeview), path, NULL, FALSE);
+			}
+			break;
+		case GDK_KEY_Right:
+			if (!gtk_tree_view_row_expanded(GTK_TREE_VIEW(treeview), path)) {
+				gtk_tree_view_expand_row(GTK_TREE_VIEW(treeview), path, FALSE);
+			} else {
+				gtk_tree_path_down(path);
+				gtk_tree_view_set_cursor(GTK_TREE_VIEW(treeview), path, NULL, FALSE);
+			}
+			break;
+	}
+
+	gtk_tree_path_free(path);
+
 	return FALSE;
 }
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list