[gnome-software] Add a GCancellable to each GsPluginLoader function



commit 9e9bb7df62056ad21272248c19a6c06dd9f1a399
Author: Richard Hughes <richard hughsie com>
Date:   Mon Mar 11 07:05:47 2013 +0000

    Add a GCancellable to each GsPluginLoader function

 src/gs-main.c                             |    8 ++-
 src/gs-plugin-loader.c                    |   86 ++++++++++++++++++++++++-----
 src/gs-plugin-loader.h                    |    7 ++
 src/gs-plugin.h                           |   13 ++++-
 src/gs-self-test.c                        |   10 ++--
 src/plugins/gs-plugin-datadir-apps.c      |    5 +-
 src/plugins/gs-plugin-datadir-filename.c  |    5 +-
 src/plugins/gs-plugin-desktopdb.c         |    5 +-
 src/plugins/gs-plugin-dummy.c             |   26 +++++++--
 src/plugins/gs-plugin-hardcoded-kind.c    |    5 +-
 src/plugins/gs-plugin-hardcoded-popular.c |    5 +-
 src/plugins/gs-plugin-hardcoded-ratings.c |    5 +-
 src/plugins/gs-plugin-packagekit.c        |   36 +++++++++---
 13 files changed, 172 insertions(+), 44 deletions(-)
---
diff --git a/src/gs-main.c b/src/gs-main.c
index 22550b3..2008954 100644
--- a/src/gs-main.c
+++ b/src/gs-main.c
@@ -851,7 +851,9 @@ gs_main_get_installed_packages (GsMainPrivate *priv)
        _gtk_container_remove_all (GTK_CONTAINER (priv->list_box_installed));
 
        /* get popular apps */
