[gnome-software] Do not show OS Upgrades in the pending list
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Do not show OS Upgrades in the pending list
- Date: Wed, 25 May 2016 10:03:03 +0000 (UTC)
commit 91165d5152883b61f63d1eb05866eaaed774ee13
Author: Richard Hughes <richard hughsie com>
Date: Wed May 25 11:01:52 2016 +0100
Do not show OS Upgrades in the pending list
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1336482
src/gs-shell-installed.c | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 deletions(-)
---
diff --git a/src/gs-shell-installed.c b/src/gs-shell-installed.c
index 65a8a75..87b1ed1 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -480,24 +480,37 @@ gs_shell_installed_pending_apps_changed_cb (GsPluginLoader *plugin_loader,
GsApp *app;
GtkWidget *widget;
guint i;
+ guint cnt = 0;
g_autoptr(GsAppList) pending = NULL;
+ /* add new apps to the list */
+ pending = gs_plugin_loader_get_pending (plugin_loader);
+ for (i = 0; i < gs_app_list_length (pending); i++) {
+ app = gs_app_list_index (pending, i);
+
+ /* never show OS upgrades, we handle the scheduling and
+ * cancellation in GsUpgradeBanner */
+ if (gs_app_get_kind (app) == AS_APP_KIND_OS_UPGRADE)
+ continue;
+
+ /* do not to add pending apps more than once. */
+ if (gs_shell_installed_has_app (self, app) == FALSE)
+ gs_shell_installed_add_app (self, app);
+
+ /* incremement the label */
+ cnt++;
+ }
+
+ /* show a label with the number of on-going operations */
widget = GTK_WIDGET (gtk_builder_get_object (self->builder,
"button_installed_counter"));
- pending = gs_plugin_loader_get_pending (plugin_loader);
- if (gs_app_list_length (pending) == 0) {
+ if (cnt == 0) {
gtk_widget_hide (widget);
} else {
g_autofree gchar *label = NULL;
- gtk_widget_show (widget);
- label = g_strdup_printf ("%d", gs_app_list_length (pending));
+ label = g_strdup_printf ("%d", cnt);
gtk_label_set_label (GTK_LABEL (widget), label);
- }
- for (i = 0; i < gs_app_list_length (pending); i++) {
- app = gs_app_list_index (pending, i);
- /* Be careful not to add pending apps more than once. */
- if (gs_shell_installed_has_app (self, app) == FALSE)
- gs_shell_installed_add_app (self, app);
+ gtk_widget_show (widget);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]