pidgin: 0f35cd33: Apply patch from Peter to handle the lef...

qulogic at pidgin.im qulogic at pidgin.im
Fri Jun 5 00:31:08 EDT 2009


-----------------------------------------------------------------
Revision: 0f35cd33aa18c3505d499dd84b75cce0a66f3988
Ancestor: cdbf018a5ef98397e81d541269550d9c6fded457
Author: qulogic at pidgin.im
Date: 2009-06-05T02:58:26
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/0f35cd33aa18c3505d499dd84b75cce0a66f3988

Modified files:
        ChangeLog pidgin/gtkblist.c

ChangeLog: 

Apply patch from Peter to handle the left and right arrow keys in the buddy
list to expand and contract groups or contacts, plus a few leak fixes.

Fixes #2111.

-------------- next part --------------
============================================================
--- ChangeLog	b8ef47479f9fb99a37bba98432623116677c25e3
+++ ChangeLog	711deeecd87b2a066a1efa1c5ebfd61b06507fbb
@@ -85,6 +85,8 @@ version 2.6.0 (??/??/2009):
 	* Always set unseen-count and unseen-state on conversations.
 	  (Joshua Stein)
 	* Fix a bug in 'Conversation Colors' plugin for RTL messages.
+	* Pressing the Left and Right arrow keys in the buddy list will expand and
+	  collapse buddy groups or contacts. (Peter Ruibal)
 
 	Finch:
 	* The hardware cursor is updated correctly. This will be useful
============================================================
--- pidgin/gtkblist.c	122e9ad802a1125cad575c5cea42bed04d7416f1
+++ pidgin/gtkblist.c	e2c34681dd45ab49f61db88e707aa8f991cb37dc
@@ -1611,8 +1611,9 @@ gtk_blist_key_press_cb(GtkWidget *tv, Gd
 {
 	PurpleBlistNode *node;
 	GValue val;
-	GtkTreeIter iter;
+	GtkTreeIter iter, parent;
 	GtkTreeSelection *sel;
+	GtkTreePath *path;
 
 	sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
 	if(!gtk_tree_selection_get_selected(sel, NULL, &iter))
@@ -1636,8 +1637,62 @@ gtk_blist_key_press_cb(GtkWidget *tv, Gd
 		}
 		if(buddy)
 			pidgin_retrieve_user_info(buddy->account->gc, buddy->name);
-	} else if (event->keyval == GDK_F2) {
-		gtk_blist_menu_alias_cb(tv, node);
+	} else {
+		switch (event->keyval) {
+			case GDK_F2:
+				gtk_blist_menu_alias_cb(tv, node);
+				break;
+
+			case GDK_Left:
+				path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
+				if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) {
+					/* Collapse the Group */
+					gtk_tree_view_collapse_row(GTK_TREE_VIEW(tv), path);
+					gtk_tree_path_free(path);
+					return TRUE;
+				} else {
+					/* Select the Parent */
+					if (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path)) {
+						if (gtk_tree_model_iter_parent(GTK_TREE_MODEL(gtkblist->treemodel), &parent, &iter)) {
+							gtk_tree_path_free(path);
+							path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent);
+							gtk_tree_view_set_cursor(GTK_TREE_VIEW(tv), path, NULL, FALSE);
+							gtk_tree_path_free(path);
+							return TRUE;
+						}
+					}
+				}
+				gtk_tree_path_free(path);
+				break;
+
+			case GDK_Right:
+				path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
+				if (!gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) {
+					/* Expand the Group */
+					if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
+						pidgin_blist_expand_contact_cb(NULL, node);
+						gtk_tree_path_free(path);
+						return TRUE;
+					} else if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) {
+						gtk_tree_view_expand_row(GTK_TREE_VIEW(tv), path, FALSE);
+						gtk_tree_path_free(path);
+						return TRUE;
+					}
+				} else {
+					/* Select the First Child */
+					if (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &parent, path)) {
+						if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(gtkblist->treemodel), &iter, &parent, 0)) {
+							gtk_tree_path_free(path);
+							path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
+							gtk_tree_view_set_cursor(GTK_TREE_VIEW(tv), path, NULL, FALSE);
+							gtk_tree_path_free(path);
+							return TRUE;
+						}
+					}
+				}
+				gtk_tree_path_free(path);
+				break;
+		}
 	}
 
 	return FALSE;


More information about the Commits mailing list