/soc/2013/ankitkv/gobjectification: 5c2bc13927b0: Added wrappers...

Ankit Vani a at nevitus.org
Sat Aug 3 08:16:42 EDT 2013


Changeset: 5c2bc13927b004590ff293b1d855c9e4891b6338
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-03 16:36 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/5c2bc13927b0

Description:

Added wrappers for some gplugin functions

diffstat:

 libpurple/plugins.c |  111 +++++++++++++++++++++++++++++++++++++++++++--------
 libpurple/plugins.h |   62 ++++++++++++++++++++++------
 2 files changed, 140 insertions(+), 33 deletions(-)

diffs (truncated from 316 to 300 lines):

diff --git a/libpurple/plugins.c b/libpurple/plugins.c
--- a/libpurple/plugins.c
+++ b/libpurple/plugins.c
@@ -139,6 +139,18 @@ purple_plugin_is_loaded(const PurplePlug
 	return (gplugin_plugin_get_state(plugin) == GPLUGIN_PLUGIN_STATE_LOADED);
 }
 
+const gchar *
+purple_plugin_get_filename(const PurplePlugin *plugin)
+{
+	return gplugin_plugin_get_filename(plugin);
+}
+
+PurplePluginInfo *
+purple_plugin_get_info(const PurplePlugin *plugin)
+{
+	return PURPLE_PLUGIN_INFO(gplugin_plugin_get_info(plugin));
+}
+
 void
 purple_plugin_add_action(PurplePlugin *plugin, const char* label,
                          PurplePluginActionCallback callback)
@@ -334,8 +346,56 @@ purple_plugin_info_get_type(void)
 	return type;
 }
 
+const gchar *
+purple_plugin_info_get_id(const PurplePluginInfo *info)
+{
+	return gplugin_plugin_info_get_id(GPLUGIN_PLUGIN_INFO(info));
+}
+
+const gchar *
+purple_plugin_info_get_name(const PurplePluginInfo *info)
+{
+	return gplugin_plugin_info_get_name(GPLUGIN_PLUGIN_INFO(info));
+}
+
+const gchar *
+purple_plugin_info_get_version(const PurplePluginInfo *info)
+{
+	return gplugin_plugin_info_get_version(GPLUGIN_PLUGIN_INFO(info));
+}
+
+const gchar *
+purple_plugin_info_get_summary(const PurplePluginInfo *info)
+{
+	return gplugin_plugin_info_get_summary(GPLUGIN_PLUGIN_INFO(info));
+}
+
+const gchar *
+purple_plugin_info_get_description(const PurplePluginInfo *info)
+{
+	return gplugin_plugin_info_get_description(GPLUGIN_PLUGIN_INFO(info));
+}
+
+const gchar *
+purple_plugin_info_get_author(const PurplePluginInfo *info)
+{
+	return gplugin_plugin_info_get_author(GPLUGIN_PLUGIN_INFO(info));
+}
+
+const gchar *
+purple_plugin_info_get_website(const PurplePluginInfo *info)
+{
+	return gplugin_plugin_info_get_website(GPLUGIN_PLUGIN_INFO(info));
+}
+
+guint32
+purple_plugin_info_get_abi_version(const PurplePluginInfo *info)
+{
+	return gplugin_plugin_info_get_abi_version(GPLUGIN_PLUGIN_INFO(info));
+}
+
 GList *
