diff src/prpl.c @ 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 023c5f380b5c
line wrap: on
line diff
--- 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;