Mercurial > pidgin
comparison 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 |
comparison
equal
deleted
inserted
replaced
14833:2b369cd04576 | 14834:52022b0a9405 |
---|---|
1256 remove_context_menu(ggblist); | 1256 remove_context_menu(ggblist); |
1257 draw_tooltip(ggblist); | 1257 draw_tooltip(ggblist); |
1258 } | 1258 } |
1259 | 1259 |
1260 static gboolean | 1260 static gboolean |
1261 context_menu(GntWidget *widget, GGBlist *ggblist) | |
1262 { | |
1263 draw_context_menu(ggblist); | |
1264 return TRUE; | |
1265 } | |
1266 | |
1267 static gboolean | |
1261 key_pressed(GntWidget *widget, const char *text, GGBlist *ggblist) | 1268 key_pressed(GntWidget *widget, const char *text, GGBlist *ggblist) |
1262 { | 1269 { |
1263 gboolean stop = FALSE, ret = FALSE; | 1270 gboolean stop = FALSE, ret = FALSE; |
1264 if (text[0] == 27 && text[1] == 0) | 1271 if (text[0] == 27 && text[1] == 0) |
1265 { | 1272 { |
1273 { | 1280 { |
1274 ret = gnt_widget_key_pressed(ggblist->context, text); | 1281 ret = gnt_widget_key_pressed(ggblist->context, text); |
1275 stop = TRUE; | 1282 stop = TRUE; |
1276 } | 1283 } |
1277 | 1284 |
1278 if (text[0] == 27) | 1285 if (strcmp(text, GNT_KEY_CTRL_O) == 0) |
1279 { | |
1280 if (strcmp(text + 1, GNT_KEY_POPUP) == 0) | |
1281 { | |
1282 draw_context_menu(ggblist); | |
1283 stop = TRUE; | |
1284 ret = TRUE; | |
1285 } | |
1286 } | |
1287 else if (strcmp(text, GNT_KEY_CTRL_O) == 0) | |
1288 { | 1286 { |
1289 gaim_prefs_set_bool(PREF_ROOT "/showoffline", | 1287 gaim_prefs_set_bool(PREF_ROOT "/showoffline", |
1290 !gaim_prefs_get_bool(PREF_ROOT "/showoffline")); | 1288 !gaim_prefs_get_bool(PREF_ROOT "/showoffline")); |
1291 ret = TRUE; | 1289 ret = TRUE; |
1292 stop = TRUE; | 1290 stop = TRUE; |
1931 GAIM_CALLBACK(received_chat_msg), list); | 1929 GAIM_CALLBACK(received_chat_msg), list); |
1932 #endif | 1930 #endif |
1933 | 1931 |
1934 g_signal_connect(G_OBJECT(ggblist->tree), "selection_changed", G_CALLBACK(selection_changed), ggblist); | 1932 g_signal_connect(G_OBJECT(ggblist->tree), "selection_changed", G_CALLBACK(selection_changed), ggblist); |
1935 g_signal_connect(G_OBJECT(ggblist->tree), "key_pressed", G_CALLBACK(key_pressed), ggblist); | 1933 g_signal_connect(G_OBJECT(ggblist->tree), "key_pressed", G_CALLBACK(key_pressed), ggblist); |
1934 g_signal_connect(G_OBJECT(ggblist->tree), "context-menu", G_CALLBACK(context_menu), ggblist); | |
1936 g_signal_connect_after(G_OBJECT(ggblist->tree), "clicked", G_CALLBACK(blist_clicked), ggblist); | 1935 g_signal_connect_after(G_OBJECT(ggblist->tree), "clicked", G_CALLBACK(blist_clicked), ggblist); |
1937 g_signal_connect(G_OBJECT(ggblist->tree), "activate", G_CALLBACK(selection_activate), ggblist); | 1936 g_signal_connect(G_OBJECT(ggblist->tree), "activate", G_CALLBACK(selection_activate), ggblist); |
1938 g_signal_connect_data(G_OBJECT(ggblist->tree), "gained-focus", G_CALLBACK(draw_tooltip), | 1937 g_signal_connect_data(G_OBJECT(ggblist->tree), "gained-focus", G_CALLBACK(draw_tooltip), |
1939 ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); | 1938 ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); |
1940 g_signal_connect_data(G_OBJECT(ggblist->tree), "lost-focus", G_CALLBACK(remove_peripherals), | 1939 g_signal_connect_data(G_OBJECT(ggblist->tree), "lost-focus", G_CALLBACK(remove_peripherals), |