Mercurial > pidgin
comparison finch/gntblist.c @ 32716:4f8626d4ef63
propagate from branch 'im.pidgin.pidgin' (head deb06ab6aa118efb674f1a8434ff529e67b28809)
to branch 'im.pidgin.cpw.qulogic.gtk3' (head 34c3103eabae4a4c23439048d383f73c94dfd23e)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Thu, 23 Feb 2012 08:13:23 +0000 |
parents | f5e193735392 |
children |
comparison
equal
deleted
inserted
replaced
32715:4ae0c82b158d | 32716:4f8626d4ef63 |
---|---|
48 #include "gntline.h" | 48 #include "gntline.h" |
49 #include "gntlog.h" | 49 #include "gntlog.h" |
50 #include "gntmenu.h" | 50 #include "gntmenu.h" |
51 #include "gntmenuitem.h" | 51 #include "gntmenuitem.h" |
52 #include "gntmenuitemcheck.h" | 52 #include "gntmenuitemcheck.h" |
53 #include "gntmenuutil.h" | |
53 #include "gntpounce.h" | 54 #include "gntpounce.h" |
54 #include "gntstyle.h" | 55 #include "gntstyle.h" |
55 #include "gnttree.h" | 56 #include "gnttree.h" |
56 #include "gntutils.h" | 57 #include "gntutils.h" |
57 #include "gntwindow.h" | 58 #include "gntwindow.h" |
1070 join_chat((PurpleChat*)node); | 1071 join_chat((PurpleChat*)node); |
1071 } | 1072 } |
1072 } | 1073 } |
1073 | 1074 |
1074 static void | 1075 static void |
1075 context_menu_callback(GntMenuItem *item, gpointer data) | |
1076 { | |
1077 PurpleMenuAction *action = data; | |
1078 PurpleBlistNode *node = ggblist->cnode; | |
1079 if (action) { | |
1080 void (*callback)(PurpleBlistNode *, gpointer); | |
1081 callback = (void (*)(PurpleBlistNode *, gpointer)) | |
1082 purple_menu_action_get_callback(action); | |
1083 if (callback) | |
1084 callback(node, purple_menu_action_get_data(action)); | |
1085 else | |
1086 return; | |
1087 } | |
1088 } | |
1089 | |
1090 static void | |
1091 gnt_append_menu_action(GntMenu *menu, PurpleMenuAction *action, gpointer parent) | |
1092 { | |
1093 GList *list; | |
1094 GntMenuItem *item; | |
1095 | |
1096 if (action == NULL) | |
1097 return; | |
1098 | |
1099 item = gnt_menuitem_new(purple_menu_action_get_label(action)); | |
1100 if (purple_menu_action_get_callback(action)) | |
1101 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), context_menu_callback, action); | |
1102 gnt_menu_add_item(menu, GNT_MENU_ITEM(item)); | |
1103 | |
1104 list = purple_menu_action_get_children(action); | |
1105 | |
1106 if (list) { | |
1107 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); | |
1108 gnt_menuitem_set_submenu(item, GNT_MENU(sub)); | |
1109 for (; list; list = list->next) | |
1110 gnt_append_menu_action(GNT_MENU(sub), list->data, action); | |
1111 } | |
1112 } | |
1113 | |
1114 static void | |
1115 append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node) | 1076 append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node) |
1116 { | 1077 { |
1117 GList *list; | 1078 GList *list; |
1118 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); | 1079 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
1119 | 1080 |
1125 { | 1086 { |
1126 PurpleMenuAction *act = (PurpleMenuAction *) list->data; | 1087 PurpleMenuAction *act = (PurpleMenuAction *) list->data; |
1127 if (!act) | 1088 if (!act) |
1128 continue; | 1089 continue; |
1129 purple_menu_action_set_data(act, node); | 1090 purple_menu_action_set_data(act, node); |
1130 gnt_append_menu_action(menu, act, NULL); | 1091 gnt_append_menu_action(menu, act, node); |
1131 g_signal_connect_swapped(G_OBJECT(menu), "destroy", | |
1132 G_CALLBACK(purple_menu_action_free), act); | |
1133 } | 1092 } |
1134 } | 1093 } |
1135 | 1094 |
1136 static void | 1095 static void |
1137 add_custom_action(GntMenu *menu, const char *label, PurpleCallback callback, | 1096 add_custom_action(GntMenu *menu, const char *label, PurpleCallback callback, |
1138 gpointer data) | 1097 gpointer data) |
1139 { | 1098 { |
1140 PurpleMenuAction *action = purple_menu_action_new(label, callback, data, NULL); | 1099 PurpleMenuAction *action = purple_menu_action_new(label, callback, data, NULL); |
1141 gnt_append_menu_action(menu, action, NULL); | 1100 gnt_append_menu_action(menu, action, NULL); |
1142 g_signal_connect_swapped(G_OBJECT(menu), "destroy", | |
1143 G_CALLBACK(purple_menu_action_free), action); | |
1144 } | 1101 } |
1145 | 1102 |
1146 static void | 1103 static void |
1147 chat_components_edit_ok(PurpleChat *chat, PurpleRequestFields *allfields) | 1104 chat_components_edit_ok(PurpleChat *chat, PurpleRequestFields *allfields) |
1148 { | 1105 { |
1377 GList *iter; | 1334 GList *iter; |
1378 | 1335 |
1379 for (iter = purple_blist_node_get_extended_menu(node); | 1336 for (iter = purple_blist_node_get_extended_menu(node); |
1380 iter; iter = g_list_delete_link(iter, iter)) | 1337 iter; iter = g_list_delete_link(iter, iter)) |
1381 { | 1338 { |
1382 gnt_append_menu_action(menu, iter->data, NULL); | 1339 gnt_append_menu_action(menu, iter->data, node); |
1383 g_signal_connect_swapped(G_OBJECT(menu), "destroy", | |
1384 G_CALLBACK(purple_menu_action_free), iter->data); | |
1385 } | 1340 } |
1386 } | 1341 } |
1387 | 1342 |
1388 /* Xerox'd from gtkdialogs.c:purple_gtkdialogs_remove_contact_cb */ | 1343 /* Xerox'd from gtkdialogs.c:purple_gtkdialogs_remove_contact_cb */ |
1389 static void | 1344 static void |