[Commits] [SCM] claws branch, master, updated. 3.12.0-73-g9654c62

ticho at claws-mail.org ticho at claws-mail.org
Tue Sep 1 10:29:34 CEST 2015


The branch, master has been updated
       via  9654c62175c382b2502850ca8ba64f3e855fdb5d (commit)
      from  97e8253eb3ce9e16e0214a791526e623d442d20b (commit)

Summary of changes:
 src/folderview.c |   28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit 9654c62175c382b2502850ca8ba64f3e855fdb5d
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Tue Sep 1 10:28:18 2015 +0200

    Make Left and Right keys collapse and expand item under cursor if appropriate.
    
    Left key also moves cursor to parent item, if current item is
    already collapsed.

diff --git a/src/folderview.c b/src/folderview.c
index 73555ea..0845cbd 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -1996,6 +1996,7 @@ static gboolean folderview_key_pressed(GtkWidget *widget, GdkEventKey *event,
 				       FolderView *folderview)
 {
 	GtkCMCTreeNode *node;
+	FolderItem *item;
 
 	if (!event) return FALSE;
 
@@ -2009,8 +2010,12 @@ static gboolean folderview_key_pressed(GtkWidget *widget, GdkEventKey *event,
 	case GDK_KEY_KP_Enter:
 #endif
 		if (folderview->selected) {
-			folderview_select_node(folderview,
-					       folderview->selected);
+			if (!GTK_CMCTREE_ROW(folderview->selected)->expanded)
+				gtk_cmctree_expand(GTK_CMCTREE(folderview->ctree),
+						folderview->selected);
+			else
+				folderview_select_node(folderview,
+						       folderview->selected);
 		}
 		break;
 #ifdef GENERIC_UMPC
@@ -2034,6 +2039,25 @@ static gboolean folderview_key_pressed(GtkWidget *widget, GdkEventKey *event,
 						       folderview->selected);
 		}
 		break;
+	case GDK_KEY_Left:
+		if (folderview->selected) {
+			if (GTK_CMCTREE_ROW(folderview->selected)->expanded) {
+				gtk_cmctree_collapse(GTK_CMCTREE(folderview->ctree),
+						folderview->selected);
+			} else {
+				if ((item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(folderview->ctree),
+						folderview->selected))) {
+					if ((node = gtk_cmctree_find_by_row_data(GTK_CMCTREE(folderview->ctree),
+							NULL, folder_item_parent(item)))) {
+						gtk_cmctree_select(GTK_CMCTREE(folderview->ctree), node);
+						if (!gtk_cmctree_node_is_visible(GTK_CMCTREE(folderview->ctree), node))
+							gtk_cmctree_node_moveto(GTK_CMCTREE(folderview->ctree),
+									node, -1, 0, 0);
+					}
+				}
+			}
+		}
+		break;
 	case GDK_KEY_Home:
 	case GDK_KEY_End:
 		if (event->keyval == GDK_KEY_Home)

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list