Fix offline update notifications to show up

https://bugzilla.redhat.com/show_bug.cgi?id=1659231
This commit is contained in:
Kalev Lember 2018-12-14 09:22:36 +01:00
parent fca44481b8
commit 7d42b3dbe8
2 changed files with 132 additions and 1 deletions

View File

@ -0,0 +1,124 @@
From 6279c967a1e73ed42106ae99595c0c6b437f03a0 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 23 Oct 2018 09:41:49 +0200
Subject: [PATCH 1/2] update monitor: trivial: Rename a variable
---
src/gs-update-monitor.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 5703dd9cd..31d2738b4 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -332,7 +332,7 @@ download_finished_cb (GObject *object, GAsyncResult *res, gpointer data)
GsUpdateMonitor *monitor = GS_UPDATE_MONITOR (data);
g_autoptr(GError) error = NULL;
g_autoptr(GsAppList) list = NULL;
- g_autoptr(GsAppList) list2 = NULL;
+ g_autoptr(GsAppList) update_online = NULL;
/* get result */
list = gs_plugin_loader_job_process_finish (GS_PLUGIN_LOADER (object), res, &error);
@@ -343,18 +343,18 @@ download_finished_cb (GObject *object, GAsyncResult *res, gpointer data)
}
/* install any apps that can be installed LIVE */
- list2 = gs_app_list_new ();
+ update_online = gs_app_list_new ();
for (guint i = 0; i < gs_app_list_length (list); i++) {
GsApp *app = gs_app_list_index (list, i);
if (_should_auto_update (app)) {
g_debug ("auto-updating %s", gs_app_get_unique_id (app));
- gs_app_list_add (list2, app);
+ gs_app_list_add (update_online, app);
}
}
- if (gs_app_list_length (list2) > 0) {
+ if (gs_app_list_length (update_online) > 0) {
g_autoptr(GsPluginJob) plugin_job = NULL;
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_UPDATE,
- "list", list2,
+ "list", update_online,
NULL);
gs_plugin_loader_job_process_async (monitor->plugin_loader,
plugin_job,
--
2.19.1
From 12251ad2ea52035707a5149ba3532eb8096422bc Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 23 Oct 2018 10:12:25 +0200
Subject: [PATCH 2/2] update monitor: Notify about offline updates after they
are downloaded
The notification text says "updates are ready to be installed" so they'd
better be ready when we notify the user.
---
src/gs-update-monitor.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 31d2738b4..3d2b80b47 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -333,6 +333,7 @@ download_finished_cb (GObject *object, GAsyncResult *res, gpointer data)
g_autoptr(GError) error = NULL;
g_autoptr(GsAppList) list = NULL;
g_autoptr(GsAppList) update_online = NULL;
+ g_autoptr(GsAppList) update_offline = NULL;
/* get result */
list = gs_plugin_loader_job_process_finish (GS_PLUGIN_LOADER (object), res, &error);
@@ -342,15 +343,19 @@ download_finished_cb (GObject *object, GAsyncResult *res, gpointer data)
return;
}
- /* install any apps that can be installed LIVE */
update_online = gs_app_list_new ();
+ update_offline = gs_app_list_new ();
for (guint i = 0; i < gs_app_list_length (list); i++) {
GsApp *app = gs_app_list_index (list, i);
if (_should_auto_update (app)) {
g_debug ("auto-updating %s", gs_app_get_unique_id (app));
gs_app_list_add (update_online, app);
+ } else {
+ gs_app_list_add (update_offline, app);
}
}
+
+ /* install any apps that can be installed LIVE */
if (gs_app_list_length (update_online) > 0) {
g_autoptr(GsPluginJob) plugin_job = NULL;
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_UPDATE,
@@ -362,6 +367,14 @@ download_finished_cb (GObject *object, GAsyncResult *res, gpointer data)
update_finished_cb,
monitor);
}
+
+ /* show a notification for offline updates */
+ if (gs_app_list_length (update_offline) > 0) {
+ if (has_important_updates (update_offline) ||
+ no_updates_for_a_week (monitor)) {
+ notify_offline_update_available (monitor);
+ }
+ }
}
static void
@@ -422,11 +435,6 @@ get_updates_finished_cb (GObject *object, GAsyncResult *res, gpointer data)
monitor);
return;
}
-
- if (has_important_updates (apps) ||
- no_updates_for_a_week (monitor)) {
- notify_offline_update_available (monitor);
- }
}
static gboolean
--
2.19.1

View File

@ -11,13 +11,17 @@
Name: gnome-software
Version: 3.31.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A software center for GNOME
License: GPLv2+
URL: https://wiki.gnome.org/Apps/Software
Source0: https://download.gnome.org/sources/gnome-software/3.31/%{name}-%{version}.tar.xz
# Fix offline update notifications to show up
# https://bugzilla.redhat.com/show_bug.cgi?id=1659231
Patch0: gnome-software-fix-offline-update-notifications.patch
BuildRequires: gcc
BuildRequires: gettext
BuildRequires: libxslt
@ -222,6 +226,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_mandir}/man1/gnome-software-editor.1*
%changelog
* Fri Dec 14 2018 Kalev Lember <klember@redhat.com> - 3.31.1-2
- Fix offline update notifications to show up (#1659231)
* Tue Oct 09 2018 Kalev Lember <klember@redhat.com> - 3.31.1-1
- Update to 3.31.1