-purple_plugin_info_get_actions(PurplePluginInfo *plugin_info)
+purple_plugin_info_get_actions(const PurplePluginInfo *plugin_info)
 {
 	PurplePluginInfoPrivate *priv = PURPLE_PLUGIN_INFO_GET_PRIVATE(plugin_info);
 
@@ -345,7 +405,7 @@ purple_plugin_info_get_actions(PurplePlu
 }
 
 gboolean
-purple_plugin_info_is_loadable(PurplePluginInfo *plugin_info)
+purple_plugin_info_is_loadable(const PurplePluginInfo *plugin_info)
 {
 	PurplePluginInfoPrivate *priv = PURPLE_PLUGIN_INFO_GET_PRIVATE(plugin_info);
 
@@ -355,7 +415,7 @@ purple_plugin_info_is_loadable(PurplePlu
 }
 
 gchar *
-purple_plugin_info_get_error(PurplePluginInfo *plugin_info)
+purple_plugin_info_get_error(const PurplePluginInfo *plugin_info)
 {
 	PurplePluginInfoPrivate *priv = PURPLE_PLUGIN_INFO_GET_PRIVATE(plugin_info);
 
@@ -364,6 +424,12 @@ purple_plugin_info_get_error(PurplePlugi
 	return priv->error;
 }
 
+GSList *
+purple_plugin_info_get_dependencies(const PurplePluginInfo *info)
+{
+	return gplugin_plugin_info_get_dependencies(GPLUGIN_PLUGIN_INFO(info));
+}
+
 void
 purple_plugin_info_set_pref_frame_callback(PurplePluginInfo *plugin_info,
 		PurplePluginPrefFrameCallback callback)
@@ -376,7 +442,7 @@ purple_plugin_info_set_pref_frame_callba
 }
 
 PurplePluginPrefFrameCallback
-purple_plugin_info_get_pref_frame_callback(PurplePluginInfo *plugin_info)
+purple_plugin_info_get_pref_frame_callback(const PurplePluginInfo *plugin_info)
 {
 	PurplePluginInfoPrivate *priv = PURPLE_PLUGIN_INFO_GET_PRIVATE(plugin_info);
 
@@ -441,7 +507,7 @@ purple_plugins_find_all(void)
 	for (l = ids; l; l = l->next) {
 		plugins = gplugin_plugin_manager_find_plugins(l->data);
 		for (ll = plugins; ll; ll = ll->next)
-			ret = g_list_append(ret, g_object_ref(ll->data));
+			ret = g_list_append(ret, ll->data);
 
 		gplugin_plugin_manager_free_plugin_list(plugins);
 	}
@@ -450,23 +516,30 @@ purple_plugins_find_all(void)
 	return ret;
 }
 
-void
-purple_plugins_free_found_list(GList *plugins)
-{
-	GList *l;
-
-	for (l = plugins; l != NULL; l = l->next)
-		g_object_unref(l->data);
-
-	g_list_free(plugins);
-}
-
 GList *
 purple_plugins_get_loaded(void)
 {
 	return loaded_plugins;
 }
 
+void
+purple_plugins_add_search_path(const gchar *path)
+{
+	gplugin_plugin_manager_append_path(path);
+}
+
+void
+purple_plugins_refresh(void)
+{
+	gplugin_plugin_manager_refresh();
+}
+
+PurplePlugin *
+purple_plugins_find_plugin(const gchar *id)
+{
+	return gplugin_plugin_manager_find_plugin(id);
+}
+
 PurplePlugin *
 purple_plugins_find_by_filename(const char *filename)
 {
@@ -477,11 +550,11 @@ purple_plugins_find_by_filename(const ch
 		PurplePlugin *plugin = PURPLE_PLUGIN(l->data);
 
 		if (purple_strequal(gplugin_plugin_get_filename(plugin), filename)) {
-			purple_plugins_free_found_list(plugins);
-			return g_object_ref(plugin);
+			g_list_free(plugins);
+			return plugin;
 		}
 	}
-	purple_plugins_free_found_list(plugins);
+	g_list_free(plugins);
 
 	return NULL;
 }
diff --git a/libpurple/plugins.h b/libpurple/plugins.h
--- a/libpurple/plugins.h
+++ b/libpurple/plugins.h
@@ -150,6 +150,12 @@ gboolean purple_plugin_unload(PurplePlug
  */
 gboolean purple_plugin_is_loaded(const PurplePlugin *plugin);
 
+/* TODO */
+const gchar *purple_plugin_get_filename(const PurplePlugin *plugin);
+
+/* TODO */
+PurplePluginInfo *purple_plugin_get_info(const PurplePlugin *plugin);
+
 /**
  * Adds a new action to a plugin.
  *
@@ -182,6 +188,30 @@ void purple_plugin_disable(PurplePlugin 
  */
 GType purple_plugin_info_get_type(void);
 
+/* TODO */
+const gchar *purple_plugin_info_get_id(const PurplePluginInfo *info);
+
+/* TODO */
+const gchar *purple_plugin_info_get_name(const PurplePluginInfo *info);
+
+/* TODO */
+const gchar *purple_plugin_info_get_version(const PurplePluginInfo *info);
+
+/* TODO */
+const gchar *purple_plugin_info_get_summary(const PurplePluginInfo *info);
+
+/* TODO */
+const gchar *purple_plugin_info_get_description(const PurplePluginInfo *info);
+
+/* TODO */
+const gchar *purple_plugin_info_get_author(const PurplePluginInfo *info);
+
+/* TODO */
+const gchar *purple_plugin_info_get_website(const PurplePluginInfo *info);
+
+/* TODO */
+guint32 purple_plugin_info_get_abi_version(const PurplePluginInfo *info);
+
 /**
  * Returns a list of actions that a plugin can perform.
  *
@@ -192,7 +222,7 @@ GType purple_plugin_info_get_type(void);
  *
  * @see purple_plugin_add_action()
  */
-GList *purple_plugin_info_get_actions(PurplePluginInfo *plugin_info);
+GList *purple_plugin_info_get_actions(const PurplePluginInfo *plugin_info);
 
 /**
  * Returns whether or not a plugin is loadable.
@@ -209,7 +239,7 @@ GList *purple_plugin_info_get_actions(Pu
  *
  * @see purple_plugin_info_get_error()
  */
-gboolean purple_plugin_info_is_loadable(PurplePluginInfo *plugin_info);
+gboolean purple_plugin_info_is_loadable(const PurplePluginInfo *plugin_info);
 
 /**
  * If a plugin is not loadable, this returns the reason.
@@ -218,7 +248,10 @@ gboolean purple_plugin_info_is_loadable(
  *
  * @return The reason why the plugin is not loadable.
  */
-gchar *purple_plugin_info_get_error(PurplePluginInfo *plugin_info);
+gchar *purple_plugin_info_get_error(const PurplePluginInfo *plugin_info);
+
+/* TODO */
+GSList *purple_plugin_info_get_dependencies(const PurplePluginInfo *info);
 
 /**
  * Sets a callback to be invoked to retrieve the preferences frame for a plugin.
@@ -237,7 +270,7 @@ void purple_plugin_info_set_pref_frame_c
  * @return The callback that returns the preferences frame.
  */
 PurplePluginPrefFrameCallback
-purple_plugin_info_get_pref_frame_callback(PurplePluginInfo *plugin_info);
+purple_plugin_info_get_pref_frame_callback(const PurplePluginInfo *plugin_info);
 
 /*@}*/
 
@@ -260,32 +293,33 @@ GType purple_plugin_action_get_type(void
 
 /**
  * Returns a list of all plugins, whether loaded or not.
- * Use purple_plugins_free_found_list() to free this list when done with it.
  *
- * @return A list of all referenced plugins.
+ * @return A list of all plugins.
  */
 GList *purple_plugins_find_all(void);
 
 /**
- * Frees a list of referenced plugins by unreferencing them first.
- *
- * @param plugins The list of referenced plugins.
- */
-void purple_plugins_free_found_list(GList *plugins);
-
-/**
  * Returns a list of all loaded plugins.
  *
  * @constreturn A list of all loaded plugins.
  */
 GList *purple_plugins_get_loaded(void);
 
+/* TODO */
+void purple_plugins_add_search_path(const gchar *path);
+



More information about the Commits mailing list