/soc/2013/ankitkv/gobjectification: f50c47e1c469: Disable all GP...

Ankit Vani a at nevitus.org
Sat Aug 3 15:13:46 EDT 2013


Changeset: f50c47e1c469f63a87767a31a79feea81890accb
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-04 00:43 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/f50c47e1c469

Description:

Disable all GPlugin stuff when PURPLE_PLUGINS is not defined

diffstat:

 libpurple/plugins.c |  128 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 libpurple/plugins.h |   31 ++++++++++++
 2 files changed, 155 insertions(+), 4 deletions(-)

diffs (truncated from 498 to 300 lines):

diff --git a/libpurple/plugins.c b/libpurple/plugins.c
--- a/libpurple/plugins.c
+++ b/libpurple/plugins.c
@@ -55,13 +55,15 @@ enum
 	PROP_LAST
 };
 
-static GPluginPluginInfoClass *parent_class;
+static GObjectClass *parent_class;
 
 /**************************************************************************
  * Globals
  **************************************************************************/
 static GList *loaded_plugins     = NULL;
+#ifdef PURPLE_PLUGINS
 static GList *plugins_to_disable = NULL;
+#endif
 
 /**************************************************************************
  * Plugin API
@@ -69,6 +71,7 @@ static GList *plugins_to_disable = NULL;
 gboolean
 purple_plugin_load(PurplePlugin *plugin)
 {
+#ifdef PURPLE_PLUGINS
 	GError *error = NULL;
 
 	g_return_val_if_fail(plugin != NULL, FALSE);
@@ -98,11 +101,16 @@ purple_plugin_load(PurplePlugin *plugin)
 	purple_signal_emit(purple_plugins_get_handle(), "plugin-load", plugin);
 
 	return TRUE;
+
+#else
+	return TRUE;
+#endif /* PURPLE_PLUGINS */
 }
 
 gboolean
 purple_plugin_unload(PurplePlugin *plugin)
 {
+#ifdef PURPLE_PLUGINS
 	GError *error = NULL;
 
 	g_return_val_if_fail(plugin != NULL, FALSE);
@@ -132,27 +140,42 @@ purple_plugin_unload(PurplePlugin *plugi
 	purple_prefs_disconnect_by_handle(plugin);
 
 	return TRUE;
+
+#else
+	return TRUE;
+#endif /* PURPLE_PLUGINS */
 }
 
 gboolean
 purple_plugin_is_loaded(const PurplePlugin *plugin)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_val_if_fail(plugin != NULL, FALSE);
 
 	return (gplugin_plugin_get_state(plugin) == GPLUGIN_PLUGIN_STATE_LOADED);
+
+#else
+	return FALSE;
+#endif
 }
 
 const gchar *
 purple_plugin_get_filename(const PurplePlugin *plugin)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_val_if_fail(plugin != NULL, NULL);
 
 	return gplugin_plugin_get_filename(plugin);
+
+#else
+	return NULL;
+#endif
 }
 
 PurplePluginInfo *
 purple_plugin_get_info(const PurplePlugin *plugin)
 {
+#ifdef PURPLE_PLUGINS
 	GPluginPluginInfo *info;
 
 	g_return_val_if_fail(plugin != NULL, NULL);
@@ -161,15 +184,21 @@ purple_plugin_get_info(const PurplePlugi
 	g_object_unref(info);
 
 	return PURPLE_PLUGIN_INFO(info);
+
+#else
+	return NULL;
+#endif
 }
 
 void
 purple_plugin_disable(PurplePlugin *plugin)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_if_fail(plugin != NULL);
 
 	if (!g_list_find(plugins_to_disable, plugin))
 		plugins_to_disable = g_list_prepend(plugins_to_disable, plugin);
+#endif
 }
 
 void
@@ -244,8 +273,13 @@ purple_plugin_get_error(const PurplePlug
 GSList *
 purple_plugin_get_dependent_plugins(const PurplePlugin *plugin)
 {
+#ifdef PURPLE_PLUGINS
 #warning TODO: Implement this when GPlugin can return dependent plugins.
 	return NULL;
+
+#else
+	return NULL;
+#endif
 }
 
 /**************************************************************************
@@ -311,7 +345,7 @@ purple_plugin_info_constructed(GObject *
 	const char *id = purple_plugin_info_get_id(info);
 	guint32 abi_version;
 
-	G_OBJECT_CLASS(parent_class)->constructed(object);
+	parent_class->constructed(object);
 
 	priv->loadable = TRUE;
 
@@ -363,7 +397,7 @@ purple_plugin_info_finalize(GObject *obj
 	g_free(priv->ui_requirement);
 	g_free(priv->error);
 
-	G_OBJECT_CLASS(parent_class)->finalize(object);
+	parent_class->finalize(object);
 }
 
 /* Class initializer function */
@@ -416,7 +450,12 @@ purple_plugin_info_get_type(void)
 			.instance_size = sizeof(PurplePluginInfo),
 		};
 
