/soc/2013/ankitkv/gobjectification: 58d31fb6330a: Refactored the...

Ankit Vani a at nevitus.org
Sat Aug 3 12:50:49 EDT 2013


Changeset: 58d31fb6330afbc7fae988c8a708050fba798ff6
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-03 22:20 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/58d31fb6330a

Description:

Refactored the codebase according to the API changes

diffstat:

 finch/gntblist.c    |   8 ++++----
 pidgin/gtkblist.c   |  11 ++++-------
 pidgin/gtkdialogs.c |   2 +-
 pidgin/gtkdocklet.c |   4 ++--
 pidgin/gtkplugin.c  |  19 ++++++++-----------
 5 files changed, 19 insertions(+), 25 deletions(-)

diffs (186 lines):

diff --git a/finch/gntblist.c b/finch/gntblist.c
--- a/finch/gntblist.c
+++ b/finch/gntblist.c
@@ -2450,13 +2450,13 @@ plugin_action(GntMenuItem *item, gpointe
 }
 
 static void
-build_plugin_actions(GntMenuItem *item, PurplePluginInfo *plugin_info)
+build_plugin_actions(GntMenuItem *item, PurplePlugin *plugin)
 {
 	GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP);
 	GList *actions, *l;
 	GntMenuItem *menuitem;
 
-	actions = purple_plugin_info_get_actions(plugin_info);
+	actions = purple_plugin_get_actions(plugin);
 
 	gnt_menuitem_set_submenu(item, GNT_MENU(sub));
 	for (l = actions; l; l = l->next) {
@@ -2567,12 +2567,12 @@ reconstruct_plugins_menu(void)
 		PurplePluginInfo *plugin_info = purple_plugin_get_info(plugin);
 		GntMenuItem *item;
 
-		if (!purple_plugin_info_get_actions(plugin_info))
+		if (!purple_plugin_get_actions(plugin))
 			continue;
 
 		item = gnt_menuitem_new(_(purple_plugin_info_get_name(plugin_info)));
 		gnt_menu_add_item(GNT_MENU(sub), item);
-		build_plugin_actions(item, plugin_info);
+		build_plugin_actions(item, plugin);
 	}
 }
 
diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c
--- a/pidgin/gtkblist.c
+++ b/pidgin/gtkblist.c
@@ -8109,7 +8109,7 @@ plugin_act(GtkWidget *obj, PurplePluginA
 
 static void
 build_plugin_actions(GtkActionGroup *action_group, GString *ui, char *parent,
-		PurplePluginInfo *plugin_info)
+		PurplePlugin *plugin)
 {
 	GtkAction *menuaction;
 	PurplePluginAction *action = NULL;
@@ -8117,7 +8117,7 @@ build_plugin_actions(GtkActionGroup *act
 	char *name;
 	int count = 0;
 
-	actions = purple_plugin_info_get_actions(plugin_info);
+	actions = purple_plugin_get_actions(plugin);
 
 	for (l = actions; l != NULL; l = l->next) {
 		if (l->data) {
@@ -8382,10 +8382,7 @@ pidgin_blist_update_plugin_actions(void)
 		plugin = PURPLE_PLUGIN(l->data);
 		info = purple_plugin_get_info(plugin);
 
-		if (!info)
-			continue;
-
-		if (!purple_plugin_info_get_actions(info))
+		if (!purple_plugin_get_actions(plugin))
 			continue;
 
 		name = g_strdup_printf("plugin%d", count);
@@ -8394,7 +8391,7 @@ pidgin_blist_update_plugin_actions(void)
 		gtk_action_group_add_action(plugins_action_group, action);
 		g_string_append_printf(plugins_ui, "<menu action='%s'>", name);
 
-		build_plugin_actions(plugins_action_group, plugins_ui, name, info);
+		build_plugin_actions(plugins_action_group, plugins_ui, name, plugin);
 
 		g_string_append(plugins_ui, "</menu>");
 		count++;
diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c
--- a/pidgin/gtkdialogs.c
+++ b/pidgin/gtkdialogs.c
@@ -853,7 +853,7 @@ void pidgin_dialogs_plugins_info(void)
 		pver = purple_plugin_info_get_version(info);
 		pwebsite = purple_plugin_info_get_website(info);
 		pid = purple_plugin_info_get_id(info);
-		ploadable = purple_plugin_info_is_loadable(info);
+		ploadable = purple_plugin_is_loadable(plugin);
 		ploaded = purple_plugin_is_loaded(plugin);
 
 		g_string_append_printf(str,
diff --git a/pidgin/gtkdocklet.c b/pidgin/gtkdocklet.c
--- a/pidgin/gtkdocklet.c
+++ b/pidgin/gtkdocklet.c
@@ -637,7 +637,7 @@ build_plugin_actions(GtkWidget *menu, Pu
 	PurplePluginAction *action = NULL;
 	GList *actions, *l;
 
-	actions = purple_plugin_info_get_actions(purple_plugin_get_info(plugin));
+	actions = purple_plugin_get_actions(plugin);
 
 	for (l = actions; l != NULL; l = l->next)
 	{
@@ -675,7 +675,7 @@ docklet_plugin_actions(GtkWidget *menu)
 		plugin = PURPLE_PLUGIN(l->data);
 		info = purple_plugin_get_info(plugin);
 
-		if (!purple_plugin_info_get_actions(info))
+		if (!purple_plugin_get_actions(plugin))
 			continue;
 
 		menuitem = gtk_image_menu_item_new_with_label(_(purple_plugin_info_get_name(info)));
diff --git a/pidgin/gtkplugin.c b/pidgin/gtkplugin.c
--- a/pidgin/gtkplugin.c
+++ b/pidgin/gtkplugin.c
@@ -199,7 +199,7 @@ update_plugin_list(void *data)
 				   0, purple_plugin_is_loaded(plug),
 				   1, desc,
 				   2, plug,
-				   3, !purple_plugin_info_is_loadable(info),
+				   3, !purple_plugin_is_loadable(plug),
 				   -1);
 		g_free(desc);
 	}
@@ -287,17 +287,14 @@ static void plugin_toggled(GtkCellRender
 	GtkTreeIter *iter = g_new(GtkTreeIter, 1);
 	GtkTreePath *path = gtk_tree_path_new_from_string(pth);
 	PurplePlugin *plug;
-	PurplePluginInfo *info;
 	GtkWidget *dialog = NULL;
 
 	gtk_tree_model_get_iter(model, iter, path);
 	gtk_tree_path_free(path);
 	gtk_tree_model_get(model, iter, 2, &plug, -1);
 
-	info = purple_plugin_get_info(plug);
-
 	/* Apparently, GTK+ won't honor the sensitive flag on cell renderers for booleans. */
-	if (!purple_plugin_info_is_loadable(info))
+	if (!purple_plugin_is_loadable(plug))
 	{
 		g_free(iter);
 		return;
@@ -318,13 +315,13 @@ static void plugin_toggled(GtkCellRender
 			(dialog = g_hash_table_lookup(plugin_pref_dialogs, plug)))
 			pref_dialog_response_cb(dialog, GTK_RESPONSE_DELETE_EVENT, plug);
 
-		if (purple_plugin_info_get_dependent_plugins(info) != NULL)
+		if (purple_plugin_get_dependent_plugins(plug) != NULL)
 		{
 			GString *tmp = g_string_new(_("The following plugins will be unloaded."));
 			GSList *l;
 			gpointer *cb_data;
 
-			for (l = purple_plugin_info_get_dependent_plugins(info); l != NULL ; l = l->next)
+			for (l = purple_plugin_get_dependent_plugins(plug); l != NULL ; l = l->next)
 			{
 				const char *dep_name = (const char *)l->data;
 				PurplePlugin *dep_plugin = purple_plugins_find_plugin(dep_name);
@@ -378,11 +375,11 @@ static void plugin_toggled_stage_two(Pur
 	gtk_widget_set_sensitive(pref_button,
 		purple_plugin_is_loaded(plug) && pidgin_plugin_has_config_frame(plug));
 
-	if (purple_plugin_info_get_error(info) != NULL)
+	if (purple_plugin_get_error(plug) != NULL)
 	{
 		gchar *name = g_markup_escape_text(purple_plugin_info_get_name(info), -1);
 
-		gchar *error = g_markup_escape_text(purple_plugin_info_get_error(info), -1);
+		gchar *error = g_markup_escape_text(purple_plugin_get_error(plug), -1);
 		gchar *text;
 
 		text = g_strdup_printf(
@@ -485,13 +482,13 @@ static void prefs_plugin_sel (GtkTreeSel
 		gtk_label_set_text(plugin_website, NULL);
 	}
 
-	if (purple_plugin_info_get_error(info) == NULL)
+	if (purple_plugin_get_error(plug) == NULL)
 	{
 		gtk_label_set_text(plugin_error, NULL);
 	}
 	else
 	{
-		tmp = g_markup_escape_text(purple_plugin_info_get_error(info), -1);
+		tmp = g_markup_escape_text(purple_plugin_get_error(plug), -1);
 		buf = g_strdup_printf(
 			_("<span foreground=\"red\" weight=\"bold\">"
 			  "Error: %s\n"



More information about the Commits mailing list