Mercurial > pidgin
changeset 5936:1b56a833d665
[gaim-migrate @ 6376]
Moved do_proto_menu() from prpl.[ch] to
gaim_gtk_blist_update_protocol_actions() in gtkblist.[ch].
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 21 Jun 2003 08:38:33 +0000 |
parents | e11b904c5bd7 |
children | 3034a6ea2d89 |
files | src/gtkblist.h src/gtkconn.c src/prpl.c src/prpl.h |
diffstat | 4 files changed, 6 insertions(+), 148 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkblist.h Sat Jun 21 07:59:53 2003 +0000 +++ b/src/gtkblist.h Sat Jun 21 08:38:33 2003 +0000 @@ -178,6 +178,10 @@ */ void gaim_gtk_blist_setup_sort_methods(); +/** + * Updates the protocol actions menu on the GTK+ buddy list window. + */ +void gaim_gtk_blist_update_protocol_actions(); #endif /* _GAIM_GTK_LIST_H_ */
--- a/src/gtkconn.c Sat Jun 21 07:59:53 2003 +0000 +++ b/src/gtkconn.c Sat Jun 21 08:38:33 2003 +0000 @@ -216,7 +216,7 @@ gaim_setup(gc); do_away_menu(); - do_proto_menu(); + gaim_gtk_blist_update_protocol_actions(); if(meter) kill_meter(meter, _("Done.")); @@ -233,7 +233,7 @@ update_privacy_connections(); do_away_menu(); - do_proto_menu(); + gaim_gtk_blist_update_protocol_actions(); if(meter) kill_meter(meter, _("Done."));
--- a/src/prpl.c Sat Jun 21 07:59:53 2003 +0000 +++ b/src/prpl.c Sat Jun 21 08:38:33 2003 +0000 @@ -59,143 +59,6 @@ return NULL; } -static void proto_act(GtkObject *obj, struct proto_actions_menu *pam) -{ - if (pam->callback && pam->gc) - pam->callback(pam->gc); -} - -void do_proto_menu() -{ - GtkWidget *menuitem; - GtkWidget *submenu; - GaimPluginProtocolInfo *prpl_info = NULL; - GList *l; - GList *c; - struct proto_actions_menu *pam; - GaimConnection *gc = NULL; - int count = 0; - char buf[256]; - - if (!protomenu) - return; - - l = gtk_container_get_children(GTK_CONTAINER(protomenu)); - while (l) { - menuitem = l->data; - pam = g_object_get_data(G_OBJECT(menuitem), "proto_actions_menu"); - if (pam) - g_free(pam); - gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(menuitem)); - l = l->next; - } - - for (c = gaim_connections_get_all(); c != NULL; c = c->next) { - gc = c->data; - - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); - - if (prpl_info->actions && gc->login_time) - count++; - } - - if (!count) { - g_snprintf(buf, sizeof(buf), _("No actions available")); - menuitem = gtk_menu_item_new_with_label(buf); - gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem); - gtk_widget_show(menuitem); - return; - } - - if (count == 1) { - GList *act; - - for (c = gaim_connections_get_all(); c != NULL; c = c->next) { - gc = c->data; - - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); - - if (prpl_info->actions && gc->login_time) - break; - } - - act = prpl_info->actions(gc); - - while (act) { - if (act->data) { - struct proto_actions_menu *pam = act->data; - menuitem = gtk_menu_item_new_with_label(pam->label); - gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem); - g_signal_connect(G_OBJECT(menuitem), "activate", - G_CALLBACK(proto_act), pam); - g_object_set_data(G_OBJECT(menuitem), "proto_actions_menu", pam); - gtk_widget_show(menuitem); - } else { - gaim_separator(protomenu); - } - act = g_list_next(act); - } - } else { - for (c = gaim_connections_get_all(); c != NULL; c = c->next) { - GaimAccount *account; - GList *act; - GdkPixbuf *pixbuf, *scale; - GtkWidget *image; - - gc = c->data; - - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); - - if (!prpl_info->actions || !gc->login_time) - continue; - - account = gaim_connection_get_account(gc); - - g_snprintf(buf, sizeof(buf), "%s (%s)", - gaim_account_get_username(account), - gc->prpl->info->name); - - menuitem = gtk_image_menu_item_new_with_label(buf); - - pixbuf = create_prpl_icon(gc->account); - if(pixbuf) { - scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, - GDK_INTERP_BILINEAR); - image = gtk_image_new_from_pixbuf(scale); - g_object_unref(G_OBJECT(pixbuf)); - g_object_unref(G_OBJECT(scale)); - gtk_widget_show(image); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); - } - - gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem); - gtk_widget_show(menuitem); - - submenu = gtk_menu_new(); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); - gtk_widget_show(submenu); - - act = prpl_info->actions(gc); - - while (act) { - if (act->data) { - struct proto_actions_menu *pam = act->data; - menuitem = gtk_menu_item_new_with_label(pam->label); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); - g_signal_connect(G_OBJECT(menuitem), "activate", - G_CALLBACK(proto_act), pam); - g_object_set_data(G_OBJECT(menuitem), "proto_actions_menu", - pam); - gtk_widget_show(menuitem); - } else { - gaim_separator(submenu); - } - act = g_list_next(act); - } - } - } -} - struct icon_data { GaimConnection *gc; char *who;
--- a/src/prpl.h Sat Jun 21 07:59:53 2003 +0000 +++ b/src/prpl.h Sat Jun 21 08:38:33 2003 +0000 @@ -324,15 +324,6 @@ GaimPlugin *gaim_find_prpl(GaimProtocol type); /** - * Creates a menu of all protocol plugins and their protocol-specific - * actions. - * - * @note This should be UI-specific code, or rewritten in such a way as to - * not use any any GTK code. - */ -void do_proto_menu(void); - -/** * Shows a message saying that somebody added you as a buddy, and asks * if you would like to do the same. *