[gnome-software/wip/rancell/apt] Revert "Refresh appstream index if needed"



commit 6b61f0392d2529dedd4298a91ebcd9dbfb03375a
Author: William Hua <william hua canonical com>
Date:   Thu Mar 17 10:02:57 2016 -0400

    Revert "Refresh appstream index if needed"
    
    This reverts commit 3c720785c99c4f56a8fb6a4b86632a4e5d056417.

 src/plugins/gs-plugin-appstream.c |   71 -------------------------------------
 1 files changed, 0 insertions(+), 71 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index ea6d8c2..4f47533 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -26,7 +26,6 @@
 #include <gs-utils.h>
 #include <gs-plugin.h>
 #include <gs-plugin-loader.h>
-#include <gs-application.h>
 
 #include "gs-appstream.h"
 
@@ -152,73 +151,6 @@ gs_plugin_appstream_get_origins_hash (GPtrArray *array)
        return origins;
 }
 
-#define APP_INFO_PATH "/var/lib/app-info"
-#define REFRESH_TIMEOUT 1000
-
-static gboolean
-needs_refresh (GsPlugin *plugin)
-{
-       g_autoptr(GDir) dir = g_dir_open (APP_INFO_PATH, 0, NULL);
-
-       return dir == NULL || g_dir_read_name (dir) == NULL;
-}
-
-static void
-refreshed_cb (GObject      *source_object,
-             GAsyncResult *res,
-             gpointer      user_data)
-{
-       GsPlugin *plugin = user_data;
-       GsPluginLoader *loader = GS_PLUGIN_LOADER (source_object);
-
-       if (gs_plugin_loader_refresh_finish (loader, res, NULL))
-               gs_plugin_updates_changed (plugin);
-}
-
-static void
-start_refresh (GsPlugin *plugin)
-{
-       GApplication *application;
-       GsPluginLoader *loader;
-
-       application = g_application_get_default ();
-
-       loader = gs_application_get_plugin_loader (GS_APPLICATION (application));
-
-       gs_plugin_loader_refresh_async (loader,
-                                       0,
-                                       GS_PLUGIN_REFRESH_FLAGS_UPDATES,
-                                       NULL,
-                                       refreshed_cb,
-                                       plugin);
-}
-
-static gboolean
-ask_refresh (gpointer user_data)
-{
-       GApplication *application;
-       GtkWindow *parent;
-       GtkWidget *dialog;
-
-       application = g_application_get_default ();
-
-       parent = gtk_application_get_active_window (GTK_APPLICATION (application));
-
-       dialog = gtk_message_dialog_new (parent,
-                                        GTK_DIALOG_MODAL |
-                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_QUESTION,
-                                        GTK_BUTTONS_YES_NO,
-                                        _("An update is needed to show all installable apps. Download 
now?"));
-
-       if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
-               start_refresh (user_data);
-
-       gtk_widget_destroy (dialog);
-
-       return G_SOURCE_REMOVE;
-}
-
 /**
  * gs_plugin_appstream_startup:
  *
@@ -242,9 +174,6 @@ gs_plugin_appstream_startup (GsPlugin *plugin, GError **error)
 
        ptask = as_profile_start_literal (plugin->profile, "appstream::startup");
 
-       if (needs_refresh (plugin))
-               gdk_threads_add_timeout (REFRESH_TIMEOUT, ask_refresh, plugin);
-
        /* Parse the XML */
        if (g_getenv ("GNOME_SOFTWARE_PREFER_LOCAL") != NULL) {
                as_store_set_add_flags (plugin->priv->store,


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