[gnome-software: 6/18] gs-plugin-loader: Add a getter for the internal session




commit be177c84ff38dbac7d06877a39a023ae0df5a918
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue May 18 15:23:18 2021 +0100

    gs-plugin-loader: Add a getter for the internal session
    
    This is already exposed via plugins as `gs_plugin_get_soup_session()`.
    Also expose it via the `GsPluginLoader` so it can be used when a
    `GsPlugin` doesn’t exist.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 lib/gs-plugin-loader.c | 17 +++++++++++++++++
 lib/gs-plugin-loader.h |  1 +
 2 files changed, 18 insertions(+)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 034bac69a..634a301a5 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -3886,6 +3886,23 @@ gs_plugin_loader_get_system_app (GsPluginLoader *plugin_loader)
        return gs_plugin_loader_app_create (plugin_loader, "*/*/*/system/*");
 }
 
+/**
+ * gs_plugin_loader_get_soup_session:
+ * @plugin_loader: a #GsPluginLoader
+ *
+ * Get the internal #SoupSession which is used to download things.
+ *
+ * Returns: (transfer none) (not nullable): a #SoupSession
+ * Since: 41
+ */
+SoupSession *
+gs_plugin_loader_get_soup_session (GsPluginLoader *plugin_loader)
+{
+       g_return_val_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader), NULL);
+
+       return plugin_loader->soup_session;
+}
+
 /**
  * gs_plugin_loader_set_max_parallel_ops:
  * @plugin_loader: a #GsPluginLoader
diff --git a/lib/gs-plugin-loader.h b/lib/gs-plugin-loader.h
index 4b76d9ebb..0f691bd9d 100644
--- a/lib/gs-plugin-loader.h
+++ b/lib/gs-plugin-loader.h
@@ -72,6 +72,7 @@ void           gs_plugin_loader_remove_events         (GsPluginLoader *plugin_loader);
 GsApp          *gs_plugin_loader_app_create            (GsPluginLoader *plugin_loader,
                                                         const gchar    *unique_id);
 GsApp          *gs_plugin_loader_get_system_app        (GsPluginLoader *plugin_loader);
+SoupSession    *gs_plugin_loader_get_soup_session      (GsPluginLoader *plugin_loader);
 
 /* only useful from the self tests */
 void            gs_plugin_loader_setup_again           (GsPluginLoader *plugin_loader);


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