/soc/2013/ankitkv/gobjectification: add1d5e2314c: Renamed action...

Ankit Vani a at nevitus.org
Wed Jul 31 17:41:46 EDT 2013


Changeset: add1d5e2314c1996570d85979de76a3f760686a0
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-01 03:11 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/add1d5e2314c

Description:

Renamed actions_add functions to add_action functions

diffstat:

 libpurple/plugins.c |  52 ++++++++++++++++++++++++++--------------------------
 libpurple/plugins.h |  24 ++++++++++++------------
 libpurple/prpl.c    |   6 +-----
 libpurple/prpl.h    |   9 +--------
 4 files changed, 40 insertions(+), 51 deletions(-)

diffs (174 lines):

diff --git a/libpurple/plugins.c b/libpurple/plugins.c
--- a/libpurple/plugins.c
+++ b/libpurple/plugins.c
@@ -122,6 +122,31 @@ purple_plugin_is_loaded(const GPluginPlu
 	return (gplugin_plugin_get_state(plugin) == GPLUGIN_PLUGIN_STATE_LOADED);
 }
 
+void
+purple_plugin_add_action(GPluginPlugin *plugin, const char* label,
+                         PurplePluginActionCallback callback)
+{
+	GPluginPluginInfo *plugin_info;
+	PurplePluginInfoPrivate *priv;
+	PurplePluginAction *action;
+
+	g_return_if_fail(plugin != NULL);
+	g_return_if_fail(label != NULL && callback != NULL);
+
+	plugin_info = gplugin_plugin_get_info(plugin);
+	priv = PURPLE_PLUGIN_INFO_GET_PRIVATE(plugin_info);
+
+	action = g_new0(PurplePluginAction, 1);
+
+	action->label    = g_strdup(label);
+	action->callback = callback;
+	action->plugin   = g_object_ref(plugin);
+
+	priv->actions = g_list_append(priv->actions, action);
+
+	g_object_unref(plugin_info);
+}
+
 /**************************************************************************
  * GObject code for PurplePluginInfo
  **************************************************************************/
@@ -269,7 +294,7 @@ purple_plugin_info_get_pref_frame_callba
 }
 
 /**************************************************************************
- * Plugin actions API
+ * PluginAction API
  **************************************************************************/
 static void
 purple_plugin_action_free(PurplePluginAction *action)
@@ -311,31 +336,6 @@ purple_plugin_action_get_type(void)
 	return type;
 }
 
-void
-purple_plugin_actions_add(GPluginPlugin *plugin, const char* label,
-                          PurplePluginActionCallback callback)
-{
-	GPluginPluginInfo *plugin_info;
-	PurplePluginInfoPrivate *priv;
-	PurplePluginAction *action;
-
-	g_return_if_fail(plugin != NULL);
-	g_return_if_fail(label != NULL && callback != NULL);
-
-	plugin_info = gplugin_plugin_get_info(plugin);
-	priv = PURPLE_PLUGIN_INFO_GET_PRIVATE(plugin_info);
-
-	action = g_new0(PurplePluginAction, 1);
-
-	action->label    = g_strdup(label);
-	action->callback = callback;
-	action->plugin   = g_object_ref(plugin);
-
-	priv->actions = g_list_append(priv->actions, action);
-
-	g_object_unref(plugin_info);
-}
-
 /**************************************************************************
  * Plugins API
  **************************************************************************/
diff --git a/libpurple/plugins.h b/libpurple/plugins.h
--- a/libpurple/plugins.h
+++ b/libpurple/plugins.h
@@ -124,6 +124,16 @@ gboolean purple_plugin_unload(GPluginPlu
  */
 gboolean purple_plugin_is_loaded(const GPluginPlugin *plugin);
 
+/**
+ * Adds a new action to a plugin.
+ *
+ * @param plugin   The plugin to add the action to.
+ * @param label    The description of the action to show to the user.
+ * @param callback The callback to call when the user selects this action.
+ */
+void purple_plugin_add_action(GPluginPlugin *plugin, const char* label,
+                              PurplePluginActionCallback callback);
+
 /*@}*/
 
 /**************************************************************************/
@@ -144,7 +154,7 @@ GType purple_plugin_info_get_type(void);
  * @constreturn A list of #PurplePluginAction instances corresponding to the
  *              actions a plugin can perform.
  *
- * @see purple_plugin_actions_add()
+ * @see purple_plugin_add_action()
  */
 GList *purple_plugin_info_get_actions(PurplePluginInfo *plugin_info);
 
@@ -170,7 +180,7 @@ purple_plugin_info_get_pref_frame_callba
 /*@}*/
 
 /**************************************************************************/
-/** @name Plugin actions API                                              */
+/** @name PluginAction API                                                */
 /**************************************************************************/
 /*@{*/
 
@@ -179,16 +189,6 @@ purple_plugin_info_get_pref_frame_callba
  */
 GType purple_plugin_action_get_type(void);
 
-/**
- * Adds a new action to a plugin.
- *
- * @param plugin   The plugin to add the action to.
- * @param label    The description of the action to show to the user.
- * @param callback The callback to call when the user selects this action.
- */
-void purple_plugin_actions_add(GPluginPlugin *plugin, const char* label,
-                               PurplePluginActionCallback callback);
-
 /*@}*/
 
 /**************************************************************************/
diff --git a/libpurple/prpl.c b/libpurple/prpl.c
--- a/libpurple/prpl.c
+++ b/libpurple/prpl.c
@@ -619,12 +619,8 @@ purple_prpl_got_media_caps(PurpleAccount
 #endif
 }
 
-/**************************************************************************
- * Protocol actions API
- **************************************************************************/
-
 void
-purple_protocol_actions_add(PurplePluginProtocolInfo *prpl_info,
+purple_protocol_add_action(PurplePluginProtocolInfo *prpl_info,
 		const char* label, PurpleProtocolActionCallback callback)
 {
 	PurpleProtocolAction *action;
diff --git a/libpurple/prpl.h b/libpurple/prpl.h
--- a/libpurple/prpl.h
+++ b/libpurple/prpl.h
@@ -967,13 +967,6 @@ gboolean purple_prpl_initiate_media(Purp
  */
 void purple_prpl_got_media_caps(PurpleAccount *account, const char *who);
 
-/*@}*/
-
-/**************************************************************************/
-/** @name Protocol actions API                                            */
-/**************************************************************************/
-/*@{*/
-
 /** TODO A sanity check is needed
  * Adds a new action to a protocol.
  *
@@ -981,7 +974,7 @@ void purple_prpl_got_media_caps(PurpleAc
  * @param label     The description of the action to show to the user.
  * @param callback  The callback to call when the user selects this action.
  */
-void purple_protocol_actions_add(PurplePluginProtocolInfo *prpl_info,
+void purple_protocol_add_action(PurplePluginProtocolInfo *prpl_info,
 		const char* label, PurpleProtocolActionCallback callback);
 
 /**************************************************************************/



More information about the Commits mailing list