[gnome-software/gnome-40: 2/3] gs-update-monitor: Request to receive action error
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-40: 2/3] gs-update-monitor: Request to receive action error
- Date: Wed, 7 Jul 2021 09:24:01 +0000 (UTC)
commit 40a48cd5825e40b722cad5fe65e5715049b04100
Author: Milan Crha <mcrha redhat com>
Date: Tue Jun 29 14:32:53 2021 +0200
gs-update-monitor: Request to receive action error
This is needed to know whether the action really succeeded or not,
to avoid false notifications about updated applications in the background.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1271
lib/gs-plugin-loader.c | 3 ++-
src/gs-update-monitor.c | 25 +++++++++++++++++++------
2 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 00d24bbe5..e4c3be97e 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -350,7 +350,8 @@ gs_plugin_loader_add_event (GsPluginLoader *plugin_loader, GsPluginEvent *event)
* to a concrete application, in which case any cached application
* overrides the passed in @app.
*
- * The 'cancelled' errors are automatically ignored.
+ * The %GS_PLUGIN_ERROR_CANCELLED and %G_IO_ERROR_CANCELLED errors
+ * are automatically ignored.
*
* Since: 41
**/
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 234c7de95..984faa44e 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -384,14 +384,19 @@ static void
update_finished_cb (GObject *object, GAsyncResult *res, gpointer data)
{
GsUpdateMonitor *monitor = GS_UPDATE_MONITOR (data);
+ GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (object);
g_autoptr(GError) error = NULL;
g_autoptr(GsAppList) list = NULL;
/* get result */
- list = gs_plugin_loader_job_process_finish (GS_PLUGIN_LOADER (object), res, &error);
+ list = gs_plugin_loader_job_process_finish (plugin_loader, res, &error);
if (list == NULL) {
- if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
- g_warning ("failed update application: %s", error->message);
+ gs_plugin_loader_claim_error (plugin_loader,
+ NULL,
+ GS_PLUGIN_ACTION_UPDATE,
+ NULL,
+ TRUE,
+ error);
return;
}
@@ -423,16 +428,21 @@ static void
download_finished_cb (GObject *object, GAsyncResult *res, gpointer data)
{
GsUpdateMonitor *monitor = GS_UPDATE_MONITOR (data);
+ GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (object);
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);
+ list = gs_plugin_loader_job_process_finish (plugin_loader, res, &error);
if (list == NULL) {
- if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
- g_warning ("failed to get updates: %s", error->message);
+ gs_plugin_loader_claim_error (plugin_loader,
+ NULL,
+ GS_PLUGIN_ACTION_DOWNLOAD,
+ NULL,
+ TRUE,
+ error);
return;
}
@@ -453,6 +463,7 @@ download_finished_cb (GObject *object, GAsyncResult *res, gpointer data)
g_autoptr(GsPluginJob) plugin_job = NULL;
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_UPDATE,
"list", update_online,
+ "propagate-error", TRUE,
NULL);
gs_plugin_loader_job_process_async (monitor->plugin_loader,
plugin_job,
@@ -523,6 +534,7 @@ get_updates_finished_cb (GObject *object, GAsyncResult *res, gpointer data)
* preferences */
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_DOWNLOAD,
"list", apps,
+ "propagate-error", TRUE,
NULL);
g_debug ("Getting updates");
gs_plugin_loader_job_process_async (monitor->plugin_loader,
@@ -558,6 +570,7 @@ get_updates_finished_cb (GObject *object, GAsyncResult *res, gpointer data)
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_DOWNLOAD,
"list", update_online,
+ "propagate-error", TRUE,
NULL);
g_debug ("Getting %u online updates", gs_app_list_length (update_online));
gs_plugin_loader_job_process_async (monitor->plugin_loader,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]