pidgin/plugins/musicmessaging/musicmessaging.c

branch
soc.2013.gobjectification.plugins
changeset 36754
8250d6be8c02
parent 34881
badfcdf6b95d
child 36782
64936dae41a3
--- a/pidgin/plugins/musicmessaging/musicmessaging.c	Mon Sep 16 23:02:23 2013 +0530
+++ b/pidgin/plugins/musicmessaging/musicmessaging.c	Tue Sep 17 12:21:15 2013 +0530
@@ -259,58 +259,6 @@
 }
 
 static gboolean
-plugin_load(PurplePlugin *plugin) {
-	void *conv_list_handle;
-	GList *l;
-
-	PURPLE_DBUS_RETURN_FALSE_IF_DISABLED(plugin);
-
-    /* First, we have to register our four exported functions with the
-       main purple dbus loop.  Without this statement, the purple dbus
-       code wouldn't know about our functions. */
-    PURPLE_DBUS_REGISTER_BINDINGS(plugin);
-
-	/* Keep the plugin for reference (needed for notify's) */
-	plugin_pointer = plugin;
-
-	/* Add the button to all the current conversations */
-	for (l = purple_conversations_get_all(); l != NULL; l = l->next)
-		init_conversation((PurpleConversation *)l->data);
-
-	/* Listen for any new conversations */
-	conv_list_handle = purple_conversations_get_handle();
-
-	purple_signal_connect(conv_list_handle, "conversation-created",
-					plugin, PURPLE_CALLBACK(init_conversation), NULL);
-
-	/* Listen for conversations that are ending */
-	purple_signal_connect(conv_list_handle, "deleting-conversation",
-					plugin, PURPLE_CALLBACK(conv_destroyed), NULL);
-
-	/* Listen for sending/receiving messages to replace tags */
-	purple_signal_connect(conv_list_handle, "sending-im-msg",
-					plugin, PURPLE_CALLBACK(intercept_sent), NULL);
-	purple_signal_connect(conv_list_handle, "receiving-im-msg",
-					plugin, PURPLE_CALLBACK(intercept_received), NULL);
-
-	return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin) {
-	MMConversation *mmconv = NULL;
-
-	while (conversations != NULL)
-	{
-		mmconv = conversations->data;
-		conv_destroyed(mmconv->conv);
-	}
-	return TRUE;
-}
-
-
-
-static gboolean
 intercept_sent(PurpleAccount *account, const char *who, char **message, void* pData)
 {
 	if (message == NULL || *message == NULL || **message == '\0')
@@ -664,57 +612,83 @@
 	return ret;
 }
 
-static PidginPluginUiInfo ui_info =
-{
-	get_config_frame,
-	0, /* page_num (reserved) */
-
-	/* padding */
-	NULL,
-	NULL,
-	NULL,
-	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       */
+static PidginPluginInfo *
+plugin_query(GError **error) {
+	const gchar * const authors[] = {
+		"Christian Muise <christian.muise@gmail.com>",
+		NULL
+	};
 
-    MUSICMESSAGING_PLUGIN_ID,                            /**< id             */
-    "Music Messaging",	                                 /**< name           */
-    DISPLAY_VERSION,                                     /**< version        */
-    N_("Music Messaging Plugin for collaborative composition."),
-                                                         /**  summary        */
-    N_("The Music Messaging Plugin allows a number of users to simultaneously "
-       "work on a piece of music by editing a common score in real-time."),
-	                                                 /**  description    */
-    "Christian Muise <christian.muise@gmail.com>",       /**< author         */
-    PURPLE_WEBSITE,                                        /**< homepage       */
-    plugin_load,                                         /**< load           */
-    plugin_unload,                                       /**< unload         */
-    NULL,                                                /**< destroy        */
-    &ui_info,                                            /**< ui_info        */
-    NULL,                                                /**< extra_info     */
-    NULL,
-    NULL,
+	return pidgin_plugin_info_new(
+		"id",                   MUSICMESSAGING_PLUGIN_ID,
+		"name",                 N_("Music Messaging"),
+		"version",              DISPLAY_VERSION,
+		"category",             N_("Music"),
+		"summary",              N_("Music Messaging Plugin for collaborative "
+		                           "composition."),
+		"description",          N_("The Music Messaging Plugin allows a number "
+		                           "of users to simultaneously work on a piece "
+		                           "of music by editing a common score in "
+		                           "real-time."),
+		"authors",              authors,
+		"website",              PURPLE_WEBSITE,
+		"abi-version",          PURPLE_ABI_VERSION,
+		"pidgin-config-frame",  get_config_frame,
+		NULL
+	);
+}
 
-	/* padding */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
+static gboolean
+plugin_load(PurplePlugin *plugin, GError **error) {
+	void *conv_list_handle;
+	GList *l;
 
-static void
-init_plugin(PurplePlugin *plugin) {
+	PURPLE_DBUS_RETURN_FALSE_IF_DISABLED(plugin);
+
 	purple_prefs_add_none("/plugins/gtk/musicmessaging");
 	purple_prefs_add_string("/plugins/gtk/musicmessaging/editor_path", "/usr/bin/gscore");
+
+    /* First, we have to register our four exported functions with the
+       main purple dbus loop.  Without this statement, the purple dbus
+       code wouldn't know about our functions. */
+    PURPLE_DBUS_REGISTER_BINDINGS(plugin);
+
+	/* Keep the plugin for reference (needed for notify's) */
+	plugin_pointer = plugin;
+
+	/* Add the button to all the current conversations */
+	for (l = purple_conversations_get_all(); l != NULL; l = l->next)
+		init_conversation((PurpleConversation *)l->data);
+
+	/* Listen for any new conversations */
+	conv_list_handle = purple_conversations_get_handle();
+
+	purple_signal_connect(conv_list_handle, "conversation-created",
+					plugin, PURPLE_CALLBACK(init_conversation), NULL);
+
+	/* Listen for conversations that are ending */
+	purple_signal_connect(conv_list_handle, "deleting-conversation",
+					plugin, PURPLE_CALLBACK(conv_destroyed), NULL);
+
+	/* Listen for sending/receiving messages to replace tags */
+	purple_signal_connect(conv_list_handle, "sending-im-msg",
+					plugin, PURPLE_CALLBACK(intercept_sent), NULL);
+	purple_signal_connect(conv_list_handle, "receiving-im-msg",
+					plugin, PURPLE_CALLBACK(intercept_received), NULL);
+
+	return TRUE;
 }
 
-PURPLE_INIT_PLUGIN(musicmessaging, init_plugin, info);
+static gboolean
+plugin_unload(PurplePlugin *plugin, GError **error) {
+	MMConversation *mmconv = NULL;
+
+	while (conversations != NULL)
+	{
+		mmconv = conversations->data;
+		conv_destroyed(mmconv->conv);
+	}
+	return TRUE;
+}
+
+PURPLE_PLUGIN_INIT(musicmessaging, plugin_query, plugin_load, plugin_unload);

mercurial