125 lines
4.1 KiB
Diff
125 lines
4.1 KiB
Diff
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
|
|
|