diff console/gntblist.c @ 14834:52022b0a9405

[gaim-migrate @ 17601] Add another action "context-menu" for all widgets. This will allow to popup the context-menu for adding buddies. etc. in the buddylist with some custom binding for keyboards that don't have the menu-key (like the one at my work). committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 28 Oct 2006 15:22:30 +0000
parents b15c2eaeb67f
children 97977138cf29
line wrap: on
line diff
--- a/console/gntblist.c	Sat Oct 28 14:24:10 2006 +0000
+++ b/console/gntblist.c	Sat Oct 28 15:22:30 2006 +0000
@@ -1258,6 +1258,13 @@
 }
 
 static gboolean
+context_menu(GntWidget *widget, GGBlist *ggblist)
+{
+	draw_context_menu(ggblist);
+	return TRUE;
+}
+
+static gboolean
 key_pressed(GntWidget *widget, const char *text, GGBlist *ggblist)
 {
 	gboolean stop = FALSE, ret = FALSE;
@@ -1275,16 +1282,7 @@
 		stop = TRUE;
 	}
 
-	if (text[0] == 27)
-	{
-		if (strcmp(text + 1, GNT_KEY_POPUP) == 0)
-		{
-			draw_context_menu(ggblist);
-			stop = TRUE;
-			ret = TRUE;
-		}
-	}
-	else if (strcmp(text, GNT_KEY_CTRL_O) == 0)
+	if (strcmp(text, GNT_KEY_CTRL_O) == 0)
 	{
 		gaim_prefs_set_bool(PREF_ROOT "/showoffline",
 				!gaim_prefs_get_bool(PREF_ROOT "/showoffline"));
@@ -1933,6 +1931,7 @@
 
 	g_signal_connect(G_OBJECT(ggblist->tree), "selection_changed", G_CALLBACK(selection_changed), ggblist);
 	g_signal_connect(G_OBJECT(ggblist->tree), "key_pressed", G_CALLBACK(key_pressed), ggblist);
+	g_signal_connect(G_OBJECT(ggblist->tree), "context-menu", G_CALLBACK(context_menu), ggblist);
 	g_signal_connect_after(G_OBJECT(ggblist->tree), "clicked", G_CALLBACK(blist_clicked), ggblist);
 	g_signal_connect(G_OBJECT(ggblist->tree), "activate", G_CALLBACK(selection_activate), ggblist);
 	g_signal_connect_data(G_OBJECT(ggblist->tree), "gained-focus", G_CALLBACK(draw_tooltip),