-       list = gs_plugin_loader_get_installed (priv->plugin_loader, &error);
+       list = gs_plugin_loader_get_installed (priv->plugin_loader,
+                                              priv->cancellable,
+                                              &error);
        if (list == NULL) {
                g_warning ("failed to get installed apps: %s", error->message);
                g_error_free (error);
@@ -909,7 +911,9 @@ gs_main_get_popular (GsMainPrivate *priv)
        GtkTreeIter iter;
 
        /* get popular apps */
-       list = gs_plugin_loader_get_popular (priv->plugin_loader, &error);
+       list = gs_plugin_loader_get_popular (priv->plugin_loader,
+                                            priv->cancellable,
+                                            &error);
        if (list == NULL) {
                g_warning ("failed to get popular apps: %s", error->message);
                g_error_free (error);
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index de0ba40..d1c3f4b 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -63,6 +63,7 @@ gs_plugin_loader_error_quark (void)
 static gboolean
 gs_plugin_loader_run_refine (GsPluginLoader *plugin_loader,
                             GList *list,
+                            GCancellable *cancellable,
                             GError **error)
 {
        gboolean ret = TRUE;
@@ -84,7 +85,7 @@ gs_plugin_loader_run_refine (GsPluginLoader *plugin_loader,
                g_debug ("run %s on %s", function_name,
                         g_module_name (plugin->module));
                g_timer_start (plugin->timer);
-               ret = plugin_func (plugin, list, error);
+               ret = plugin_func (plugin, list, cancellable, error);
                if (!ret)
                        goto out;
                gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
@@ -103,9 +104,10 @@ out:
 static GList *
 gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
                              const gchar *function_name,
+                             GCancellable *cancellable,
                              GError **error)
 {
-       gboolean ret;
+       gboolean ret = TRUE;
        GList *list = NULL;
        GsPlugin *plugin;
        GsPluginResultsFunc plugin_func = NULL;
@@ -116,6 +118,11 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
                plugin = g_ptr_array_index (plugin_loader->priv->plugins, i);
                if (!plugin->enabled)
                        continue;
+               ret = g_cancellable_set_error_if_cancelled (cancellable, error);
+               if (ret) {
+                       ret = FALSE;
+                       goto out;
+               }
                ret = g_module_symbol (plugin->module,
                                       function_name,
                                       (gpointer *) &plugin_func);
@@ -124,7 +131,7 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
                g_debug ("run %s on %s", function_name,
                         g_module_name (plugin->module));
                g_timer_start (plugin->timer);
-               ret = plugin_func (plugin, &list, error);
+               ret = plugin_func (plugin, &list, cancellable, error);
                if (!ret)
                        goto out;
                gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
@@ -135,12 +142,19 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
        }
 
        /* run refine() on each one */
-       ret = gs_plugin_loader_run_refine (plugin_loader, list, error);
+       ret = gs_plugin_loader_run_refine (plugin_loader,
+                                          list,
+                                          cancellable,
+                                          error);
        if (!ret)
                goto out;
 
        /* success */
 out:
+       if (!ret) {
+               g_list_free_full (list, (GDestroyNotify) g_object_unref);
+               list = NULL;
+       }
        return list;
 }
 
@@ -187,7 +201,9 @@ gs_plugin_loader_remove_invalid (GList *list)
  * gs_plugin_loader_get_updates:
  **/
 GList *
-gs_plugin_loader_get_updates (GsPluginLoader *plugin_loader, GError **error)
+gs_plugin_loader_get_updates (GsPluginLoader *plugin_loader,
+                             GCancellable *cancellable,
+                             GError **error)
 {
        GList *list;
        GList *l;
@@ -199,6 +215,7 @@ gs_plugin_loader_get_updates (GsPluginLoader *plugin_loader, GError **error)
 
        list = gs_plugin_loader_run_results (plugin_loader,
                                             "gs_plugin_add_updates",
+                                            cancellable,
                                             error);
        if (list == NULL) {
                g_set_error (error,
@@ -257,11 +274,14 @@ out:
  * gs_plugin_loader_get_installed:
  **/
 GList *
-gs_plugin_loader_get_installed (GsPluginLoader *plugin_loader, GError **error)
+gs_plugin_loader_get_installed (GsPluginLoader *plugin_loader,
+                               GCancellable *cancellable,
+                               GError **error)
 {
        GList *list;
        list = gs_plugin_loader_run_results (plugin_loader,
                                             "gs_plugin_add_installed",
+                                            cancellable,
                                             error);
        list = gs_plugin_loader_remove_invalid (list);
        if (list == NULL) {
@@ -279,11 +299,14 @@ out:
  * gs_plugin_loader_get_popular:
  **/
 GList *
-gs_plugin_loader_get_popular (GsPluginLoader *plugin_loader, GError **error)
+gs_plugin_loader_get_popular (GsPluginLoader *plugin_loader,
+                             GCancellable *cancellable,
+                             GError **error)
 {
        GList *list;
        list = gs_plugin_loader_run_results (plugin_loader,
                                             "gs_plugin_add_popular",
+                                            cancellable,
                                             error);
        list = gs_plugin_loader_remove_invalid (list);
        if (list == NULL) {
@@ -301,10 +324,13 @@ out:
  * gs_plugin_loader_search:
  **/
 GList *
-gs_plugin_loader_search (GsPluginLoader *plugin_loader, const gchar *value, GError **error)
+gs_plugin_loader_search (GsPluginLoader *plugin_loader,
+                        const gchar *value,
+                        GCancellable *cancellable,
+                        GError **error)
 {
        const gchar *function_name = "gs_plugin_add_search";
-       gboolean ret;
+       gboolean ret = TRUE;
        GList *list = NULL;
        GsPlugin *plugin;
        GsPluginSearchFunc plugin_func = NULL;
@@ -315,6 +341,11 @@ gs_plugin_loader_search (GsPluginLoader *plugin_loader, const gchar *value, GErr
                plugin = g_ptr_array_index (plugin_loader->priv->plugins, i);
                if (!plugin->enabled)
                        continue;
+               ret = g_cancellable_set_error_if_cancelled (cancellable, error);
+               if (ret) {
+                       ret = FALSE;
+                       goto out;
+               }
                ret = g_module_symbol (plugin->module,
                                       function_name,
                                       (gpointer *) &plugin_func);
@@ -323,7 +354,7 @@ gs_plugin_loader_search (GsPluginLoader *plugin_loader, const gchar *value, GErr
                g_debug ("run %s on %s", function_name,
                         g_module_name (plugin->module));
                g_timer_start (plugin->timer);
-               ret = plugin_func (plugin, value, &list, error);
+               ret = plugin_func (plugin, value, &list, cancellable, error);
                if (!ret)
                        goto out;
                gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
@@ -334,7 +365,10 @@ gs_plugin_loader_search (GsPluginLoader *plugin_loader, const gchar *value, GErr
        }
 
        /* run refine() on each one */
-       ret = gs_plugin_loader_run_refine (plugin_loader, list, error);
+       ret = gs_plugin_loader_run_refine (plugin_loader,
+                                          list,
+                                          cancellable,
+                                          error);
        if (!ret)
                goto out;
 
@@ -348,6 +382,10 @@ gs_plugin_loader_search (GsPluginLoader *plugin_loader, const gchar *value, GErr
                goto out;
        }
 out:
+       if (!ret) {
+               g_list_free_full (list, (GDestroyNotify) g_object_unref);
+               list = NULL;
+       }
        return list;
 }
 
@@ -359,6 +397,7 @@ static gboolean
 gs_plugin_loader_run_action (GsPluginLoader *plugin_loader,
                             GsApp *app,
                             const gchar *function_name,
+                            GCancellable *cancellable,
                             GError **error)
 {
        gboolean exists;
@@ -373,6 +412,11 @@ gs_plugin_loader_run_action (GsPluginLoader *plugin_loader,
                plugin = g_ptr_array_index (plugin_loader->priv->plugins, i);
                if (!plugin->enabled)
                        continue;
+               ret = g_cancellable_set_error_if_cancelled (cancellable, error);
+               if (ret) {
+                       ret = FALSE;
+                       goto out;
+               }
                exists = g_module_symbol (plugin->module,
                                          function_name,
                                          (gpointer *) &plugin_func);
@@ -381,7 +425,7 @@ gs_plugin_loader_run_action (GsPluginLoader *plugin_loader,
                g_debug ("run %s on %s", function_name,
                         g_module_name (plugin->module));
                g_timer_start (plugin->timer);
-               ret = plugin_func (plugin, app, &error_local);
+               ret = plugin_func (plugin, app, cancellable, &error_local);
                if (!ret) {
                        if (g_error_matches (error_local,
                                             GS_PLUGIN_ERROR,
@@ -417,11 +461,15 @@ out:
  * gs_plugin_loader_app_update:
  **/
 gboolean
-gs_plugin_loader_app_update (GsPluginLoader *plugin_loader, GsApp *app, GError **error)
+gs_plugin_loader_app_update (GsPluginLoader *plugin_loader,
+                            GsApp *app,
+                            GCancellable *cancellable,
+                            GError **error)
 {
        return gs_plugin_loader_run_action (plugin_loader,
                                            app,
                                            "gs_plugin_app_update",
+                                           cancellable,
                                            error);
 }
 
@@ -429,11 +477,15 @@ gs_plugin_loader_app_update (GsPluginLoader *plugin_loader, GsApp *app, GError *
  * gs_plugin_loader_app_install:
  **/
 gboolean
-gs_plugin_loader_app_install (GsPluginLoader *plugin_loader, GsApp *app, GError **error)
+gs_plugin_loader_app_install (GsPluginLoader *plugin_loader,
+                             GsApp *app,
+                             GCancellable *cancellable,
+                             GError **error)
 {
        return gs_plugin_loader_run_action (plugin_loader,
                                            app,
                                            "gs_plugin_app_install",
+                                           cancellable,
                                            error);
 }
 
@@ -441,11 +493,15 @@ gs_plugin_loader_app_install (GsPluginLoader *plugin_loader, GsApp *app, GError
  * gs_plugin_loader_app_remove:
  **/
 gboolean
-gs_plugin_loader_app_remove (GsPluginLoader *plugin_loader, GsApp *app, GError **error)
+gs_plugin_loader_app_remove (GsPluginLoader *plugin_loader,
+                            GsApp *app,
+                            GCancellable *cancellable,
+                            GError **error)
 {
        return gs_plugin_loader_run_action (plugin_loader,
                                            app,
                                            "gs_plugin_app_remove",
+                                           cancellable,
                                            error);
 }
 
diff --git a/src/gs-plugin-loader.h b/src/gs-plugin-loader.h
index c0d7d74..aa9a51d 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -64,13 +64,17 @@ GType                gs_plugin_loader_get_type              (void);
 
 GsPluginLoader *gs_plugin_loader_new                   (void);
 GList          *gs_plugin_loader_get_installed         (GsPluginLoader *plugin_loader,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 GList          *gs_plugin_loader_get_updates           (GsPluginLoader *plugin_loader,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 GList          *gs_plugin_loader_get_popular           (GsPluginLoader *plugin_loader,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 GList          *gs_plugin_loader_search                (GsPluginLoader *plugin_loader,
                                                         const gchar    *value,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 gboolean        gs_plugin_loader_setup                 (GsPluginLoader *plugin_loader,
                                                         GError         **error);
@@ -81,12 +85,15 @@ void                 gs_plugin_loader_set_location          (GsPluginLoader 
*plugin_loader,
                                                         const gchar    *location);
 gboolean        gs_plugin_loader_app_install           (GsPluginLoader *plugin_loader,
                                                         GsApp          *app,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 gboolean        gs_plugin_loader_app_update            (GsPluginLoader *plugin_loader,
                                                         GsApp          *app,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 gboolean        gs_plugin_loader_app_remove            (GsPluginLoader *plugin_loader,
                                                         GsApp          *app,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 
 #endif /* __GS_PLUGIN_LOADER_H */
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index edbcc6e..df850b5 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -52,7 +52,6 @@ struct GsPlugin {
        gboolean                 enabled;
        gchar                   *name;
        GsPluginPrivate         *priv;
-       GCancellable            *cancellable;
        guint                    pixbuf_size;
        GTimer                  *timer;
        GsPluginStatusUpdate     status_update_fn;
@@ -77,15 +76,19 @@ typedef void                 (*GsPluginFunc)                (GsPlugin       *plugin);
 typedef gboolean        (*GsPluginSearchFunc)          (GsPlugin       *plugin,
                                                         const gchar    *value,
                                                         GList          **list,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 typedef gboolean        (*GsPluginResultsFunc)         (GsPlugin       *plugin,
                                                         GList          **list,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 typedef gboolean        (*GsPluginActionFunc)          (GsPlugin       *plugin,
                                                         GsApp          *app,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 typedef gboolean        (*GsPluginRefineFunc)          (GsPlugin       *plugin,
                                                         GList          *list,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 
 const gchar    *gs_plugin_get_name                     (void);
@@ -94,28 +97,36 @@ void                 gs_plugin_destroy                      (GsPlugin       *plugin);
 gboolean        gs_plugin_add_search                   (GsPlugin       *plugin,
                                                         const gchar    *value,
                                                         GList          *list,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 gdouble                 gs_plugin_get_priority                 (GsPlugin       *plugin);
 gboolean        gs_plugin_add_installed                (GsPlugin       *plugin,
                                                         GList          **list,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 gboolean        gs_plugin_add_updates                  (GsPlugin       *plugin,
                                                         GList          **list,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 gboolean        gs_plugin_add_popular                  (GsPlugin       *plugin,
                                                         GList          **list,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 gboolean        gs_plugin_refine                       (GsPlugin       *plugin,
                                                         GList          *list,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 gboolean        gs_plugin_app_install                  (GsPlugin       *plugin,
                                                         GsApp          *app,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 gboolean        gs_plugin_app_update                   (GsPlugin       *plugin,
                                                         GsApp          *app,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 gboolean        gs_plugin_app_remove                   (GsPlugin       *plugin,
                                                         GsApp          *app,
+                                                        GCancellable   *cancellable,
                                                         GError         **error);
 
 G_END_DECLS
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index 96958b0..2056bc1 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -89,7 +89,7 @@ gs_plugin_loader_func (void)
        ret = gs_plugin_loader_set_enabled (loader, "notgoingtoexist", TRUE);
        g_assert (!ret);
 
-       list = gs_plugin_loader_get_popular (loader, &error);
+       list = gs_plugin_loader_get_popular (loader, NULL, &error);
        g_assert_no_error (error);
        g_assert (list != NULL);
        g_assert_cmpint (g_list_length (list), ==, 6);
@@ -104,8 +104,8 @@ gs_plugin_loader_func (void)
        g_list_free_full (list, (GDestroyNotify) g_object_unref);
 
        /* get updates */
-       g_assert_cmpint (_status_changed_cnt, ==, 0);
-       list = gs_plugin_loader_get_updates (loader, &error);
+       _status_changed_cnt = 0;
+       list = gs_plugin_loader_get_updates (loader, NULL, &error);
        g_assert_no_error (error);
        g_assert (list != NULL);
        g_assert_cmpint (_status_changed_cnt, ==, 1);
@@ -132,7 +132,7 @@ gs_plugin_loader_func (void)
        ret = gs_plugin_loader_set_enabled (loader, "datadir-apps", TRUE);
        g_assert (ret);
 
-       list = gs_plugin_loader_get_installed (loader, &error);
+       list = gs_plugin_loader_get_installed (loader, NULL, &error);
        g_assert_no_error (error);
        g_assert (list != NULL);
        g_assert_cmpint (g_list_length (list), >, 50);
@@ -152,7 +152,7 @@ gs_plugin_loader_func (void)
        g_list_free_full (list, (GDestroyNotify) g_object_unref);
 
        /* do this again, which should be much faster */
-       list = gs_plugin_loader_get_installed (loader, &error);
+       list = gs_plugin_loader_get_installed (loader, NULL, &error);
        g_assert_no_error (error);
        g_assert (list != NULL);
        g_assert_cmpint (g_list_length (list), >, 50);
diff --git a/src/plugins/gs-plugin-datadir-apps.c b/src/plugins/gs-plugin-datadir-apps.c
index 4247652..5d7e4e3 100644
--- a/src/plugins/gs-plugin-datadir-apps.c
+++ b/src/plugins/gs-plugin-datadir-apps.c
@@ -218,7 +218,10 @@ out:
  * gs_plugin_refine:
  */
 gboolean
-gs_plugin_refine (GsPlugin *plugin, GList *list, GError **error)
+gs_plugin_refine (GsPlugin *plugin,
+                 GList *list,
+                 GCancellable *cancellable,
+                 GError **error)
 {
        const gchar *tmp;
        gboolean ret = TRUE;
diff --git a/src/plugins/gs-plugin-datadir-filename.c b/src/plugins/gs-plugin-datadir-filename.c
index 3bbaf09..b2c83ba 100644
--- a/src/plugins/gs-plugin-datadir-filename.c
+++ b/src/plugins/gs-plugin-datadir-filename.c
@@ -114,7 +114,10 @@ out:
  * gs_plugin_refine:
  */
 gboolean
-gs_plugin_refine (GsPlugin *plugin, GList *list, GError **error)
+gs_plugin_refine (GsPlugin *plugin,
+                 GList *list,
+                 GCancellable *cancellable,
+                 GError **error)
 {
        const gchar *tmp;
        GList *l;
diff --git a/src/plugins/gs-plugin-desktopdb.c b/src/plugins/gs-plugin-desktopdb.c
index 0431678..b065e2f 100644
--- a/src/plugins/gs-plugin-desktopdb.c
+++ b/src/plugins/gs-plugin-desktopdb.c
@@ -126,7 +126,10 @@ out:
  * gs_plugin_refine:
  */
 gboolean
-gs_plugin_refine (GsPlugin *plugin, GList *list, GError **error)
+gs_plugin_refine (GsPlugin *plugin,
+                 GList *list,
+                 GCancellable *cancellable,
+                 GError **error)
 {
        GsApp *app;
        GList *l;
diff --git a/src/plugins/gs-plugin-dummy.c b/src/plugins/gs-plugin-dummy.c
index fea821b..53679bc 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -69,7 +69,11 @@ gs_plugin_destroy (GsPlugin *plugin)
  * gs_plugin_add_search:
  */
 gboolean
-gs_plugin_add_search (GsPlugin *plugin, const gchar *value, GList *list, GError **error)
+gs_plugin_add_search (GsPlugin *plugin,
+                     const gchar *value,
+                     GList *list,
+                     GCancellable *cancellable,
+                     GError **error)
 {
        return TRUE;
 }
@@ -78,7 +82,10 @@ gs_plugin_add_search (GsPlugin *plugin, const gchar *value, GList *list, GError
  * gs_plugin_add_updates:
  */
 gboolean
-gs_plugin_add_updates (GsPlugin *plugin, GList **list, GError **error)
+gs_plugin_add_updates (GsPlugin *plugin,
+                      GList **list,
+                      GCancellable *cancellable,
+                      GError **error)
 {
        GsApp *app;
 
@@ -116,7 +123,10 @@ gs_plugin_add_updates (GsPlugin *plugin, GList **list, GError **error)
  * gs_plugin_add_installed:
  */
 gboolean
-gs_plugin_add_installed (GsPlugin *plugin, GList **list, GError **error)
+gs_plugin_add_installed (GsPlugin *plugin,
+                        GList **list,
+                        GCancellable *cancellable,
+                        GError **error)
 {
        GsApp *app;
 
@@ -134,7 +144,10 @@ gs_plugin_add_installed (GsPlugin *plugin, GList **list, GError **error)
  * gs_plugin_add_popular:
  */
 gboolean
-gs_plugin_add_popular (GsPlugin *plugin, GList **list, GError **error)
+gs_plugin_add_popular (GsPlugin *plugin,
+                      GList **list,
+                      GCancellable *cancellable,
+                      GError **error)
 {
        GsApp *app;
 
@@ -152,7 +165,10 @@ gs_plugin_add_popular (GsPlugin *plugin, GList **list, GError **error)
  * gs_plugin_refine:
  */
 gboolean
-gs_plugin_refine (GsPlugin *plugin, GList *list, GError **error)
+gs_plugin_refine (GsPlugin *plugin,
+                 GList *list,
+                 GCancellable *cancellable,
+                 GError **error)
 {
        GsApp *app;
        GList *l;
diff --git a/src/plugins/gs-plugin-hardcoded-kind.c b/src/plugins/gs-plugin-hardcoded-kind.c
index 2bb86a2..2eb86b0 100644
--- a/src/plugins/gs-plugin-hardcoded-kind.c
+++ b/src/plugins/gs-plugin-hardcoded-kind.c
@@ -45,7 +45,10 @@ gs_plugin_get_priority (GsPlugin *plugin)
  * gs_plugin_refine:
  */
 gboolean
-gs_plugin_refine (GsPlugin *plugin, GList *list, GError **error)
+gs_plugin_refine (GsPlugin *plugin,
+                 GList *list,
+                 GCancellable *cancellable,
+                 GError **error)
 {
        GList *l;
        GsApp *app;
diff --git a/src/plugins/gs-plugin-hardcoded-popular.c b/src/plugins/gs-plugin-hardcoded-popular.c
index 3b2d5b1..3037156 100644
--- a/src/plugins/gs-plugin-hardcoded-popular.c
+++ b/src/plugins/gs-plugin-hardcoded-popular.c
@@ -45,7 +45,10 @@ gs_plugin_get_priority (GsPlugin *plugin)
  * gs_plugin_add_popular:
  */
 gboolean
-gs_plugin_add_popular (GsPlugin *plugin, GList **list, GError **error)
+gs_plugin_add_popular (GsPlugin *plugin,
+                      GList **list,
+                      GCancellable *cancellable,
+                      GError **error)
 {
        GsApp *app;
        guint i;
diff --git a/src/plugins/gs-plugin-hardcoded-ratings.c b/src/plugins/gs-plugin-hardcoded-ratings.c
index 54cea2e..786441a 100644
--- a/src/plugins/gs-plugin-hardcoded-ratings.c
+++ b/src/plugins/gs-plugin-hardcoded-ratings.c
@@ -702,7 +702,10 @@ gs_plugin_hardcoded_ratings_add (GsPlugin *plugin, GError **error)
  * gs_plugin_refine:
  */
 gboolean
-gs_plugin_refine (GsPlugin *plugin, GList *list, GError **error)
+gs_plugin_refine (GsPlugin *plugin,
+                 GList *list,
+                 GCancellable *cancellable,
+                 GError **error)
 {
        gboolean ret = TRUE;
        GList *l;
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index 70369a0..998779c 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -78,6 +78,7 @@ gboolean
 gs_plugin_add_search (GsPlugin *plugin,
                      const gchar *value,
                      GList *list,
+                     GCancellable *cancellable,
                      GError **error)
 {
        return TRUE;
@@ -135,7 +136,10 @@ out:
  * gs_plugin_add_installed:
  */
 gboolean
-gs_plugin_add_installed (GsPlugin *plugin, GList **list, GError **error)
+gs_plugin_add_installed (GsPlugin *plugin,
+                        GList **list,
+                        GCancellable *cancellable,
+                        GError **error)
 {
        gboolean ret = TRUE;
        PkBitfield filter;
@@ -153,7 +157,7 @@ gs_plugin_add_installed (GsPlugin *plugin, GList **list, GError **error)
        results = pk_client_get_packages (PK_CLIENT(plugin->priv->task),
                                          filter,
                                          NULL, NULL,
-                                         plugin->cancellable,
+                                         cancellable,
                                          error);
        if (results == NULL)
                goto out;
@@ -172,7 +176,10 @@ out:
  * gs_plugin_add_updates:
  */
 gboolean
-gs_plugin_add_updates (GsPlugin *plugin, GList **list, GError **error)
+gs_plugin_add_updates (GsPlugin *plugin,
+                      GList **list,
+                      GCancellable *cancellable,
+                      GError **error)
 {
        gboolean ret = TRUE;
        PkBitfield filter;
@@ -186,7 +193,7 @@ gs_plugin_add_updates (GsPlugin *plugin, GList **list, GError **error)
        results = pk_client_get_updates (PK_CLIENT(plugin->priv->task),
                                         filter,
                                         NULL, NULL,
-                                        plugin->cancellable,
+                                        cancellable,
                                         error);
        if (results == NULL) {
                ret = FALSE;
@@ -205,7 +212,10 @@ out:
  * gs_plugin_app_install:
  */
 gboolean
-gs_plugin_app_install (GsPlugin *plugin, GsApp *app, GError **error)
+gs_plugin_app_install (GsPlugin *plugin,
+                      GsApp *app,
+                      GCancellable *cancellable,
+                      GError **error)
 {
        const gchar *package_id;
        const gchar *to_array[] = { NULL, NULL };
@@ -226,7 +236,7 @@ gs_plugin_app_install (GsPlugin *plugin, GsApp *app, GError **error)
        to_array[0] = package_id;
        results = pk_task_install_packages_sync (plugin->priv->task,
                                                 (gchar **) to_array,
-                                                plugin->cancellable,
+                                                cancellable,
                                                 NULL, NULL,
                                                 error);
        if (results == NULL) {
@@ -260,7 +270,10 @@ out:
  * gs_plugin_app_remove:
  */
 gboolean
-gs_plugin_app_remove (GsPlugin *plugin, GsApp *app, GError **error)
+gs_plugin_app_remove (GsPlugin *plugin,
+                     GsApp *app,
+                     GCancellable *cancellable,
+                     GError **error)
 {
        const gchar *package_id;
        const gchar *to_array[] = { NULL, NULL };
@@ -282,7 +295,7 @@ gs_plugin_app_remove (GsPlugin *plugin, GsApp *app, GError **error)
        results = pk_task_remove_packages_sync (plugin->priv->task,
                                                (gchar **) to_array,
                                                FALSE, FALSE,
-                                               plugin->cancellable,
+                                               cancellable,
                                                NULL, NULL,
                                                error);
        if (results == NULL) {
@@ -316,7 +329,10 @@ out:
  * gs_plugin_app_update:
  */
 gboolean
-gs_plugin_app_update (GsPlugin *plugin, GsApp *app, GError **error)
+gs_plugin_app_update (GsPlugin *plugin,
+                     GsApp *app,
+                     GCancellable *cancellable,
+                     GError **error)
 {
        const gchar *package_id;
        const gchar *to_array[] = { NULL, NULL };
@@ -337,7 +353,7 @@ gs_plugin_app_update (GsPlugin *plugin, GsApp *app, GError **error)
        to_array[0] = package_id;
        results = pk_task_update_packages_sync (plugin->priv->task,
                                                (gchar **) to_array,
-                                               plugin->cancellable,
+                                               cancellable,
                                                NULL, NULL,
                                                error);
        if (results == NULL) {


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