Mercurial > pidgin
comparison src/gtkblist.c @ 10662:54ac161a876e
[gaim-migrate @ 12199]
Plugins can now add submenus to the right-click menu of a blist node by passing a GList of actions to gaim_blist_node_action_new. I'm thinking about making GaimBlistNodeActions more like plugin prefs so that plugins can create radio and check menu items as well. We'll see if I can do that and not make it ugly/suck.
committer: Tailor Script <tailor@pidgin.im>
author | Etan Reisner <pidgin@unreliablesource.net> |
---|---|
date | Mon, 07 Mar 2005 02:19:09 +0000 |
parents | 868aafbe859b |
children | 241d2e62bed2 |
comparison
equal
deleted
inserted
replaced
10661:f02873d475dc | 10662:54ac161a876e |
---|---|
1075 act->callback(node, act->data); | 1075 act->callback(node, act->data); |
1076 } | 1076 } |
1077 | 1077 |
1078 | 1078 |
1079 static void | 1079 static void |
1080 append_blist_node_action (GtkWidget *menu, GaimBlistNodeAction *act, | 1080 append_blist_node_action(GtkWidget *menu, GaimBlistNodeAction *act, |
1081 GaimBlistNode *node, gboolean *dup_separator) | 1081 GaimBlistNode *node, gboolean *dup_separator) |
1082 { | 1082 { |
1083 if(act == NULL) { | 1083 if(act == NULL) { |
1084 if(! *dup_separator) { | 1084 if(! *dup_separator) { |
1085 gaim_separator(menu); | 1085 gaim_separator(menu); |
1086 *dup_separator = TRUE; | 1086 *dup_separator = TRUE; |
1087 } | 1087 } |
1088 } else { | 1088 } else { |
1089 GtkWidget *menuitem; | 1089 GtkWidget *menuitem; |
1090 | 1090 |
1091 *dup_separator = FALSE; | 1091 if (act->children == NULL) { |
1092 | 1092 *dup_separator = FALSE; |
1093 menuitem = gtk_menu_item_new_with_mnemonic(act->label); | 1093 |
1094 g_object_set_data(G_OBJECT(menuitem), "gaimcallback", act); | 1094 menuitem = gtk_menu_item_new_with_mnemonic(act->label); |
1095 g_signal_connect(G_OBJECT(menuitem), "activate", | 1095 g_object_set_data(G_OBJECT(menuitem), "gaimcallback", |
1096 G_CALLBACK(blist_node_menu_cb), node); | 1096 act); |
1097 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | 1097 g_signal_connect(G_OBJECT(menuitem), "activate", |
1098 G_CALLBACK(blist_node_menu_cb), node); | |
1099 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
1100 } else { | |
1101 GtkWidget *submenu = NULL; | |
1102 GList *l = NULL; | |
1103 | |
1104 menuitem = gtk_menu_item_new_with_mnemonic(act->label); | |
1105 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
1106 | |
1107 submenu = gtk_menu_new(); | |
1108 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); | |
1109 | |
1110 for (l = act->children; l; l = l->next) { | |
1111 GaimBlistNodeAction *act = (GaimBlistNodeAction *) l->data; | |
1112 | |
1113 append_blist_node_action(submenu, act, node, dup_separator); | |
1114 | |
1115 g_list_free(act->children); | |
1116 act->children = NULL; | |
1117 } | |
1118 } | |
1098 } | 1119 } |
1099 } | 1120 } |
1100 | 1121 |
1101 | 1122 |
1102 void | 1123 void |
1103 gaim_gtk_append_blist_node_proto_menu (GtkWidget *menu, GaimConnection *gc, GaimBlistNode *node) | 1124 gaim_gtk_append_blist_node_proto_menu(GtkWidget *menu, GaimConnection *gc, |
1125 GaimBlistNode *node) | |
1104 { | 1126 { |
1105 GList *l, *ll; | 1127 GList *l, *ll; |
1106 gboolean dup_separator = FALSE; | 1128 gboolean dup_separator = FALSE; |
1107 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | 1129 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
1108 | 1130 |