[gnome-software: 65/72] gs-plugin-loader: Expose gs_plugin_loader_get_plugins()




commit 50ada02529202e6da67b454b7811dcd0283bee33
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Nov 24 15:47:53 2021 +0000

    gs-plugin-loader: Expose gs_plugin_loader_get_plugins()
    
    This will need to be used from `GsPluginJobRefine`.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1472

 lib/gs-plugin-loader.c | 23 +++++++++++++++++++++++
 lib/gs-plugin-loader.h |  2 ++
 2 files changed, 25 insertions(+)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 212fa81ce..0cc6e319e 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -4245,6 +4245,29 @@ gs_plugin_loader_get_plugin_supported (GsPluginLoader *plugin_loader,
        return FALSE;
 }
 
+/**
+ * gs_plugin_loader_get_plugins:
+ * @plugin_loader: a #GsPluginLoader
+ *
+ * Get the set of currently loaded plugins.
+ *
+ * This includes disabled plugins, which should be checked for using
+ * gs_plugin_get_enabled().
+ *
+ * This is intended to be used by internal gnome-software code. Plugin and UI
+ * code should typically use #GsPluginJob to run operations.
+ *
+ * Returns: (transfer none) (element-type GsPlugin): list of #GsPlugins
+ * Since: 42
+ */
+GPtrArray *
+gs_plugin_loader_get_plugins (GsPluginLoader *plugin_loader)
+{
+       g_return_val_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader), NULL);
+
+       return plugin_loader->plugins;
+}
+
 static void app_create_cb (GObject      *source_object,
                            GAsyncResult *result,
                            gpointer      user_data);
diff --git a/lib/gs-plugin-loader.h b/lib/gs-plugin-loader.h
index 15dc3ea06..55fe61a02 100644
--- a/lib/gs-plugin-loader.h
+++ b/lib/gs-plugin-loader.h
@@ -65,6 +65,8 @@ gboolean       gs_plugin_loader_get_network_metered   (GsPluginLoader *plugin_loader);
 gboolean        gs_plugin_loader_get_plugin_supported  (GsPluginLoader *plugin_loader,
                                                         const gchar    *function_name);
 
+GPtrArray      *gs_plugin_loader_get_plugins           (GsPluginLoader *plugin_loader);
+
 void            gs_plugin_loader_add_event             (GsPluginLoader *plugin_loader,
                                                         GsPluginEvent  *event);
 GPtrArray      *gs_plugin_loader_get_events            (GsPluginLoader *plugin_loader);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]