[gnome-software: 3/9] Allow to cancel pending installations that are queued




commit 12ad4d05a391d66eddf8871ad76f37d9794eb872
Author: Joaquim Rocha <jrocha endlessm com>
Date:   Fri Jun 22 22:19:27 2018 +0200

    Allow to cancel pending installations that are queued
    
    If an app is queued for install, but the task has itself been queued
    (because of the plugin loader reaching the maximum number of concurrent
    operations allowed), clicking the cancel button to stop the
    queued installation was not working. The cause was that when clicking
    to cancel a queued installation, the app is actually attempted to be
    removed immediately (so it got removed from the queue internally), but
    this never prevented the actual task from being performed when the
    worker reaches it.
    
    Thus, this patch calls cancel before the removal operation, effectively
    cancelling the installation task and proceeding to remove the app from
    the install queue.
    
    (Rebased from downstream Endless OS by Philip Withnall)

 src/gs-page.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/gs-page.c b/src/gs-page.c
index 66f5d6b36..7a465bede 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -492,6 +492,12 @@ gs_page_remove_app (GsPage *page, GsApp *app, GCancellable *cancellable)
        helper->cancellable = cancellable != NULL ? g_object_ref (cancellable) : NULL;
        if (gs_app_get_state (app) == GS_APP_STATE_QUEUED_FOR_INSTALL) {
                g_autoptr(GsPluginJob) plugin_job = NULL;
+
+               /* cancel any ongoing job, this allows to e.g. cancel pending
+                * installations, updates, or other ops that may have been queued
+                * in the plugin loader (due to reaching the max parallel ops allowed) */
+               g_cancellable_cancel (gs_app_get_cancellable (app));
+
                plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REMOVE,
                                                 "interactive", TRUE,
                                                 "app", app,


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