[gnome-software/wip/kalev/download-step: 3/5] shell: Tweak which errors messages are shown for the DOWNLOAD action



commit e0a0a508587fd2ffb4a4aad4cccfce2d1142a448
Author: Kalev Lember <klember redhat com>
Date:   Tue Oct 23 17:37:41 2018 +0200

    shell: Tweak which errors messages are shown for the DOWNLOAD action
    
    We have nicely translated strings that all start with 'Unable to
    download', which are a perfect match. Switch to using those for
    GS_PLUGIN_ACTION_DOWNLOAD errors, and tweak the fallback error to show a
    different error message depending on if it was a REFRESH or DOWNLOAD
    failure.
    
    This reuses existing strings and doesn't break 3.30 string freeze.

 src/gs-shell.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index ec72e901..fd9b565f 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -1025,6 +1025,7 @@ gs_shell_show_event_refresh (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);
+       GsPluginAction action = gs_plugin_event_get_action (event);
        g_autofree gchar *str_origin = NULL;
        g_autoptr(GString) str = g_string_new (NULL);
 
@@ -1094,8 +1095,13 @@ gs_shell_show_event_refresh (GsShell *shell, GsPluginEvent *event)
                /* non-interactive generic */
                if (!gs_plugin_event_has_flag (event, GS_PLUGIN_EVENT_FLAG_INTERACTIVE))
                        return FALSE;
-               /* TRANSLATORS: failure text for the in-app notification */
-               g_string_append (str, _("Unable to get list of updates"));
+               if (action == GS_PLUGIN_ACTION_DOWNLOAD) {
+                       /* TRANSLATORS: failure text for the in-app notification */
+                       g_string_append (str, _("Unable to download updates"));
+               } else {
+                       /* TRANSLATORS: failure text for the in-app notification */
+                       g_string_append (str, _("Unable to get list of updates"));
+               }
                break;
        }
        if (str->len == 0)
@@ -1870,11 +1876,11 @@ gs_shell_show_event (GsShell *shell, GsPluginEvent *event)
        action = gs_plugin_event_get_action (event);
        switch (action) {
        case GS_PLUGIN_ACTION_REFRESH:
+       case GS_PLUGIN_ACTION_DOWNLOAD:
                return gs_shell_show_event_refresh (shell, event);
        case GS_PLUGIN_ACTION_PURCHASE:
                return gs_shell_show_event_purchase (shell, event);
        case GS_PLUGIN_ACTION_INSTALL:
-       case GS_PLUGIN_ACTION_DOWNLOAD:
                return gs_shell_show_event_install (shell, event);
        case GS_PLUGIN_ACTION_UPDATE:
                return gs_shell_show_event_update (shell, event);


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