/soc/2013/ankitkv/gobjectification: 28078f07a32c: Refactored fil...

Ankit Vani a at nevitus.org
Tue Sep 17 11:35:44 EDT 2013


Changeset: 28078f07a32c7ac3b2016693e3469b388b1a4b8a
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-17 20:32 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/28078f07a32c

Description:

Refactored filectl to use the new plugin API

diffstat:

 libpurple/plugins/filectl.c |  62 ++++++++++++++++++--------------------------
 1 files changed, 25 insertions(+), 37 deletions(-)

diffs (83 lines):

diff --git a/libpurple/plugins/filectl.c b/libpurple/plugins/filectl.c
--- a/libpurple/plugins/filectl.c
+++ b/libpurple/plugins/filectl.c
@@ -216,8 +216,30 @@ getarg(char *line, int which, int remain
  *  EXPORTED FUNCTIONS
  */
 
+static PurplePluginInfo *
+plugin_query(GError **error)
+{
+	const gchar * const authors[] = {
+		"Eric Warmenhoven <eric at warmenhoven.org>",
+		NULL
+	};
+
+	return purple_plugin_info_new(
+		"id",           FILECTL_PLUGIN_ID,
+		"name",         N_("File Control"),
+		"version",      DISPLAY_VERSION,
+		"category",     N_("Utility"),
+		"summary",      N_("Allows control by entering commands in a file."),
+		"description",  N_("Allows control by entering commands in a file."),
+		"authors",      authors,
+		"website",      PURPLE_WEBSITE,
+		"abi-version",  PURPLE_ABI_VERSION,
+		NULL
+	);
+}
+
 static gboolean
-plugin_load(PurplePlugin *plugin)
+plugin_load(PurplePlugin *plugin, GError **error)
 {
 	init_file();
 	check = purple_timeout_add_seconds(5, (GSourceFunc)check_file, NULL);
@@ -226,45 +248,11 @@ plugin_load(PurplePlugin *plugin)
 }
 
 static gboolean
-plugin_unload(PurplePlugin *plugin)
+plugin_unload(PurplePlugin *plugin, GError **error)
 {
 	purple_timeout_remove(check);
 
 	return TRUE;
 }
 
-static PurplePluginInfo info =
-{
-	PURPLE_PLUGIN_MAGIC,
-	PURPLE_MAJOR_VERSION,
-	PURPLE_MINOR_VERSION,
-	PURPLE_PLUGIN_STANDARD,                             /**< type           */
-	NULL,                                             /**< ui_requirement */
-	0,                                                /**< flags          */
-	NULL,                                             /**< dependencies   */
-	PURPLE_PRIORITY_DEFAULT,                            /**< priority       */
-
-	FILECTL_PLUGIN_ID,                                /**< id             */
-	N_("File Control"),                               /**< name           */
-	DISPLAY_VERSION,                                  /**< version        */
-	                                                  /**  summary        */
-	N_("Allows control by entering commands in a file."),
-	                                                  /**  description    */
-	N_("Allows control by entering commands in a file."),
-	"Eric Warmenhoven <eric at warmenhoven.org>",        /**< author         */
-	PURPLE_WEBSITE,                                          /**< homepage       */
-
-	plugin_load,                                      /**< load           */
-	plugin_unload,                                    /**< unload         */
-	NULL,                                             /**< destroy        */
-
-	NULL,                                             /**< ui_info        */
-	NULL                                              /**< extra_info     */
-};
-
-static void
-init_plugin(PurplePlugin *plugin)
-{
-}
-
-PURPLE_INIT_PLUGIN(filectl, init_plugin, info)
+PURPLE_PLUGIN_INIT(filectl, plugin_query, plugin_load, plugin_unload);



More information about the Commits mailing list