[gnome-software] GsShellCategory: cancel loading when appropriate



commit f5088117cfcbc6e11c64702737785c9c08bd84ee
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 2 20:47:49 2013 -0400

    GsShellCategory: cancel loading when appropriate
    
    Use our own cancellable, and cancel a pending subcategory load
    when the user selects another subcategory.

 src/gs-shell-category.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-shell-category.c b/src/gs-shell-category.c
index 5620021..294c987 100644
--- a/src/gs-shell-category.c
+++ b/src/gs-shell-category.c
@@ -131,7 +131,9 @@ gs_shell_category_get_apps_cb (GObject *source_object,
                                                           res,
                                                           &error);
        if (list == NULL) {
-               g_warning ("failed to get apps for category apps: %s", error->message);
+                if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+                       g_warning ("failed to get apps for category apps: %s", error->message);
+                }
                g_error_free (error);
                goto out;
        }
@@ -163,6 +165,9 @@ gs_shell_category_populate_filtered (GsShellCategory *shell)
         GtkWidget *grid;
         GsCategory *parent;
 
+        g_cancellable_cancel (priv->cancellable);
+        g_cancellable_reset (priv->cancellable);
+
         parent = gs_category_get_parent (priv->category);
         if (parent == NULL) {
                 g_debug ("search using %s",
@@ -356,7 +361,7 @@ gs_shell_category_setup (GsShellCategory *shell_category,
 
        priv->plugin_loader = g_object_ref (plugin_loader);
         priv->builder = g_object_ref (builder);
-       priv->cancellable = g_object_ref (cancellable);
+       priv->cancellable = g_cancellable_new ();
         priv->shell = shell;
 }
 


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