changeset 32589:f55f8592986c

Don't get account and plugin actions confused by using the same action name for both of them.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Tue, 28 Jul 2009 02:48:40 +0000
parents c8e05a81428f
children a3c70b71e18a
files pidgin/gtkblist.c
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Tue Jul 28 02:41:18 2009 +0000
+++ b/pidgin/gtkblist.c	Tue Jul 28 02:48:40 2009 +0000
@@ -8091,7 +8091,7 @@
 
 #if GTK_CHECK_VERSION(2,4,0)
 static void
-build_plugin_actions(GtkActionGroup *action_group, GString *ui, int parent,
+build_plugin_actions(GtkActionGroup *action_group, GString *ui, char *parent,
 		PurplePlugin *plugin, gpointer context)
 {
 	GtkAction *menuaction;
@@ -8108,7 +8108,7 @@
 			action->plugin = plugin;
 			action->context = context;
 
-			name = g_strdup_printf("plugin-%d-action-%d", parent, count++);
+			name = g_strdup_printf("%s-action-%d", parent, count++);
 			menuaction = gtk_action_new(name, action->label, NULL, NULL);
 			gtk_action_group_add_action(action_group, menuaction);
 			g_string_append_printf(ui, "<menuitem action='%s'/>", name);
@@ -8263,7 +8263,9 @@
 			gc = purple_account_get_connection(account);
 			plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL;
 			if (plugin && PURPLE_PLUGIN_HAS_ACTIONS(plugin)) {
-				build_plugin_actions(accounts_action_group, accounts_ui, count, plugin, gc);
+				name = g_strdup_printf("account%d", count);
+				build_plugin_actions(accounts_action_group, accounts_ui, name, plugin, gc);
+				g_free(name);
 			} else {
 				g_string_append(accounts_ui, "<menuitem action='none-available'/>");
 			}
@@ -8481,12 +8483,13 @@
 		action = gtk_action_new(name, plugin->info->name, NULL, NULL);
 		gtk_action_group_add_action(plugins_action_group, action);
 		g_string_append_printf(plugins_ui, "<menu action='%s'>", name);
-		g_free(name);
-
-		build_plugin_actions(plugins_action_group, plugins_ui, count, plugin, NULL);
+
+		build_plugin_actions(plugins_action_group, plugins_ui, name, plugin, NULL);
 
 		g_string_append(plugins_ui, "</menu>");
 		count++;
+
+		g_free(name);
 	}
 
 	ui_string = g_strconcat("<ui><menubar action='BList'><menu action='ToolsMenu'><placeholder name='PluginActions'>",