/soc/2013/ankitkv/gobjectification: 38865e7d8465: Added new API ...

Ankit Vani a at nevitus.org
Thu Sep 19 07:24:22 EDT 2013


Changeset: 38865e7d8465826b48dbba7eef57adbe1c07a4c6
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-19 16:53 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/38865e7d8465

Description:

Added new API entry points for win32 pidgin plugins (not tested)

diffstat:

 pidgin/plugins/win32/transparency/win2ktrans.c |  169 ++++++++++--------------
 pidgin/plugins/win32/winprefs/winprefs.c       |  133 +++++++-----------
 2 files changed, 127 insertions(+), 175 deletions(-)

diffs (truncated from 356 to 300 lines):

diff --git a/pidgin/plugins/win32/transparency/win2ktrans.c b/pidgin/plugins/win32/transparency/win2ktrans.c
--- a/pidgin/plugins/win32/transparency/win2ktrans.c
+++ b/pidgin/plugins/win32/transparency/win2ktrans.c
@@ -487,55 +487,6 @@ static void update_existing_convs() {
 /*
  *  EXPORTED FUNCTIONS
  */
-static gboolean plugin_load(PurplePlugin *plugin) {
-
-	purple_signal_connect(purple_conversations_get_handle(),
-		"conversation-created", plugin,
-		PURPLE_CALLBACK(new_conversation_cb), NULL);
-
-	/* Set callback to remove window from the list, if the window is destroyed */
-	purple_signal_connect(purple_conversations_get_handle(),
-		"deleting-conversation", plugin,
-		PURPLE_CALLBACK(conversation_delete_cb), NULL);
-
-	purple_signal_connect(pidgin_conversations_get_handle(),
-		"conversation-dragging", plugin,
-		PURPLE_CALLBACK(set_conv_window_trans), NULL);
-
-	purple_signal_connect(purple_conversations_get_handle(),
-		"conversation-updated", plugin,
-		PURPLE_CALLBACK(conv_updated_cb), NULL);
-
-	update_existing_convs();
-
-	if (blist)
-		blist_created_cb(NULL, NULL);
-	else
-		purple_signal_connect(pidgin_blist_get_handle(),
-			"gtkblist-created", plugin,
-			PURPLE_CALLBACK(blist_created_cb), NULL);
-
-
-	return TRUE;
-}
-
-static gboolean plugin_unload(PurplePlugin *plugin) {
-	purple_debug_info(WINTRANS_PLUGIN_ID, "Unloading win2ktrans plugin\n");
-
-	remove_convs_wintrans(TRUE);
-
-	if (blist) {
-		if (purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED))
-			set_wintrans(blist, 0, FALSE, FALSE);
-
-		/* Remove the focus cbs */
-		g_signal_handlers_disconnect_by_func(G_OBJECT(blist),
-			G_CALLBACK(focus_blist_win_cb), blist);
-	}
-
-	return TRUE;
-}
-
 static GtkWidget *get_config_frame(PurplePlugin *plugin) {
 	GtkWidget *ret;
 	GtkWidget *imtransbox, *bltransbox;
@@ -656,56 +607,36 @@ static GtkWidget *get_config_frame(Purpl
 	return ret;
 }
 
-static PidginPluginUiInfo ui_info =
+static PidginPluginInfo *
+plugin_query(GError **error)
 {
-	get_config_frame,
-	0, /* page_num (Reserved) */
+	const gchar * const authors[] = {
+		"Herman Bloggs <hermanator12002 at yahoo.com>",
+		NULL
+	};
 
-	/* padding */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
+	return pidgin_plugin_info_new(
+		"id",                   WINTRANS_PLUGIN_ID,
+		"name",                 N_("Transparency"),
+		"version",              DISPLAY_VERSION,
+		"category",             N_("User interface"),
+		"summary",              N_("Variable Transparency for the buddy list "
+		                           "and conversations."),
+		"description",          N_("This plugin enables variable alpha "
+		                           "transparency on conversation windows and "
+		                           "the buddy list.\n\n"
+		                           "* Note: This plugin requires Win2000 or "
+		                           "greater."),
+		"authors",              authors,
+		"website",              PURPLE_WEBSITE,
+		"abi-version",          PURPLE_ABI_VERSION,
+		"pidgin-config-frame",  get_config_frame,
+		NULL
+	);
+}
 
-static PurplePluginInfo info =
-{
-	PURPLE_PLUGIN_MAGIC,
-	PURPLE_MAJOR_VERSION,
-	PURPLE_MINOR_VERSION,
-	PURPLE_PLUGIN_STANDARD,		/**< type           */
-	PIDGIN_PLUGIN_TYPE,		/**< ui_requirement */
-	0,				/**< flags          */
-	NULL,				/**< dependencies   */
-	PURPLE_PRIORITY_DEFAULT,		/**< priority       */
-	WINTRANS_PLUGIN_ID,		/**< id             */
-	N_("Transparency"),		/**< name           */
-	DISPLAY_VERSION,		/**< version        */
-					/**  summary        */
-	N_("Variable Transparency for the buddy list and conversations."),
-					/**  description    */
-	N_("This plugin enables variable alpha transparency on conversation windows and the buddy list.\n\n"
-	"* Note: This plugin requires Win2000 or greater."),
-	"Herman Bloggs <hermanator12002 at yahoo.com>",	/**< author         */
-	PURPLE_WEBSITE,			/**< homepage       */
-	plugin_load,			/**< load           */
-	plugin_unload,			/**< unload         */
-	NULL,				/**< destroy        */
-	&ui_info,			/**< ui_info        */
-	NULL,				/**< extra_info     */
-	NULL,				/**< prefs_info     */
-	NULL,				/**< actions        */
+static gboolean plugin_load(PurplePlugin *plugin, GError **error) {
 
-	/* padding */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
-
-static void
-init_plugin(PurplePlugin *plugin)
-{
 	purple_prefs_add_none("/plugins/gtk/win32");
 	purple_prefs_add_none("/plugins/gtk/win32/wintrans");
 	purple_prefs_add_bool(OPT_WINTRANS_IM_ENABLED, FALSE);
@@ -717,6 +648,52 @@ init_plugin(PurplePlugin *plugin)
 	purple_prefs_add_int(OPT_WINTRANS_BL_ALPHA, 255);
 	purple_prefs_add_bool(OPT_WINTRANS_BL_ONFOCUS, FALSE);
 	purple_prefs_add_bool(OPT_WINTRANS_BL_ONTOP, FALSE);
+
+	purple_signal_connect(purple_conversations_get_handle(),
+		"conversation-created", plugin,
+		PURPLE_CALLBACK(new_conversation_cb), NULL);
+
+	/* Set callback to remove window from the list, if the window is destroyed */
+	purple_signal_connect(purple_conversations_get_handle(),
+		"deleting-conversation", plugin,
+		PURPLE_CALLBACK(conversation_delete_cb), NULL);
+
+	purple_signal_connect(pidgin_conversations_get_handle(),
+		"conversation-dragging", plugin,
+		PURPLE_CALLBACK(set_conv_window_trans), NULL);
+
+	purple_signal_connect(purple_conversations_get_handle(),
+		"conversation-updated", plugin,
+		PURPLE_CALLBACK(conv_updated_cb), NULL);
+
+	update_existing_convs();
+
+	if (blist)
+		blist_created_cb(NULL, NULL);
+	else
+		purple_signal_connect(pidgin_blist_get_handle(),
+			"gtkblist-created", plugin,
+			PURPLE_CALLBACK(blist_created_cb), NULL);
+
+
+	return TRUE;
 }
 
-PURPLE_INIT_PLUGIN(wintrans, init_plugin, info)
+static gboolean plugin_unload(PurplePlugin *plugin, GError **error) {
+	purple_debug_info(WINTRANS_PLUGIN_ID, "Unloading win2ktrans plugin\n");
+
+	remove_convs_wintrans(TRUE);
+
+	if (blist) {
+		if (purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED))
+			set_wintrans(blist, 0, FALSE, FALSE);
+
+		/* Remove the focus cbs */
+		g_signal_handlers_disconnect_by_func(G_OBJECT(blist),
+			G_CALLBACK(focus_blist_win_cb), blist);
+	}
+
+	return TRUE;
+}
+
+PURPLE_PLUGIN_INIT(wintrans, plugin_query, plugin_load, plugin_unload);
diff --git a/pidgin/plugins/win32/winprefs/winprefs.c b/pidgin/plugins/win32/winprefs/winprefs.c
--- a/pidgin/plugins/win32/winprefs/winprefs.c
+++ b/pidgin/plugins/win32/winprefs/winprefs.c
@@ -229,40 +229,6 @@ winprefs_set_blist_ontop(const char *pre
  *  EXPORTED FUNCTIONS
  */
 
-static gboolean plugin_load(PurplePlugin *plugin) {
-	handle = plugin;
-
-	/* blist docking init */
-	if(purple_blist_get_buddy_list() && PIDGIN_BLIST(purple_blist_get_buddy_list())
-			&& PIDGIN_BLIST(purple_blist_get_buddy_list())->window) {
-		blist_create_cb(purple_blist_get_buddy_list(), NULL);
-	}
-
-	/* This really shouldn't happen anymore generally, but if for some strange
-	   reason, the blist is recreated, we need to set it up again. */
-	purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created",
-		plugin, PURPLE_CALLBACK(blist_create_cb), NULL);
-
-	purple_signal_connect((void*)purple_get_core(), "quitting", plugin,
-		PURPLE_CALLBACK(purple_quit_cb), NULL);
-
-	purple_prefs_connect_callback(handle, PREF_BLIST_ON_TOP,
-		winprefs_set_blist_ontop, NULL);
-	purple_prefs_connect_callback(handle, PREF_DBLIST_DOCKABLE,
-		winprefs_set_blist_dockable, NULL);
-
-	return TRUE;
-}
-
-static gboolean plugin_unload(PurplePlugin *plugin) {
-	blist_set_dockable(FALSE);
-	blist_set_ontop(FALSE);
-
-	handle = NULL;
-
-	return TRUE;
-}
-
 static GtkWidget* get_config_frame(PurplePlugin *plugin) {
 	GtkWidget *ret;
 	GtkWidget *vbox;
@@ -314,53 +280,31 @@ static GtkWidget* get_config_frame(Purpl
 	return ret;
 }
 
-static PidginPluginUiInfo ui_info =
+static PidginPluginInfo *
+plugin_query(GError **error)
 {
-	get_config_frame,
-	0,
+	const gchar * const authors[] = {
+		"Herman Bloggs <hermanator12002 at yahoo.com>",
+		NULL
+	};
 
-	/* padding */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
+	return pidgin_plugin_info_new(
+		"id",                   WINPREFS_PLUGIN_ID,
+		"name",                 N_("Windows Pidgin Options"),
+		"version",              DISPLAY_VERSION,
+		"category",             N_("User interface"),
+		"summary",              N_("Options specific to Pidgin for Windows."),
+		"description",          N_("Provides options specific to Pidgin for "
+		                           "Windows, such as buddy list docking."),
+		"authors",              authors,
+		"website",              PURPLE_WEBSITE,
+		"abi-version",          PURPLE_ABI_VERSION,
+		"pidgin-config-frame",  get_config_frame,
+		NULL
+	);
+}
 
-static PurplePluginInfo info =
-{
-	PURPLE_PLUGIN_MAGIC,
-	PURPLE_MAJOR_VERSION,
-	PURPLE_MINOR_VERSION,
-	PURPLE_PLUGIN_STANDARD,
-	PIDGIN_PLUGIN_TYPE,
-	0,
-	NULL,
-	PURPLE_PRIORITY_DEFAULT,
-	WINPREFS_PLUGIN_ID,
-	N_("Windows Pidgin Options"),
-	DISPLAY_VERSION,
-	N_("Options specific to Pidgin for Windows."),
-	N_("Provides options specific to Pidgin for Windows, such as buddy list docking."),
-	"Herman Bloggs <hermanator12002 at yahoo.com>",
-	PURPLE_WEBSITE,
-	plugin_load,
-	plugin_unload,
-	NULL,
-	&ui_info,
-	NULL,
-	NULL,



More information about the Commits mailing list