[gnome-software/wip/kalev/packagekit-interactive] packagekit: Use the INTERACTIVE plugin flag



commit 920747697e7ae60d83c34e5d3d8ab6b5f5f746bd
Author: Kalev Lember <klember redhat com>
Date:   Fri Nov 2 08:20:37 2018 +0100

    packagekit: Use the INTERACTIVE plugin flag
    
    XXX: untested

 plugins/packagekit/gs-plugin-packagekit-refresh.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/plugins/packagekit/gs-plugin-packagekit-refresh.c 
b/plugins/packagekit/gs-plugin-packagekit-refresh.c
index 37961e5e..d7cc8dfd 100644
--- a/plugins/packagekit/gs-plugin-packagekit-refresh.c
+++ b/plugins/packagekit/gs-plugin-packagekit-refresh.c
@@ -44,7 +44,6 @@ gs_plugin_initialize (GsPlugin *plugin)
        GsPluginData *priv = gs_plugin_alloc_data (plugin, sizeof(GsPluginData));
        priv->task = pk_task_new ();
        pk_task_set_only_download (priv->task, TRUE);
-       pk_client_set_background (PK_CLIENT (priv->task), TRUE);
 
        /* we can return better results than dpkg directly */
        gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_CONFLICTS, "dpkg");
@@ -68,6 +67,9 @@ _download_only (GsPlugin *plugin, GsAppList *list,
        g_autoptr(PkResults) results2 = NULL;
        g_autoptr(PkResults) results = NULL;
 
+       pk_client_set_background (PK_CLIENT (priv->task),
+                                 !gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
+
        /* never refresh the metadata here as this can surprise the frontend if
         * we end up downloading a different set of packages than what was
         * shown to the user */
@@ -141,8 +143,8 @@ gs_plugin_refresh (GsPlugin *plugin,
        g_autoptr(GsApp) app_dl = gs_app_new (gs_plugin_get_name (plugin));
        g_autoptr(PkResults) results = NULL;
 
-       /* cache age of 1 is user-initiated */
-       pk_client_set_background (PK_CLIENT (priv->task), cache_age > 1);
+       pk_client_set_background (PK_CLIENT (priv->task),
+                                 !gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
        pk_client_set_cache_age (PK_CLIENT (priv->task), cache_age);
 
        /* refresh the metadata */


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