-		type = g_type_register_static(GPLUGIN_TYPE_PLUGIN_INFO,
+		type = g_type_register_static(
+#ifdef PURPLE_PLUGINS
+		                              GPLUGIN_TYPE_PLUGIN_INFO,
+#else
+		                              G_TYPE_OBJECT,
+#endif
 		                              "PurplePluginInfo", &info, 0);
 	}
 
@@ -426,25 +465,40 @@ purple_plugin_info_get_type(void)
 const gchar *
 purple_plugin_info_get_id(const PurplePluginInfo *info)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_val_if_fail(info != NULL, NULL);
 
 	return gplugin_plugin_info_get_id(GPLUGIN_PLUGIN_INFO(info));
+
+#else
+	return NULL;
+#endif
 }
 
 const gchar *
 purple_plugin_info_get_name(const PurplePluginInfo *info)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_val_if_fail(info != NULL, NULL);
 
 	return gplugin_plugin_info_get_name(GPLUGIN_PLUGIN_INFO(info));
+
+#else
+	return NULL;
+#endif
 }
 
 const gchar *
 purple_plugin_info_get_version(const PurplePluginInfo *info)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_val_if_fail(info != NULL, NULL);
 
 	return gplugin_plugin_info_get_version(GPLUGIN_PLUGIN_INFO(info));
+
+#else
+	return NULL;
+#endif
 }
 
 const gchar *
@@ -460,65 +514,105 @@ purple_plugin_info_get_category(const Pu
 const gchar *
 purple_plugin_info_get_summary(const PurplePluginInfo *info)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_val_if_fail(info != NULL, NULL);
 
 	return gplugin_plugin_info_get_summary(GPLUGIN_PLUGIN_INFO(info));
+
+#else
+	return NULL;
+#endif
 }
 
 const gchar *
 purple_plugin_info_get_description(const PurplePluginInfo *info)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_val_if_fail(info != NULL, NULL);
 
 	return gplugin_plugin_info_get_description(GPLUGIN_PLUGIN_INFO(info));
+
+#else
+	return NULL;
+#endif
 }
 
 const gchar *
 purple_plugin_info_get_author(const PurplePluginInfo *info)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_val_if_fail(info != NULL, NULL);
 
 	return gplugin_plugin_info_get_author(GPLUGIN_PLUGIN_INFO(info));
+
+#else
+	return NULL;
+#endif
 }
 
 const gchar *
 purple_plugin_info_get_website(const PurplePluginInfo *info)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_val_if_fail(info != NULL, NULL);
 
 	return gplugin_plugin_info_get_website(GPLUGIN_PLUGIN_INFO(info));
+
+#else
+	return NULL;
+#endif
 }
 
 const gchar *
 purple_plugin_info_get_icon(const PurplePluginInfo *info)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_val_if_fail(info != NULL, NULL);
 
 	return gplugin_plugin_info_get_icon(GPLUGIN_PLUGIN_INFO(info));
+
+#else
+	return NULL;
+#endif
 }
 
 const gchar *
 purple_plugin_info_get_license(const PurplePluginInfo *info)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_val_if_fail(info != NULL, NULL);
 
 	return gplugin_plugin_info_get_license(GPLUGIN_PLUGIN_INFO(info));
+
+#else
+	return NULL;
+#endif
 }
 
 guint32
 purple_plugin_info_get_abi_version(const PurplePluginInfo *info)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_val_if_fail(info != NULL, 0);
 
 	return gplugin_plugin_info_get_abi_version(GPLUGIN_PLUGIN_INFO(info));
+
+#else
+	return 0;
+#endif
 }
 
 GSList *
 purple_plugin_info_get_dependencies(const PurplePluginInfo *info)
 {
+#ifdef PURPLE_PLUGINS
 	g_return_val_if_fail(info != NULL, NULL);
 
 	return gplugin_plugin_info_get_dependencies(GPLUGIN_PLUGIN_INFO(info));
+
+#else
+	return NULL;
+#endif



More information about the Commits mailing list