[gnome-software] Run the initial AppStream xdgapp fillup later in application startup



commit 4dbfc203cb713ed73e7ba1f3354c0b5819a96d8c
Author: Richard Hughes <richard hughsie com>
Date:   Thu Feb 11 17:18:46 2016 +0000

    Run the initial AppStream xdgapp fillup later in application startup
    
    It appears doing this too early means the UI does not come up, and users think
    this means crashed. Do the fillup when we get the installed list and do not
    fail the method if a repo is not available for example.

 src/plugins/gs-plugin-xdg-app.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/gs-plugin-xdg-app.c b/src/plugins/gs-plugin-xdg-app.c
index 74a23e8..b9af1c7 100644
--- a/src/plugins/gs-plugin-xdg-app.c
+++ b/src/plugins/gs-plugin-xdg-app.c
@@ -251,10 +251,6 @@ gs_plugin_ensure_installation (GsPlugin *plugin,
        g_signal_connect (plugin->priv->monitor, "changed",
                          G_CALLBACK (gs_plugin_xdg_app_changed_cb), plugin);
 
-       /* if we've never ever run before, get at least the AppStream data */
-       if (!gs_plugin_refresh_appstream (plugin, G_MAXUINT, cancellable, error))
-               return FALSE;
-
        /* success */
        return TRUE;
 }
@@ -424,6 +420,7 @@ gs_plugin_add_installed (GsPlugin *plugin,
                         GCancellable *cancellable,
                         GError **error)
 {
+       g_autoptr(GError) error_md = NULL;
        g_autoptr(GPtrArray) xrefs = NULL;
        guint i;
 
@@ -431,6 +428,15 @@ gs_plugin_add_installed (GsPlugin *plugin,
        if (!gs_plugin_ensure_installation (plugin, cancellable, error))
                return FALSE;
 
+       /* if we've never ever run before, get the AppStream data */
+       if (!gs_plugin_refresh_appstream (plugin,
+                                         G_MAXUINT,
+                                         cancellable,
+                                         &error_md)) {
+               g_warning ("failed to get initial available data: %s",
+                          error_md->message);
+       }
+
        /* get apps and runtimes */
        xrefs = xdg_app_installation_list_installed_refs (plugin->priv->installation,
                                                          cancellable, error);


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