Mercurial > pidgin
changeset 9051:826013efffcb
[gaim-migrate @ 9827]
" - Makes (gaim_gtk_)append_blist_node_extended_menu and
(gaim_gtk_)append_blist_node_proto_menu public so that
plugins can use them to duplicate the right-click menus
(Guifications needs this for right-clicking on the
notification)
- Adds extended menu support for Contacts
- Removes the "drawing-menu" signal (It was UI
specific, and no-one except the gevolution plugin used it)
- Updates the gevolution plugin to use the new
blist-node-extended-menu signal (I can't compile the
gevolution plugin here, so my changes should be checked
by someone who can :) )
- Updates the blist signals documentation with the new
blist-node-extended-menu signal
- Updates the signals-test.c plugin to handle
blist-node-extended-menu, wrote/writing-im/chat-msg and
fixes displayed-im/chat-msg handling" --Stu Tomlinson
this moves a string but doesn't change it.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Mon, 24 May 2004 15:17:49 +0000 |
parents | f5fd42679095 |
children | 55353425fd67 |
files | doc/blist-signals.dox plugins/gevolution/gevolution.c plugins/signals-test.c src/gtkblist.c src/gtkblist.h |
diffstat | 5 files changed, 109 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/blist-signals.dox Mon May 24 15:15:09 2004 +0000 +++ b/doc/blist-signals.dox Mon May 24 15:17:49 2004 +0000 @@ -8,6 +8,7 @@ @signal buddy-signed-on @signal buddy-signed-off @signal update-idle + @signal blist-node-extended-menu @endsignals <hr> @@ -74,5 +75,14 @@ Emitted when the buddy list is refreshed and the idle times are updated. @endsignaldef + @signaldef blist-node-extended-menu + @signalproto +void (*blist_node_extended_menu)(GaimBlistNode *node, GList **menu) + @endsignalproto + @signaldesc + Emitted when a buddlist menu is being constructed @a menu is a pointer to + a GList of GaimBlistNodeAction's allowing a plugin to add menu items + @endsignaldef + */ // vim: syntax=c tw=75 et
--- a/plugins/gevolution/gevolution.c Mon May 24 15:15:09 2004 +0000 +++ b/plugins/gevolution/gevolution.c Mon May 24 15:17:49 2004 +0000 @@ -199,23 +199,29 @@ } static void -menu_item_activate_cb(GtkWidget *item, GaimBuddy *buddy) +menu_item_activate_cb(GaimBlistNode *node) { + GaimBuddy *buddy = (GaimBuddy *)node; gevo_associate_buddy_dialog_new(buddy); } static void -drawing_menu_cb(GtkWidget *menu, GaimBuddy *buddy) +blist_node_extended_menu_cb(GaimBlistNode *node, GList **menu) { + GaimBlistNodeAction *act; + GaimBuddy *buddy; GtkWidget *item; + if (!GAIM_BLIST_NODE_IS_BUDDY(node)) + return; + + buddy = (GaimBuddy *)node; + if (gevo_prpl_is_supported(buddy->account, buddy)) { - item = gtk_menu_item_new_with_label(_("Add to Address Book")); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - - g_signal_connect(G_OBJECT(item), "activate", - G_CALLBACK(menu_item_activate_cb), buddy); + act = gaim_blist_node_action_new(_("Add to Address Book"), + menu_item_activate_cb, NULL); + *menu = g_list_append(*menu, act); } } @@ -237,8 +243,8 @@ e_book_query_unref(query); - gaim_signal_connect(GAIM_GTK_BLIST(gaim_get_blist()), "drawing-menu", - plugin, GAIM_CALLBACK(drawing_menu_cb), NULL); + gaim_signal_connect(gaim_blist_get_handle(), "blist-node-extended-menu", + plugin, GAIM_CALLBACK(blist_node_extended_menu_cb), NULL); return FALSE; }
--- a/plugins/signals-test.c Mon May 24 15:15:09 2004 +0000 +++ b/plugins/signals-test.c Mon May 24 15:17:49 2004 +0000 @@ -109,15 +109,24 @@ } static void -buddy_extended_menu_cb(GaimBuddy *buddy, void *data) +blist_node_extended_menu_cb(GaimBlistNode *node, void *data) { - gaim_debug_misc("signals test", "buddy-extended-menu (%s)\n", buddy->name); -} + GaimContact *p = (GaimContact *)node; + GaimBuddy *b = (GaimBuddy *)node; + GaimChat *c = (GaimChat *)node; + GaimGroup *g = (GaimGroup *)node; -static void -group_extended_menu_cb(GaimGroup *group, void *data) -{ - gaim_debug_misc("signals test", "group-extended-menu (%s)\n", group->name); + if (GAIM_BLIST_NODE_IS_CONTACT(node)) + gaim_debug_misc("signals test", "blist-node-extended-menu (Contact: %s)\n", p->alias); + else if (GAIM_BLIST_NODE_IS_BUDDY(node)) + gaim_debug_misc("signals test", "blist-node-extended-menu (Buddy: %s)\n", b->name); + else if (GAIM_BLIST_NODE_IS_CHAT(node)) + gaim_debug_misc("signals test", "blist-node-extended-menu (Chat: %s)\n", c->alias); + else if (GAIM_BLIST_NODE_IS_GROUP(node)) + gaim_debug_misc("signals test", "blist-node-extended-menu (Group: %s)\n", g->name); + else + gaim_debug_misc("signals test", "blist-node-extended-menu (UNKNOWN: %d)\n", node->type); + } @@ -166,12 +175,29 @@ } static void -displayed_im_msg_cb(GaimConversation *conv, const char *buffer, void *data) +displayed_im_msg_cb(GaimAccount *account, GaimConversation *conv, const char *buffer, void *data) { gaim_debug_misc("signals test", "displayed-im-msg (%s, %s)\n", gaim_conversation_get_name(conv), buffer); } +static gboolean +writing_im_msg_cb(GaimAccount *account, GaimConversation *conv, char **buffer, void *data) +{ + gaim_debug_misc("signals test", "writing-im-msg (%s, %s, %s)\n", + gaim_account_get_username(account), gaim_conversation_get_name(conv), *buffer); + + return FALSE; + +} + +static void +wrote_im_msg_cb(GaimAccount *account, GaimConversation *conv, const char *buffer, void *data) +{ + gaim_debug_misc("signals test", "wrote-im-msg (%s, %s, %s)\n", + gaim_account_get_username(account), gaim_conversation_get_name(conv), buffer); +} + static void sending_im_msg_cb(GaimAccount *account, char *recipient, char **buffer, void *data) { @@ -218,13 +244,30 @@ } static void -displayed_chat_msg_cb(GaimConversation *conv, const char *buffer, void *data) +displayed_chat_msg_cb(GaimAccount *account, GaimConversation *conv, const char *buffer, void *data) { gaim_debug_misc("signals test", "displayed-chat-msg (%s, %s)\n", gaim_conversation_get_name(conv), buffer); } static gboolean +writing_chat_msg_cb(GaimAccount *account, GaimConversation *conv, + char **buffer, void *data) +{ + gaim_debug_misc("signals test", "writing-chat-msg (%s, %s)\n", + gaim_conversation_get_name(conv), *buffer); + + return FALSE; +} + +static void +wrote_chat_msg_cb(GaimAccount *account, GaimConversation *conv, const char *buffer, void *data) +{ + gaim_debug_misc("signals test", "wrote-chat-msg (%s, %s)\n", + gaim_conversation_get_name(conv), buffer); +} + +static gboolean sending_chat_msg_cb(GaimAccount *account, char **buffer, int id, void *data) { gaim_debug_misc("signals test", "sending-chat-msg (%s, %s, %d)\n", @@ -416,10 +459,8 @@ plugin, GAIM_CALLBACK(buddy_signed_on_cb), NULL); gaim_signal_connect(blist_handle, "buddy-signed-off", plugin, GAIM_CALLBACK(buddy_signed_off_cb), NULL); - gaim_signal_connect(blist_handle, "buddy-extended-menu", - plugin, GAIM_CALLBACK(buddy_extended_menu_cb), NULL); - gaim_signal_connect(blist_handle, "group-extended-menu", - plugin, GAIM_CALLBACK(group_extended_menu_cb), NULL); + gaim_signal_connect(blist_handle, "blist-node-extended-menu", + plugin, GAIM_CALLBACK(blist_node_extended_menu_cb), NULL); /* Connection subsystem signals */ gaim_signal_connect(conn_handle, "signing-on", @@ -436,6 +477,10 @@ plugin, GAIM_CALLBACK(displaying_im_msg_cb), NULL); gaim_signal_connect(conv_handle, "displayed-im-msg", plugin, GAIM_CALLBACK(displayed_im_msg_cb), NULL); + gaim_signal_connect(conv_handle, "writing-im-msg", + plugin, GAIM_CALLBACK(writing_im_msg_cb), NULL); + gaim_signal_connect(conv_handle, "wrote-im-msg", + plugin, GAIM_CALLBACK(wrote_im_msg_cb), NULL); gaim_signal_connect(conv_handle, "sending-im-msg", plugin, GAIM_CALLBACK(sending_im_msg_cb), NULL); gaim_signal_connect(conv_handle, "sent-im-msg", @@ -448,6 +493,10 @@ plugin, GAIM_CALLBACK(displaying_chat_msg_cb), NULL); gaim_signal_connect(conv_handle, "displayed-chat-msg", plugin, GAIM_CALLBACK(displayed_chat_msg_cb), NULL); + gaim_signal_connect(conv_handle, "writing-chat-msg", + plugin, GAIM_CALLBACK(writing_chat_msg_cb), NULL); + gaim_signal_connect(conv_handle, "wrote-chat-msg", + plugin, GAIM_CALLBACK(wrote_chat_msg_cb), NULL); gaim_signal_connect(conv_handle, "sending-chat-msg", plugin, GAIM_CALLBACK(sending_chat_msg_cb), NULL); gaim_signal_connect(conv_handle, "sent-chat-msg",
--- a/src/gtkblist.c Mon May 24 15:15:09 2004 +0000 +++ b/src/gtkblist.c Mon May 24 15:17:49 2004 +0000 @@ -1094,8 +1094,8 @@ } -static void -append_blist_node_proto_menu (GtkWidget *menu, GaimConnection *gc, GaimBlistNode *node) +void +gaim_gtk_append_blist_node_proto_menu (GtkWidget *menu, GaimConnection *gc, GaimBlistNode *node) { GList *l, *ll; gboolean dup_separator = FALSE; @@ -1112,8 +1112,8 @@ } -static void -append_blist_node_extended_menu (GtkWidget *menu, GaimBlistNode *node) +void +gaim_gtk_append_blist_node_extended_menu (GtkWidget *menu, GaimBlistNode *node) { GList *l, *ll; gboolean dup_separator = FALSE; @@ -1139,11 +1139,8 @@ gaim_new_item_from_stock(menu, _("View _Log"), NULL, G_CALLBACK(gtk_blist_menu_showlog_cb), b, 0, 0, NULL); - append_blist_node_proto_menu(menu, b->account->gc, (GaimBlistNode *) b); - append_blist_node_extended_menu(menu, (GaimBlistNode *) b); - - /* moving on to the old ui-specific plugin menus */ - gaim_signal_emit(gaim_gtk_blist_get_handle(), "drawing-menu", menu, b); + gaim_gtk_append_blist_node_proto_menu(menu, b->account->gc, (GaimBlistNode *) b); + gaim_gtk_append_blist_node_extended_menu(menu, (GaimBlistNode *) b); gaim_separator(menu); @@ -1204,7 +1201,7 @@ gaim_new_item_from_stock(menu, _("_Rename"), NULL, G_CALLBACK(show_rename_group), node, 0, 0, NULL); - append_blist_node_extended_menu(menu, node); + gaim_gtk_append_blist_node_extended_menu(menu, node); return menu; } @@ -1228,11 +1225,8 @@ gaim_new_check_item(menu, _("Auto-Join"), G_CALLBACK(gtk_blist_menu_autojoin_cb), node, autojoin); - append_blist_node_proto_menu(menu, c->account->gc, node); - append_blist_node_extended_menu(menu, node); - - /* moving on to the old ui-specific plugin menus */ - gaim_signal_emit(gaim_gtk_blist_get_handle(), "drawing-menu", menu, c); + gaim_gtk_append_blist_node_proto_menu(menu, c->account->gc, node); + gaim_gtk_append_blist_node_extended_menu(menu, node); gaim_separator(menu); @@ -1257,6 +1251,9 @@ node, 0, 0, NULL); gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE, G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL); + + gaim_gtk_append_blist_node_extended_menu(menu, node); + return menu; } @@ -4497,12 +4494,6 @@ gaim_prefs_add_int("/gaim/gtk/blist/tooltip_delay", 500); /* Register our signals */ - gaim_signal_register(gtk_blist_handle, "drawing-menu", - gaim_marshal_VOID__POINTER_POINTER, NULL, 2, - gaim_value_new(GAIM_TYPE_BOXED, "GtkMenu"), - gaim_value_new(GAIM_TYPE_SUBTYPE, - GAIM_SUBTYPE_BLIST_BUDDY)); - gaim_signal_register(gtk_blist_handle, "gtkblist-created", gaim_marshal_VOID__POINTER, NULL, 1, gaim_value_new(GAIM_TYPE_SUBTYPE,
--- a/src/gtkblist.h Mon May 24 15:15:09 2004 +0000 +++ b/src/gtkblist.h Mon May 24 15:17:49 2004 +0000 @@ -226,4 +226,14 @@ */ void gaim_gtk_blist_joinchat_show(void); +/** + * Appends the protocol specific menu items for a GaimBlistNode + */ +void gaim_gtk_append_blist_node_proto_menu (GtkWidget *menu, GaimConnection *gc, GaimBlistNode *node); + +/** + * Appends the extended menu items for a GaimBlistNode + */ +void gaim_gtk_append_blist_node_extended_menu(GtkWidget *menu, GaimBlistNode *node); + #endif /* _GAIM_GTK_LIST_H_ */