[gnome-software/wip/hughsie/bz779463: 5/5] Do not reload the updates list when updates are in progress



commit 176b7393dee637467d1ab8e897c8d7b3f21f1dd0
Author: Richard Hughes <richard hughsie com>
Date:   Fri Mar 3 22:20:04 2017 +0000

    Do not reload the updates list when updates are in progress
    
    Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=779463

 src/gs-page.c          |    9 +++++++++
 src/gs-page.h          |    1 +
 src/gs-shell-updates.c |    3 ++-
 3 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-page.c b/src/gs-page.c
index a5cf904..d6b0403 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -37,6 +37,7 @@ typedef struct
        GsShell                 *shell;
        GtkWidget               *header_start_widget;
        GtkWidget               *header_end_widget;
+       gboolean                 is_active;
 } GsPagePrivate;
 
 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GsPage, gs_page, GTK_TYPE_BIN)
@@ -600,6 +601,14 @@ gs_page_shortcut_remove (GsPage *page, GsApp *app, GCancellable *cancellable)
                                           NULL);
 }
 
+gboolean
+gs_page_is_active (GsPage *page)
+{
+       GsPagePrivate *priv = gs_page_get_instance_private (page);
+       g_return_val_if_fail (GS_IS_PAGE (page), FALSE);
+       return priv->is_active;
+}
+
 /**
  * gs_page_switch_to:
  *
diff --git a/src/gs-page.h b/src/gs-page.h
index 62d224f..a9d9155 100644
--- a/src/gs-page.h
+++ b/src/gs-page.h
@@ -90,6 +90,7 @@ gboolean       gs_page_setup                          (GsPage         *page,
                                                         GtkBuilder     *builder,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
+gboolean        gs_page_is_active                      (GsPage         *page);
 
 G_END_DECLS
 
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 7528cf9..9104eb7 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -1230,7 +1230,8 @@ gs_shell_updates_changed_cb (GsPluginLoader *plugin_loader,
        gs_shell_updates_invalidate_downloaded_upgrade (self);
 
        /* refresh updates list */
-       gs_shell_updates_reload (GS_PAGE (self));
+       if (!gs_page_is_active (GS_PAGE (self)))
+               gs_shell_updates_reload (GS_PAGE (self));
 }
 
 static void


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