[gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 284/331] Revert "Rely on AsStore to detect cache changes"



commit ee9f2436cbbc89c08a1c34e928c45186f82e63f3
Author: William Hua <william hua canonical com>
Date:   Wed Apr 20 07:33:34 2016 -0400

    Revert "Rely on AsStore to detect cache changes"
    
    This reverts commit 062f0e624b5e193938dfd85076044c1bbbd1a1fb.

 src/gs-application.c              |   21 +++++++++++++++++++--
 src/plugins/gs-plugin-appstream.c |   16 ++++++++++++++++
 2 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index a06dfbb..cad567f 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -243,6 +243,23 @@ gs_application_dbus_unregister (GApplication    *application,
 }
 
 static void
+refreshed_cb (GObject      *source_object,
+             GAsyncResult *res,
+             gpointer      user_data)
+{
+       GsPluginLoader *loader = GS_PLUGIN_LOADER (source_object);
+
+       if (gs_plugin_loader_refresh_finish (loader, res, NULL)) {
+               gs_plugin_loader_refresh_async (loader,
+                                               0,
+                                               GS_PLUGIN_REFRESH_FLAGS_UPDATES,
+                                               NULL,
+                                               NULL,
+                                               NULL);
+       }
+}
+
+static void
 start_refresh (GsApplication *app)
 {
        g_action_group_activate_action (G_ACTION_GROUP (app),
@@ -253,8 +270,8 @@ start_refresh (GsApplication *app)
                                        0,
                                        GS_PLUGIN_REFRESH_FLAGS_UPDATES,
                                        NULL,
-                                       NULL,
-                                       NULL);
+                                       refreshed_cb,
+                                       app);
 }
 
 #define APP_INFO_PATH "/var/lib/app-info"
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 103fc3e..8d3dfe5 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -67,6 +67,22 @@ gs_plugin_appstream_store_changed_cb (AsStore *store, GsPlugin *plugin)
        gs_plugin_updates_changed (plugin);
 }
 
+static gboolean gs_plugin_appstream_startup (GsPlugin *plugin, GError **error);
+
+gboolean
+gs_plugin_refresh (GsPlugin              *plugin,
+                  guint                  cache_age,
+                  GsPluginRefreshFlags   flags,
+                  GCancellable          *cancellable,
+                  GError               **error)
+{
+       plugin->priv->done_init = FALSE;
+       gs_plugin_appstream_startup (plugin, NULL);
+       gs_plugin_updates_changed (plugin);
+
+       return TRUE;
+}
+
 /**
  * gs_plugin_initialize:
  */


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