[gnome-software] trivial: Add a GCancellable to gs_plugin_loader_setup()



commit d421d73b83a3ec516e1999f940673b23a72df747
Author: Richard Hughes <richard hughsie com>
Date:   Thu Nov 24 20:09:24 2016 +0000

    trivial: Add a GCancellable to gs_plugin_loader_setup()

 src/gs-application.c   |    1 +
 src/gs-cmd.c           |    1 +
 src/gs-plugin-loader.c |    4 +++-
 src/gs-plugin-loader.h |    1 +
 src/gs-self-test.c     |    2 +-
 5 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 5892856..bc5bc5d 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -177,6 +177,7 @@ gs_application_initialize_plugins (GsApplication *app)
        if (!gs_plugin_loader_setup (app->plugin_loader,
                                     plugin_whitelist,
                                     plugin_blacklist,
+                                    NULL,
                                     &error)) {
                g_warning ("Failed to setup plugins: %s", error->message);
                exit (1);
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index f4bf40a..b276e6d 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -276,6 +276,7 @@ main (int argc, char **argv)
        ret = gs_plugin_loader_setup (plugin_loader,
                                      plugin_whitelist,
                                      plugin_blacklist,
+                                     NULL,
                                      &error);
        if (!ret) {
                g_print ("Failed to setup plugins: %s\n", error->message);
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 5877ae5..c2ae1f9 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -3949,6 +3949,7 @@ gs_plugin_loader_plugin_sort_fn (gconstpointer a, gconstpointer b)
  * @plugin_loader: a #GsPluginLoader
  * @whitelist: list of plugin names, or %NULL
  * @blacklist: list of plugin names, or %NULL
+ * @cancellable: A #GCancellable, or %NULL
  * @error: A #GError, or %NULL
  *
  * Sets up the plugin loader ready for use.
@@ -3959,6 +3960,7 @@ gboolean
 gs_plugin_loader_setup (GsPluginLoader *plugin_loader,
                        gchar **whitelist,
                        gchar **blacklist,
+                       GCancellable *cancellable,
                        GError **error)
 {
        GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
@@ -4191,7 +4193,7 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader,
                                           function_name);
                g_assert (ptask2 != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, TRUE);
-               ret = plugin_func (plugin, NULL, &error_local);
+               ret = plugin_func (plugin, cancellable, &error_local);
                gs_plugin_loader_action_stop (plugin_loader, plugin);
                if (!ret) {
                        /* badly behaved plugin */
diff --git a/src/gs-plugin-loader.h b/src/gs-plugin-loader.h
index 9049d8e..c727281 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -172,6 +172,7 @@ gboolean     gs_plugin_loader_update_finish         (GsPluginLoader *plugin_loader,
 gboolean        gs_plugin_loader_setup                 (GsPluginLoader *plugin_loader,
                                                         gchar          **whitelist,
                                                         gchar          **blacklist,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 void            gs_plugin_loader_dump_state            (GsPluginLoader *plugin_loader);
 gboolean        gs_plugin_loader_get_enabled           (GsPluginLoader *plugin_loader,
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index 3f2a494..b52e9fb 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -1442,7 +1442,7 @@ main (int argc, char **argv)
        g_signal_connect (plugin_loader, "status-changed",
                          G_CALLBACK (gs_plugin_loader_status_changed_cb), NULL);
        gs_plugin_loader_set_location (plugin_loader, "./plugins/.libs");
-       ret = gs_plugin_loader_setup (plugin_loader, (gchar**) whitelist, NULL, &error);
+       ret = gs_plugin_loader_setup (plugin_loader, (gchar**) whitelist, NULL, NULL, &error);
        g_assert_no_error (error);
        g_assert (ret);
        g_assert (!gs_plugin_loader_get_enabled (plugin_loader, "notgoingtoexist"));


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