[gnome-software] Show detailed status messages when downloading



commit bca7325d2691f5a9103daab82647018327801c0e
Author: Richard Hughes <richard hughsie com>
Date:   Mon May 22 11:08:15 2017 +0100

    Show detailed status messages when downloading

 plugins/core/gs-plugin-appstream.c                 |   13 +++++-----
 plugins/core/gs-plugin-rewrite-resource.c          |    4 +++
 .../gs-plugin-fedora-pkgdb-collections.c           |    6 ++++-
 plugins/fwupd/gs-plugin-fwupd.c                    |   17 ++++++++++---
 plugins/odrs/gs-plugin-odrs.c                      |    4 +++
 .../shell-extensions/gs-plugin-shell-extensions.c  |    8 +++++-
 plugins/steam/gs-plugin-steam.c                    |    4 +++
 po/POTFILES.in                                     |   10 ++++++-
 src/gs-editor.c                                    |    2 +-
 src/gs-loading-page.c                              |   24 ++++++++++---------
 10 files changed, 65 insertions(+), 27 deletions(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index 62292f5..843d38a 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -21,6 +21,7 @@
 
 #include <config.h>
 
+#include <glib/gi18n.h>
 #include <gnome-software.h>
 
 #include "gs-appstream.h"
@@ -673,6 +674,7 @@ gs_plugin_appstream_refresh_url (GsPlugin *plugin,
        g_autofree gchar *basename = NULL;
        g_autofree gchar *fullpath = NULL;
        g_autoptr(GFile) file = NULL;
+       g_autoptr(GsApp) app_dl = gs_app_new (gs_plugin_get_name (plugin));
 
        /* check age */
        basename = g_path_get_basename (url);
@@ -689,12 +691,11 @@ gs_plugin_appstream_refresh_url (GsPlugin *plugin,
        }
 
        /* download file */
-       return gs_plugin_download_file (plugin,
-                                       NULL, /* GsApp */
-                                       url,
-                                       fullpath,
-                                       cancellable,
-                                       error);
+       gs_app_set_summary_missing (app_dl,
+                                   /* TRANSLATORS: status text when downloading */
+                                   _("Downloading extra metadata files…"));
+       return gs_plugin_download_file (plugin, app_dl, url, fullpath,
+                                       cancellable, error);
 }
 
 gboolean
diff --git a/plugins/core/gs-plugin-rewrite-resource.c b/plugins/core/gs-plugin-rewrite-resource.c
index 95959bd..156035d 100644
--- a/plugins/core/gs-plugin-rewrite-resource.c
+++ b/plugins/core/gs-plugin-rewrite-resource.c
@@ -21,6 +21,7 @@
 
 #include <config.h>
 
+#include <glib/gi18n.h>
 #include <gnome-software.h>
 
 void
@@ -49,6 +50,9 @@ gs_plugin_refine_app (GsPlugin *plugin,
                if (css != NULL) {
                        g_autofree gchar *css_new = NULL;
                        g_autoptr(GsApp) app_dl = gs_app_new (gs_plugin_get_name (plugin));
+                       gs_app_set_summary_missing (app_dl,
+                                                   /* TRANSLATORS: status text when downloading */
+                                                   _("Downloading featured images…"));
                        css_new = gs_plugin_download_rewrite_resource (plugin,
                                                                       app,
                                                                       css,
diff --git a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c 
b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
index b2d40e9..a5cb83e 100644
--- a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
+++ b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
@@ -193,6 +193,7 @@ _refresh_cache (GsPlugin *plugin,
                GError **error)
 {
        GsPluginData *priv = gs_plugin_get_data (plugin);
+       g_autoptr(GsApp) app_dl = gs_app_new (gs_plugin_get_name (plugin));
 
        /* check cache age */
        if (cache_age > 0) {
@@ -206,7 +207,10 @@ _refresh_cache (GsPlugin *plugin,
        }
 
        /* download new file */
-       if (!gs_plugin_download_file (plugin, NULL,
+       gs_app_set_summary_missing (app_dl,
+                                   /* TRANSLATORS: status text when downloading */
+                                   _("Downloading upgrade information…"));
+       if (!gs_plugin_download_file (plugin, app_dl,
                                      FEDORA_PKGDB_COLLECTIONS_API_URI,
                                      priv->cachefn,
                                      cancellable,
diff --git a/plugins/fwupd/gs-plugin-fwupd.c b/plugins/fwupd/gs-plugin-fwupd.c
index 6d8ad37..6531d88 100644
--- a/plugins/fwupd/gs-plugin-fwupd.c
+++ b/plugins/fwupd/gs-plugin-fwupd.c
@@ -25,6 +25,7 @@
 #include <fcntl.h>
 #include <gio/gio.h>
 #include <gio/gunixfdlist.h>
+#include <glib/gi18n.h>
 #include <glib/gstdio.h>
 
 #include <gnome-software.h>
@@ -693,6 +694,9 @@ gs_plugin_fwupd_check_lvfs_metadata (GsPlugin *plugin,
 
        /* download the signature first, it's smaller */
        url_sig = g_strdup_printf ("%s.asc", priv->download_uri);
+       gs_app_set_summary_missing (app_dl,
+                                   /* TRANSLATORS: status text when downloading */
+                                   _("Downloading firmware update signature…"));
        data = gs_plugin_download_data (plugin,
                                        app_dl,
                                        url_sig,
@@ -739,8 +743,10 @@ gs_plugin_fwupd_check_lvfs_metadata (GsPlugin *plugin,
        if (cache_fn_data == NULL)
                return FALSE;
        g_debug ("saving new LVFS data to %s:", cache_fn_data);
-       if (!gs_plugin_download_file (plugin,
-                                     app_dl,
+       gs_app_set_summary_missing (app_dl,
+                                   /* TRANSLATORS: status text when downloading */
+                                   _("Downloading firmware update metadata…"));
+       if (!gs_plugin_download_file (plugin, app_dl,
                                      priv->download_uri,
                                      cache_fn_data,
                                      cancellable,
@@ -790,6 +796,7 @@ gs_plugin_refresh (GsPlugin *plugin,
                g_autoptr(GError) error_local = NULL;
                g_autofree gchar *basename = NULL;
                g_autofree gchar *filename_cache = NULL;
+               g_autoptr(GsApp) app_dl = gs_app_new (gs_plugin_get_name (plugin));
 
                tmp = g_ptr_array_index (priv->to_download, i);
                basename = g_path_get_basename (tmp);
@@ -801,8 +808,10 @@ gs_plugin_refresh (GsPlugin *plugin,
                        return FALSE;
 
                /* download file */
-               if (!gs_plugin_download_file (plugin,
-                                             NULL, /* app */
+               gs_app_set_summary_missing (app_dl,
+                                           /* TRANSLATORS: status text when downloading */
+                                           _("Downloading firmware update…"));
+               if (!gs_plugin_download_file (plugin, app_dl,
                                              tmp, /* url */
                                              filename_cache,
                                              cancellable,
diff --git a/plugins/odrs/gs-plugin-odrs.c b/plugins/odrs/gs-plugin-odrs.c
index c3fca86..9477fe0 100644
--- a/plugins/odrs/gs-plugin-odrs.c
+++ b/plugins/odrs/gs-plugin-odrs.c
@@ -21,6 +21,7 @@
 
 #include <config.h>
 
+#include <glib/gi18n.h>
 #include <gnome-software.h>
 #include <json-glib/json-glib.h>
 #include <string.h>
@@ -199,6 +200,9 @@ gs_plugin_odrs_refresh_ratings (GsPlugin *plugin,
 
        /* download the complete file */
        uri = g_strdup_printf ("%s/ratings", priv->review_server);
+       gs_app_set_summary_missing (app_dl,
+                                   /* TRANSLATORS: status text when downloading */
+                                   _("Downloading application ratings…"));
        if (!gs_plugin_download_file (plugin, app_dl, uri, fn, cancellable, error)) {
                gs_utils_error_add_unique_id (error, priv->cached_origin);
                return FALSE;
diff --git a/plugins/shell-extensions/gs-plugin-shell-extensions.c 
b/plugins/shell-extensions/gs-plugin-shell-extensions.c
index 191b589..32e4366 100644
--- a/plugins/shell-extensions/gs-plugin-shell-extensions.c
+++ b/plugins/shell-extensions/gs-plugin-shell-extensions.c
@@ -22,6 +22,7 @@
 #include <config.h>
 
 #include <errno.h>
+#include <glib/gi18n.h>
 #include <json-glib/json-glib.h>
 
 #include <gnome-software.h>
@@ -633,7 +634,7 @@ gs_plugin_shell_extensions_get_apps (GsPlugin *plugin,
        g_autofree gchar *uri = NULL;
        g_autoptr(GFile) cachefn_file = NULL;
        g_autoptr(GBytes) data = NULL;
-       g_autoptr(GsApp) dummy = gs_app_new (gs_plugin_get_name (plugin));
+       g_autoptr(GsApp) app_dl = gs_app_new (gs_plugin_get_name (plugin));
 
        /* look in the cache */
        cachefn = gs_utils_get_cache_filename ("extensions",
@@ -656,7 +657,10 @@ gs_plugin_shell_extensions_get_apps (GsPlugin *plugin,
        /* create the GET data */
        uri = g_strdup_printf ("%s/static/extensions.json",
                               SHELL_EXTENSIONS_API_URI);
-       data = gs_plugin_download_data (plugin, dummy, uri, cancellable, error);
+       gs_app_set_summary_missing (app_dl,
+                                   /* TRANSLATORS: status text when downloading */
+                                   _("Downloading shell extension metadata…"));
+       data = gs_plugin_download_data (plugin, app_dl, uri, cancellable, error);
        if (data == NULL) {
                gs_utils_error_add_unique_id (error, priv->cached_origin);
                return NULL;
diff --git a/plugins/steam/gs-plugin-steam.c b/plugins/steam/gs-plugin-steam.c
index 7f1d488..daa58e8 100644
--- a/plugins/steam/gs-plugin-steam.c
+++ b/plugins/steam/gs-plugin-steam.c
@@ -21,6 +21,7 @@
 
 #include <config.h>
 
+#include <glib/gi18n.h>
 #include <gnome-software.h>
 #include <string.h>
 
@@ -596,6 +597,9 @@ gs_plugin_steam_update_store_app (GsPlugin *plugin,
        if (!g_file_test (cache_fn, G_FILE_TEST_EXISTS)) {
                g_autoptr(GsApp) app_dl = gs_app_new (gs_plugin_get_name (plugin));
                uri = g_strdup_printf ("http://store.steampowered.com/app/%s/";, gameid_str);
+               gs_app_set_summary_missing (app_dl,
+                                           /* TRANSLATORS: status text when downloading */
+                                           _("Downloading application page…"));
                if (!gs_plugin_download_file (plugin,
                                              app_dl,
                                              uri,
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 160f79a..6c54871 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -69,13 +69,19 @@ src/gs-upgrade-banner.ui
 src/org.gnome.Software.desktop.in
 src/org.gnome.Software.Editor.desktop.in
 plugins/core/gs-desktop-common.c
-plugins/external-appstream/gs-install-appstream.c
-plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
+plugins/core/gs-plugin-appstream.c
 plugins/core/gs-plugin-generic-updates.c
+plugins/core/gs-plugin-rewrite-resource.c
 plugins/epiphany/org.gnome.Software.Plugin.Epiphany.metainfo.xml.in
+plugins/external-appstream/gs-install-appstream.c
+plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
 plugins/flatpak/org.gnome.Software.Plugin.Flatpak.metainfo.xml.in
+plugins/fwupd/gs-plugin-fwupd.c
 plugins/fwupd/org.gnome.Software.Plugin.Fwupd.metainfo.xml.in
 plugins/limba/org.gnome.Software.Plugin.Limba.metainfo.xml.in
+plugins/odrs/gs-plugin-odrs.c
 plugins/odrs/org.gnome.Software.Plugin.Odrs.metainfo.xml.in
+plugins/shell-extensions/gs-plugin-shell-extensions.c
 plugins/snap/org.gnome.Software.Plugin.Snap.metainfo.xml.in
+plugins/steam/gs-plugin-steam.c
 plugins/steam/org.gnome.Software.Plugin.Steam.metainfo.xml.in
diff --git a/src/gs-editor.c b/src/gs-editor.c
index fe02698..bcc5f7c 100644
--- a/src/gs-editor.c
+++ b/src/gs-editor.c
@@ -59,7 +59,7 @@ gs_editor_css_download_resources (GsEditor *self, const gchar *css, GError **err
                                                      SOUP_SESSION_TIMEOUT, 10,
                                                      NULL);
        gs_plugin_set_soup_session (plugin, soup_session);
-       return gs_plugin_download_rewrite_resource (plugin, css, NULL, error);
+       return gs_plugin_download_rewrite_resource (plugin, NULL, css, NULL, error);
 }
 
 static gchar *
diff --git a/src/gs-loading-page.c b/src/gs-loading-page.c
index 5b6cd55..44a5d0c 100644
--- a/src/gs-loading-page.c
+++ b/src/gs-loading-page.c
@@ -53,21 +53,23 @@ gs_loading_page_status_changed_cb (GsPluginLoader *plugin_loader,
                                    GsLoadingPage *self)
 {
        GsLoadingPagePrivate *priv = gs_loading_page_get_instance_private (self);
+       const gchar *str = NULL;
 
        /* update label */
-       switch (status) {
-       case GS_PLUGIN_STATUS_DOWNLOADING:
-               gtk_label_set_label (GTK_LABEL (priv->label),
-                                    /* TRANSLATORS: initial start */
-                                    _("Software catalog is being downloaded"));
-               break;
-       default:
-               gtk_label_set_label (GTK_LABEL (priv->label),
-                                    /* TRANSLATORS: initial start */
-                                    _("Software catalog is being loaded"));
-               break;
+       if (status == GS_PLUGIN_STATUS_DOWNLOADING) {
+               str = gs_app_get_summary_missing (app);
+               if (str == NULL) {
+                       /* TRANSLATORS: initial start */
+                       str = _("Software catalog is being downloaded");
+               }
+       } else {
+               /* TRANSLATORS: initial start */
+               str = _("Software catalog is being loaded");
        }
 
+       /* update label */
+       gtk_label_set_label (GTK_LABEL (priv->label), str);
+
        /* update progresbar */
        if (app != NULL) {
                gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progressbar),


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