Index: doc/blist-signals.dox
===================================================================
RCS file: /cvsroot/gaim/gaim/doc/blist-signals.dox,v
retrieving revision 1.2
diff -u -p -r1.2 blist-signals.dox
--- doc/blist-signals.dox 24 Aug 2003 06:34:17 -0000 1.2
+++ doc/blist-signals.dox 24 May 2004 14:39:59 -0000
@@ -8,6 +8,7 @@
@signal buddy-signed-on
@signal buddy-signed-off
@signal update-idle
+ @signal blist-node-extended-menu
@endsignals
@@ -74,5 +75,14 @@ void (*update_idle)();
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
Index: plugins/signals-test.c
===================================================================
RCS file: /cvsroot/gaim/gaim/plugins/signals-test.c,v
retrieving revision 1.11
diff -u -p -r1.11 signals-test.c
--- plugins/signals-test.c 21 May 2004 14:33:31 -0000 1.11
+++ plugins/signals-test.c 24 May 2004 14:39:59 -0000
@@ -109,15 +109,24 @@ buddy_signed_off_cb(GaimBuddy *buddy, vo
}
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;
+
+ 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);
-static void
-group_extended_menu_cb(GaimGroup *group, void *data)
-{
- gaim_debug_misc("signals test", "group-extended-menu (%s)\n", group->name);
}
@@ -166,12 +175,29 @@ displaying_im_msg_cb(GaimAccount *accoun
}
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 @@ displaying_chat_msg_cb(GaimAccount *acco
}
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_load(GaimPlugin *plugin)
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_load(GaimPlugin *plugin)
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_load(GaimPlugin *plugin)
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",
Index: plugins/gevolution/gevolution.c
===================================================================
RCS file: /cvsroot/gaim/gaim/plugins/gevolution/gevolution.c,v
retrieving revision 1.4
diff -u -p -r1.4 gevolution.c
--- plugins/gevolution/gevolution.c 21 May 2004 00:32:35 -0000 1.4
+++ plugins/gevolution/gevolution.c 24 May 2004 14:40:00 -0000
@@ -199,23 +199,29 @@ signed_on_cb(GaimConnection *gc)
}
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 @@ load_timeout(gpointer data)
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;
}
Index: src/gtkblist.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/gtkblist.c,v
retrieving revision 1.116
diff -u -p -r1.116 gtkblist.c
--- src/gtkblist.c 23 May 2004 17:27:42 -0000 1.116
+++ src/gtkblist.c 24 May 2004 14:40:01 -0000
@@ -1094,8 +1094,8 @@ append_blist_node_action (GtkWidget *men
}
-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 @@ append_blist_node_proto_menu (GtkWidget
}
-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 @@ static void make_buddy_menu(GtkWidget *m
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 @@ create_group_menu (GaimBlistNode *node,
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 @@ create_chat_menu (GaimBlistNode *node,
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 @@ create_contact_menu (GaimBlistNode *node
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 @@ void gaim_gtk_blist_init(void)
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,
Index: src/gtkblist.h
===================================================================
RCS file: /cvsroot/gaim/gaim/src/gtkblist.h,v
retrieving revision 1.21
diff -u -p -r1.21 gtkblist.h
--- src/gtkblist.h 20 May 2004 05:11:44 -0000 1.21
+++ src/gtkblist.h 24 May 2004 14:40:01 -0000
@@ -226,4 +226,14 @@ gboolean gaim_gtk_blist_joinchat_is_show
*/
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_ */