/soc/2013/ankitkv/gobjectification: 4826ec4c6ac5: More pidgin pl...

Ankit Vani a at nevitus.org
Tue Sep 17 05:21:43 EDT 2013


Changeset: 4826ec4c6ac5d42b3642537ce35ff3c83a259b9f
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-17 14:51 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/4826ec4c6ac5

Description:

More pidgin plugins to new API

diffstat:

 pidgin/plugins/contact_priority.c |   81 +++++++++++------------------
 pidgin/plugins/convcolors.c       |  102 +++++++++++++------------------------
 pidgin/plugins/gtk-signals-test.c |   70 +++++++++----------------
 3 files changed, 93 insertions(+), 160 deletions(-)

diffs (truncated from 318 to 300 lines):

diff --git a/pidgin/plugins/contact_priority.c b/pidgin/plugins/contact_priority.c
--- a/pidgin/plugins/contact_priority.c
+++ b/pidgin/plugins/contact_priority.c
@@ -162,56 +162,39 @@ get_config_frame(PurplePlugin *plugin)
 	return ret;
 }
 
-static PidginPluginUiInfo ui_info =
+static PidginPluginInfo *
+plugin_query(GError **error)
 {
-	get_config_frame,
-	0, /* page_num (Reserved) */
-	/* Padding */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
+	const gchar * const authors[] = {
+		"Etan Reisner <deryni at eden.rutgers.edu>",
+		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       */
-
-	CONTACT_PRIORITY_PLUGIN_ID,                     /**< id             */
-	N_("Contact Priority"),                         /**< name           */
-	DISPLAY_VERSION,                                /**< version        */
-                                                    /**< summary        */
-	N_("Allows for controlling the values associated with different buddy states."),
-                                                    /**< description    */
-	N_("Allows for changing the point values of idle/away/offline states for buddies in contact priority computations."),
-	"Etan Reisner <deryni at eden.rutgers.edu>",       /**< author         */
-	PURPLE_WEBSITE,                                 /**< homepage       */
-
-	NULL,                                           /**< load           */
-	NULL,                                           /**< unload         */
-	NULL,                                           /**< destroy        */
-	&ui_info,                                       /**< ui_info        */
-	NULL,                                           /**< extra_info     */
-	NULL,                                           /**< prefs_info     */
-	NULL,                                           /**< actions        */
-
-	/* padding */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
-
-static void
-init_plugin(PurplePlugin *plugin)
-{
+	return pidgin_plugin_info_new(
+		"id",                   CONTACT_PRIORITY_PLUGIN_ID,
+		"name",                 N_("Contact Priority"),
+		"version",              DISPLAY_VERSION,
+		"category",             N_("Utility"),
+		"summary",              N_("Allows for controlling the values associated with different buddy states."),
+		"description",          N_("Allows for changing the point values of idle/away/offline states for buddies in contact priority computations."),
+		"authors",              authors,
+		"website",              PURPLE_WEBSITE,
+		"abi-version",          PURPLE_ABI_VERSION,
+		"pidgin-config-frame",  get_config_frame,
+		NULL
+	);
 }
 
-PURPLE_INIT_PLUGIN(contactpriority, init_plugin, info)
+static gboolean
+plugin_load(PurplePlugin *plugin, GError **error)
+{
+	return TRUE;
+}
+
+static gboolean
+plugin_unload(PurplePlugin *plugin, GError **error)
+{
+	return TRUE;
+}
+
+PURPLE_PLUGIN_INIT(contactpriority, plugin_query, plugin_load, plugin_unload);
diff --git a/pidgin/plugins/convcolors.c b/pidgin/plugins/convcolors.c
--- a/pidgin/plugins/convcolors.c
+++ b/pidgin/plugins/convcolors.c
@@ -21,10 +21,11 @@
 
 #define PLUGIN_ID			"gtk-plugin_pack-convcolors"
 #define PLUGIN_NAME			N_("Conversation Colors")
+#define PLUGIN_CATEGORY		N_("User interface")
 #define PLUGIN_STATIC_NAME	ConversationColors
 #define PLUGIN_SUMMARY		N_("Customize colors in the conversation window")
 #define PLUGIN_DESCRIPTION	N_("Customize colors in the conversation window")
-#define PLUGIN_AUTHOR		"Sadrul H Chowdhury <sadrul at users.sourceforge.net>"
+#define PLUGIN_AUTHORS		{"Sadrul H Chowdhury <sadrul at users.sourceforge.net>", NULL}
 
 /* System headers */
 #include <gdk/gdk.h>
@@ -172,24 +173,6 @@ displaying_msg(PurpleAccount *account, c
 	return FALSE;
 }
 
-static gboolean
-plugin_load(PurplePlugin *plugin)
-{
-	purple_signal_connect(pidgin_conversations_get_handle(),
-					"displaying-im-msg", plugin,
-					PURPLE_CALLBACK(displaying_msg), NULL);
-	purple_signal_connect(pidgin_conversations_get_handle(),
-					"displaying-chat-msg", plugin,
-					PURPLE_CALLBACK(displaying_msg), NULL);
-	return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin)
-{
-	return TRUE;
-}
-
 /* Ripped from PurpleRC */
 static void
 color_response(GtkDialog *color_dialog, gint response, const char *data)
@@ -381,55 +364,28 @@ get_config_frame(PurplePlugin *plugin)
 	return ret;
 }
 
-static PidginPluginUiInfo ui_info =
+static PidginPluginInfo *
+plugin_query(GError **error)
 {
-	get_config_frame,
-	0,
+	const gchar * const authors[] = PLUGIN_AUTHORS;
 
-	/* padding */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
+	return pidgin_plugin_info_new(
+		"id",                   PLUGIN_ID,
+		"name",                 PLUGIN_NAME,
+		"version",              DISPLAY_VERSION,
+		"category",             PLUGIN_CATEGORY,
+		"summary",              PLUGIN_SUMMARY,
+		"description",          PLUGIN_DESCRIPTION,
+		"authors",              authors,
+		"website",              PURPLE_WEBSITE,
+		"abi-version",          PURPLE_ABI_VERSION,
+		"pidgin-config-frame",  get_config_frame,
+		NULL
+	);
+}
 
-static PurplePluginInfo info =
-{
-	PURPLE_PLUGIN_MAGIC,            /* Magic              */
-	PURPLE_MAJOR_VERSION,           /* Purple Major Version */
-	PURPLE_MINOR_VERSION,           /* Purple Minor Version */
-	PURPLE_PLUGIN_STANDARD,         /* plugin type        */
-	PIDGIN_PLUGIN_TYPE,         /* ui requirement     */
-	0,                            /* flags              */
-	NULL,                         /* dependencies       */
-	PURPLE_PRIORITY_DEFAULT,        /* priority           */
-
-	PLUGIN_ID,                    /* plugin id          */
-	PLUGIN_NAME,                  /* name               */
-	DISPLAY_VERSION,              /* version            */
-	PLUGIN_SUMMARY,               /* summary            */
-	PLUGIN_DESCRIPTION,           /* description        */
-	PLUGIN_AUTHOR,                /* author             */
-	PURPLE_WEBSITE,                 /* website            */
-
-	plugin_load,                  /* load               */
-	plugin_unload,                /* unload             */
-	NULL,                         /* destroy            */
-
-	&ui_info,                     /* ui_info            */
-	NULL,                         /* extra_info         */
-	NULL,                         /* prefs_info         */
-	NULL,                         /* actions            */
-
-	/* padding */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
-
-static void
-init_plugin(PurplePlugin *plugin)
+static gboolean
+plugin_load(PurplePlugin *plugin, GError **error)
 {
 	purple_prefs_add_none(PREF_PREFIX);
 
@@ -460,6 +416,20 @@ init_plugin(PurplePlugin *plugin)
 	purple_prefs_add_bool(PREF_SYSTEM_E, TRUE);
 	purple_prefs_add_bool(PREF_ERROR_E, TRUE);
 	purple_prefs_add_bool(PREF_NICK_E, TRUE);
+
+	purple_signal_connect(pidgin_conversations_get_handle(),
+					"displaying-im-msg", plugin,
+					PURPLE_CALLBACK(displaying_msg), NULL);
+	purple_signal_connect(pidgin_conversations_get_handle(),
+					"displaying-chat-msg", plugin,
+					PURPLE_CALLBACK(displaying_msg), NULL);
+	return TRUE;
 }
 
-PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info)
+static gboolean
+plugin_unload(PurplePlugin *plugin, GError **error)
+{
+	return TRUE;
+}
+
+PURPLE_PLUGIN_INIT(PLUGIN_STATIC_NAME, plugin_query, plugin_load, plugin_unload);
diff --git a/pidgin/plugins/gtk-signals-test.c b/pidgin/plugins/gtk-signals-test.c
--- a/pidgin/plugins/gtk-signals-test.c
+++ b/pidgin/plugins/gtk-signals-test.c
@@ -107,8 +107,30 @@ conversation_switched_cb(PurpleConversat
 /**************************************************************************
  * Plugin stuff
  **************************************************************************/
+static PidginPluginInfo *
+plugin_query(GError **error)
+{
+	const gchar * const authors[] = {
+		"Gary Kramlich <amc_grim at users.sf.net>",
+		NULL
+	};
+
+	return pidgin_plugin_info_new(
+		"id",           GTK_SIGNAL_TEST_PLUGIN_ID,
+		"name",         N_("GTK Signals Test"),
+		"version",      DISPLAY_VERSION,
+		"category",     N_("Testing"),
+		"summary",      N_("Test to see that all ui signals are working properly."),
+		"description",  N_("Test to see that all ui signals are working properly."),
+		"authors",      authors,
+		"website",      PURPLE_WEBSITE,
+		"abi-version",  PURPLE_ABI_VERSION,
+		NULL
+	);
+}
+
 static gboolean
-plugin_load(PurplePlugin *plugin)
+plugin_load(PurplePlugin *plugin, GError **error)
 {
 	void *accounts_handle = pidgin_accounts_get_handle();
 	void *blist_handle = pidgin_blist_get_handle();
@@ -142,50 +164,8 @@ plugin_load(PurplePlugin *plugin)
 }
 
 static gboolean
-plugin_unload(PurplePlugin *plugin) {
+plugin_unload(PurplePlugin *plugin, GError **error) {
 	return TRUE;
 }
 
-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       */
-
-	GTK_SIGNAL_TEST_PLUGIN_ID,                        /**< id             */
-	N_("GTK Signals Test"),                             /**< name           */
-	DISPLAY_VERSION,                                  /**< version        */
-	                                                  /**  summary        */
-	N_("Test to see that all ui signals are working properly."),
-	                                                  /**  description    */
-	N_("Test to see that all ui signals are working properly."),
-	"Gary Kramlich <amc_grim at users.sf.net>",              /**< author         */
-	PURPLE_WEBSITE,                                     /**< homepage       */
-
-	plugin_load,                                      /**< load           */
-	plugin_unload,                                    /**< unload         */
-	NULL,                                             /**< destroy        */
-
-	NULL,                                             /**< ui_info        */



More information about the Commits mailing list