[gnome-software] trivial: Always show a notification when we have a pending error



commit cb834b91166fa8a484ae6d96ff625636f7f91db7
Author: Richard Hughes <richard hughsie com>
Date:   Tue Jul 11 08:24:15 2017 +0100

    trivial: Always show a notification when we have a pending error
    
    Show a 'Sorry, something went wrong' in-app error when we have no proper
    translation to show.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=778086

 src/gs-shell.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 359ec9a..187464b 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -1389,6 +1389,8 @@ gs_shell_show_event_launch (GsShell *shell, GsPluginEvent *event)
                buttons |= GS_SHELL_EVENT_BUTTON_NO_SPACE;
                break;
        default:
+               /* TRANSLATORS: we failed to get a proper error code */
+               g_string_append (str, _("Sorry, something went wrong"));
                break;
        }
        if (str->len == 0)
@@ -1417,6 +1419,7 @@ static gboolean
 gs_shell_show_event_file_to_app (GsShell *shell, GsPluginEvent *event)
 {
        GsShellEventButtons buttons = GS_SHELL_EVENT_BUTTON_NONE;
+       GsShellPrivate *priv = gs_shell_get_instance_private (shell);
        const GError *error = gs_plugin_event_get_error (event);
        g_autoptr(GString) str = g_string_new (NULL);
 
@@ -1433,11 +1436,17 @@ gs_shell_show_event_file_to_app (GsShell *shell, GsPluginEvent *event)
                buttons |= GS_SHELL_EVENT_BUTTON_NO_SPACE;
                break;
        default:
+               /* TRANSLATORS: we failed to get a proper error code */
+               g_string_append (str, _("Sorry, something went wrong"));
                break;
        }
        if (str->len == 0)
                return FALSE;
 
+       /* add extra debugging for debug builds */
+       if (priv->show_detailed_error)
+               g_string_append_printf (str, "\n%s", error->message);
+
        /* show in-app notification */
        gs_shell_show_event_app_notify (shell, str->str, buttons);
        return TRUE;
@@ -1492,6 +1501,8 @@ gs_shell_show_event_fallback (GsShell *shell, GsPluginEvent *event)
                g_string_append (str, _("AC power is required"));
                break;
        default:
+               /* TRANSLATORS: we failed to get a proper error code */
+               g_string_append (str, _("Sorry, something went wrong"));
                break;
        }
        if (str->len == 0)


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