[gnome-software] plugin loader: Return immediately from search when cancelled



commit da1f2757b31ac61260256aff314efe257bc0d1f2
Author: Kalev Lember <kalevlember gmail com>
Date:   Sun Oct 5 18:10:58 2014 +0200

    plugin loader: Return immediately from search when cancelled
    
    Set the search task's return-on-cancel flag to make it immediately
    invoke the async callback when the cancellable gets cancelled.
    
    This makes it possible to simplify the calling code.

 src/gs-plugin-loader.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 5a6b75a..64024af 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -1708,6 +1708,7 @@ gs_plugin_loader_search_async (GsPluginLoader *plugin_loader,
        /* run in a thread */
        task = g_task_new (plugin_loader, cancellable, callback, user_data);
        g_task_set_task_data (task, state, (GDestroyNotify) gs_plugin_loader_free_async_state);
+       g_task_set_return_on_cancel (task, TRUE);
        g_task_run_in_thread (task, gs_plugin_loader_search_thread_cb);
        g_object_unref (task);
 }


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