[gnome-software] Add functionality which enables us to find symbols in enabled plugins
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add functionality which enables us to find symbols in enabled plugins
- Date: Tue, 9 Feb 2016 17:22:06 +0000 (UTC)
commit c06a5868e5e45108c2682b0b8aa33bd9a437767e
Author: Richard Hughes <richard hughsie com>
Date: Tue Feb 9 10:51:48 2016 +0000
Add functionality which enables us to find symbols in enabled plugins
This is a more general version of a patch from Robert Ancell, many thanks.
src/gs-plugin-loader.c | 27 +++++++++++++++++++++++++++
src/gs-plugin-loader.h | 2 ++
2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index a504be3..9149491 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -3695,6 +3695,33 @@ gs_plugin_loader_offline_update_finish (GsPluginLoader *plugin_loader,
return g_task_propagate_boolean (G_TASK (res), error);
}
+/**
+ * gs_plugin_loader_get_plugin_supported:
+ *
+ * This function returns TRUE if the symbol is found in any enabled plugin.
+ */
+gboolean
+gs_plugin_loader_get_plugin_supported (GsPluginLoader *plugin_loader,
+ const gchar *function_name)
+{
+ GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
+ gboolean ret;
+ gpointer dummy;
+ guint i;
+
+ for (i = 0; i < priv->plugins->len; i++) {
+ GsPlugin *plugin = g_ptr_array_index (priv->plugins, i);
+ if (!plugin->enabled)
+ continue;
+ ret = g_module_symbol (plugin->module,
+ function_name,
+ (gpointer *) &dummy);
+ if (ret)
+ return TRUE;
+ }
+ return FALSE;
+}
+
/******************************************************************************/
/* vim: set noexpandtab: */
diff --git a/src/gs-plugin-loader.h b/src/gs-plugin-loader.h
index 8dff2b3..48ede73 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -223,6 +223,8 @@ GsApp *gs_plugin_loader_dedupe (GsPluginLoader
*plugin_loader,
GsApp *app);
void gs_plugin_loader_set_network_status (GsPluginLoader *plugin_loader,
gboolean online);
+gboolean gs_plugin_loader_get_plugin_supported (GsPluginLoader *plugin_loader,
+ const gchar *plugin_func);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]