/soc/2013/ankitkv/gobjectification: 4918c33856be: Refactored gtk...
Ankit Vani
a at nevitus.org
Sat Aug 10 15:08:10 EDT 2013
Changeset: 4918c33856bef2b2c21cf45c8c6fc2a7d728c90f
Author: Ankit Vani <a at nevitus.org>
Date: 2013-08-11 00:37 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/4918c33856be
Description:
Refactored gtkdocklet to use the actions callback
diffstat:
pidgin/gtkdocklet.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diffs (67 lines):
diff --git a/pidgin/gtkdocklet.c b/pidgin/gtkdocklet.c
--- a/pidgin/gtkdocklet.c
+++ b/pidgin/gtkdocklet.c
@@ -631,14 +631,16 @@ plugin_act(GtkWidget *widget, PurplePlug
}
static void
-build_plugin_actions(GtkWidget *menu, PurplePlugin *plugin,
- gpointer context)
+build_plugin_actions(GtkWidget *menu, PurplePlugin *plugin)
{
GtkWidget *menuitem;
+ PurplePluginGetActionsCallback get_actions;
PurplePluginAction *action = NULL;
GList *actions, *l;
- actions = PURPLE_PLUGIN_ACTIONS(plugin, context);
+ get_actions =
+ purple_plugin_info_get_actions_callback(purple_plugin_get_info(plugin));
+ actions = get_actions(plugin);
for (l = actions; l != NULL; l = l->next)
{
@@ -646,7 +648,6 @@ build_plugin_actions(GtkWidget *menu, Pu
{
action = (PurplePluginAction *) l->data;
action->plugin = plugin;
- action->context = context;
menuitem = gtk_menu_item_new_with_label(action->label);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
@@ -671,6 +672,7 @@ docklet_plugin_actions(GtkWidget *menu)
{
GtkWidget *menuitem, *submenu;
PurplePlugin *plugin = NULL;
+ PurplePluginInfo *info;
GList *l;
int c = 0;
@@ -678,21 +680,20 @@ docklet_plugin_actions(GtkWidget *menu)
/* Add a submenu for each plugin with custom actions */
for (l = purple_plugins_get_loaded(); l; l = l->next) {
- plugin = (PurplePlugin *) l->data;
+ plugin = PURPLE_PLUGIN(l->data);
+ info = purple_plugin_get_info(plugin);
- if (PURPLE_IS_PROTOCOL_PLUGIN(plugin))
+ if (!purple_plugin_info_get_actions_callback(info))
continue;
- if (!PURPLE_PLUGIN_HAS_ACTIONS(plugin))
- continue;
-
- menuitem = gtk_image_menu_item_new_with_label(_(plugin->info->name));
+ menuitem =
+ gtk_image_menu_item_new_with_label(_(purple_plugin_info_get_name(info)));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
submenu = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
- build_plugin_actions(submenu, plugin, NULL);
+ build_plugin_actions(submenu, plugin);
c++;
}
More information about the Commits
mailing list