changeset 26968:1788bc69ba7b

A patch from nops to add a "Select Buddy Icon" (my term, the original patch used "Choose") option to the right-click menu of the buddy list's buddy icon selector. This is nice from an intuitiveness and HIG-compliance stance. Fixes #8775
author Richard Laager <rlaager@wiktel.com>
date Sat, 16 May 2009 20:07:59 +0000
parents 8290e36a5a73
children e1c2fe5b1026
files pidgin/gtkstatusbox.c
diffstat 1 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkstatusbox.c	Sat May 16 19:58:40 2009 +0000
+++ b/pidgin/gtkstatusbox.c	Sat May 16 20:07:59 2009 +0000
@@ -93,6 +93,7 @@
 static void do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift);
 static void icon_choose_cb(const char *filename, gpointer data);
 static void remove_buddy_icon_cb(GtkWidget *w, PidginStatusBox *box);
+static void choose_buddy_icon_cb(GtkWidget *w, PidginStatusBox *box);
 
 enum {
 	/** A PidginStatusBoxItemType */
@@ -317,6 +318,10 @@
 
 		box->icon_box_menu = gtk_menu_new();
 
+		menu_item = pidgin_new_item_from_stock(box->icon_box_menu, _("Select Buddy Icon"), NULL,
+						     G_CALLBACK(choose_buddy_icon_cb),
+						     box, 0, 0, NULL);
+
 		menu_item = pidgin_new_item_from_stock(box->icon_box_menu, _("Remove"), GTK_STOCK_REMOVE,
 						     G_CALLBACK(remove_buddy_icon_cb),
 						     box, 0, 0, NULL);
@@ -327,13 +332,7 @@
 			       event->button, event->time);
 
 	} else {
-		if (box->buddy_icon_sel) {
-			gtk_window_present(GTK_WINDOW(box->buddy_icon_sel));
-			return FALSE;
-		}
-
-		box->buddy_icon_sel = pidgin_buddy_icon_chooser_new(GTK_WINDOW(gtk_widget_get_toplevel(widget)), icon_choose_cb, box);
-		gtk_widget_show_all(box->buddy_icon_sel);
+		choose_buddy_icon_cb(widget, box);
 	}
 	return FALSE;
 }
@@ -1529,6 +1528,17 @@
 }
 
 static void
+choose_buddy_icon_cb(GtkWidget *w, PidginStatusBox *box)
+{
+	if (box->buddy_icon_sel) {
+		gtk_window_present(GTK_WINDOW(box->buddy_icon_sel));
+	} else {
+		box->buddy_icon_sel = pidgin_buddy_icon_chooser_new(GTK_WINDOW(gtk_widget_get_toplevel(w)), icon_choose_cb, box);
+		gtk_widget_show_all(box->buddy_icon_sel);
+	}
+}
+
+static void
 icon_choose_cb(const char *filename, gpointer data)
 {
 	PidginStatusBox *box = data;