/soc/2013/ankitkv/gobjectification: 24b99fa7ece6: Refactored gnt...

Ankit Vani a at nevitus.org
Wed Jul 31 13:49:18 EDT 2013


Changeset: 24b99fa7ece6d1c5e3103569474593893f005dba
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-31 23:19 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/24b99fa7ece6

Description:

Refactored gntconv and finch core to use the initial GObject plugin API

diffstat:

 finch/finch.c   |  15 +++++++--------
 finch/gntconv.c |  13 ++++++++-----
 2 files changed, 15 insertions(+), 13 deletions(-)

diffs (83 lines):

diff --git a/finch/finch.c b/finch/finch.c
--- a/finch/finch.c
+++ b/finch/finch.c
@@ -361,14 +361,6 @@ init_libpurple(int argc, char **argv)
 	purple_eventloop_set_ui_ops(gnt_eventloop_get_ui_ops());
 	purple_idle_set_ui_ops(finch_idle_get_ui_ops());
 
-	path = g_build_filename(purple_user_dir(), "plugins", NULL);
-	if (!g_stat(path, &st))
-		g_mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR);
-	purple_plugins_add_search_path(path);
-	g_free(path);
-
-	purple_plugins_add_search_path(LIBDIR);
-
 	if (!purple_core_init(FINCH_UI))
 	{
 		fprintf(stderr,
@@ -377,6 +369,13 @@ init_libpurple(int argc, char **argv)
 		abort();
 	}
 
+	path = g_build_filename(purple_user_dir(), "plugins", NULL);
+	if (!g_stat(path, &st))
+		g_mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR);
+	gplugin_plugin_manager_append_path(path);
+	gplugin_plugin_manager_refresh();
+	g_free(path);
+
 	/* TODO: should this be moved into finch_prefs_init() ? */
 	finch_prefs_update_old();
 
diff --git a/finch/gntconv.c b/finch/gntconv.c
--- a/finch/gntconv.c
+++ b/finch/gntconv.c
@@ -339,7 +339,7 @@ account_signed_on_off(PurpleConnection *
 
 			chat = find_chat_for_conversation(conv);
 			if (chat == NULL) {
-				PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc));
+				PurplePluginProtocolInfo *info = purple_connection_get_protocol_info(gc);
 				if (info->chat_info_defaults != NULL)
 					comps = info->chat_info_defaults(gc, purple_conversation_get_name(conv));
 			} else {
@@ -603,7 +603,7 @@ invite_cb(GntMenuItem *item, gpointer gg
 }
 
 static void
-plugin_changed_cb(PurplePlugin *p, gpointer data)
+plugin_changed_cb(GPluginPlugin *p, gpointer data)
 {
 	gg_extended_menu(data);
 }
@@ -637,7 +637,7 @@ gg_create_menu(FinchConv *ggc)
 		PurpleAccount *account = purple_conversation_get_account(ggc->active_conv);
 		PurpleConnection *gc = purple_account_get_connection(account);
 		PurplePluginProtocolInfo *pinfo =
-			gc ? PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc)) : NULL;
+			gc ? purple_connection_get_protocol_info(gc) : NULL;
 
 		if (pinfo && pinfo->get_info) {
 			item = gnt_menuitem_new(_("Get Info"));
@@ -703,7 +703,7 @@ create_conv_from_userlist(GntWidget *wid
 
 	name = gnt_tree_get_selection_data(GNT_TREE(widget));
 
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc));
+	prpl_info = purple_connection_get_protocol_info(gc);
 	if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_cb_real_name))
 		realname = prpl_info->get_cb_real_name(gc, purple_chat_conversation_get_id(
 				PURPLE_CHAT_CONVERSATION(fc->active_conv)), name);
@@ -1251,7 +1251,10 @@ debug_command_cb(PurpleConversation *con
 		const GList *plugins = purple_plugins_get_loaded();
 		if (plugins) {
 			for (; plugins; plugins = plugins->next) {
-				str = g_string_append(str, purple_plugin_get_name(plugins->data));
+				GPluginPluginInfo *plugin_info = gplugin_plugin_get_info(plugins->data);
+				str = g_string_append(str, gplugin_plugin_info_get_name(plugin_info));
+				g_object_unref(plugin_info);
+
 				if (plugins->next)
 					str = g_string_append(str, ", ");
 			}



More information about the Commits mailing list