[gnome-software] shell: Don't show notifications for background download and refresh errors



commit d0c60ecab878167514b20b9daae69a8be4e72292
Author: Kalev Lember <klember redhat com>
Date:   Tue Mar 5 18:23:19 2019 +0100

    shell: Don't show notifications for background download and refresh errors
    
    This fixes the issue where background downloads (from the update
    monitor) cause error notifications to pile up in the UI, even though the
    user didn't initiate any of them.
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-software/issues/487

 src/gs-shell.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index a23409e7..4b77cce5 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -978,6 +978,10 @@ gs_shell_show_event_refresh (GsShell *shell, GsPluginEvent *event)
        g_autofree gchar *str_origin = NULL;
        g_autoptr(GString) str = g_string_new (NULL);
 
+       /* ignore any errors from background downloads */
+       if (!gs_plugin_event_has_flag (event, GS_PLUGIN_EVENT_FLAG_INTERACTIVE))
+               return FALSE;
+
        switch (error->code) {
        case GS_PLUGIN_ERROR_DOWNLOAD_FAILED:
                if (origin != NULL) {
@@ -1041,9 +1045,6 @@ gs_shell_show_event_refresh (GsShell *shell, GsPluginEvent *event)
        case GS_PLUGIN_ERROR_CANCELLED:
                break;
        default:
-               /* non-interactive generic */
-               if (!gs_plugin_event_has_flag (event, GS_PLUGIN_EVENT_FLAG_INTERACTIVE))
-                       return FALSE;
                if (action == GS_PLUGIN_ACTION_DOWNLOAD) {
                        /* TRANSLATORS: failure text for the in-app notification */
                        g_string_append (str, _("Unable to download updates"));
@@ -1260,6 +1261,10 @@ gs_shell_show_event_update (GsShell *shell, GsPluginEvent *event)
        g_autofree gchar *str_origin = NULL;
        g_autoptr(GString) str = g_string_new (NULL);
 
+       /* ignore any errors from background downloads */
+       if (!gs_plugin_event_has_flag (event, GS_PLUGIN_EVENT_FLAG_INTERACTIVE))
+               return FALSE;
+
        switch (error->code) {
        case GS_PLUGIN_ERROR_DOWNLOAD_FAILED:
                if (app != NULL && origin != NULL) {


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