/soc/2013/ankitkv/gobjectification: 1ebd4a8f2b4a: Removed purple...

Ankit Vani a at nevitus.org
Sun Aug 11 10:43:53 EDT 2013


Changeset: 1ebd4a8f2b4a8960396e90473c4598a86932323a
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-11 20:13 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/1ebd4a8f2b4a

Description:

Removed purple_plugin_is_loadable() and purple_plugin_get_error() from the API

diffstat:

 libpurple/plugins.c |  58 ++++++++++------------------------------------------
 libpurple/plugins.h |  26 -----------------------
 2 files changed, 12 insertions(+), 72 deletions(-)

diffs (140 lines):

diff --git a/libpurple/plugins.c b/libpurple/plugins.c
--- a/libpurple/plugins.c
+++ b/libpurple/plugins.c
@@ -77,22 +77,21 @@ purple_plugin_load(PurplePlugin *plugin,
 {
 #ifdef PURPLE_PLUGINS
 	GError *err = NULL;
+	PurplePluginInfoPrivate *priv;
 
 	g_return_val_if_fail(plugin != NULL, FALSE);
 
 	if (purple_plugin_is_loaded(plugin))
 		return TRUE;
 
-	if (!purple_plugin_is_loadable(plugin)) {
+	priv = PURPLE_PLUGIN_INFO_GET_PRIVATE(purple_plugin_get_info(plugin));
+
+	if (!priv->loadable) {
 		purple_debug_error("plugins", "Failed to load plugin %s: %s",
-				purple_plugin_get_filename(plugin),
-				purple_plugin_get_error(plugin));
+		                   purple_plugin_get_filename(plugin), priv->error);
 
-		if (error) {
-			*error = g_error_new(PURPLE_PLUGINS_DOMAIN, 0,
-			                     "Plugin is not loadable: %s",
-			                     purple_plugin_get_error(plugin));
-		}
+		g_set_error(error, PURPLE_PLUGINS_DOMAIN, 0,
+		            "Plugin is not loadable: %s", priv->error);
 
 		return FALSE;
 	}
@@ -118,7 +117,8 @@ purple_plugin_load(PurplePlugin *plugin,
 	return TRUE;
 
 #else
-	return TRUE;
+	g_set_error(error, PURPLE_PLUGINS_DOMAIN, 0, "Plugin support is disabled.");
+	return FALSE;
 #endif /* PURPLE_PLUGINS */
 }
 
@@ -170,7 +170,8 @@ purple_plugin_unload(PurplePlugin *plugi
 	return TRUE;
 
 #else
-	return TRUE;
+	g_set_error(error, PURPLE_PLUGINS_DOMAIN, 0, "Plugin support is disabled.");
+	return FALSE;
 #endif /* PURPLE_PLUGINS */
 }
 
@@ -275,41 +276,6 @@ purple_plugin_is_internal(const PurplePl
 #endif
 }
 
-gboolean
-purple_plugin_is_loadable(const PurplePlugin *plugin)
-{
-	PurplePluginInfoPrivate *priv;
-
-	g_return_val_if_fail(plugin != NULL, FALSE);
-
-	priv = PURPLE_PLUGIN_INFO_GET_PRIVATE(purple_plugin_get_info(plugin));
-
-	if (priv)
-		return priv->loadable;
-	else
-		return FALSE;
-}
-
-const gchar *
-purple_plugin_get_error(const PurplePlugin *plugin)
-{
-#ifdef PURPLE_PLUGINS
-	PurplePluginInfoPrivate *priv;
-
-	g_return_val_if_fail(plugin != NULL, NULL);
-
-	priv = PURPLE_PLUGIN_INFO_GET_PRIVATE(purple_plugin_get_info(plugin));
-
-	if (priv)
-		return priv->error;
-	else
-		return _("This plugin does not return a PurplePluginInfo.");
-
-#else
-	return _("Plugin support is disabled.");
-#endif
-}
-
 GSList *
 purple_plugin_get_dependent_plugins(const PurplePlugin *plugin)
 {
@@ -976,7 +942,7 @@ purple_plugins_init(void)
 }
 
 void
-purple_plugins_uninit(void) 
+purple_plugins_uninit(void)
 {
 	void *handle = purple_plugins_get_handle();
 
diff --git a/libpurple/plugins.h b/libpurple/plugins.h
--- a/libpurple/plugins.h
+++ b/libpurple/plugins.h
@@ -313,32 +313,6 @@ void purple_plugin_add_interface(PurpleP
 gboolean purple_plugin_is_internal(const PurplePlugin *plugin);
 
 /**
- * Returns whether or not a plugin is loadable.
- *
- * If this returns @c FALSE, the plugin is guaranteed to not
- * be loadable. However, a return value of @c TRUE does not
- * guarantee the plugin is loadable.
- * An error is set if the plugin is not loadable.
- *
- * @param plugin The plugin.
- *
- * @return @c TRUE if the plugin may be loadable, @c FALSE if the plugin is not
- *         loadable.
- *
- * @see purple_plugin_get_error()
- */
-gboolean purple_plugin_is_loadable(const PurplePlugin *plugin);
-
-/**
- * If a plugin is not loadable, this returns the reason.
- *
- * @param plugin The plugin.
- *
- * @return The reason why the plugin is not loadable.
- */
-const gchar *purple_plugin_get_error(const PurplePlugin *plugin);
-
-/**
  * Returns a list of plugins that depend on a particular plugin.
  *
  * @param plugin The plugin whose dependent plugins are returned.



More information about the Commits mailing list