[gnome-software] search: Simplify code for switching to the details view



commit 5ddf5f0a548e77e26f047a9dd5f7e8d20b16e798
Author: Kalev Lember <kalevlember gmail com>
Date:   Mon Oct 6 13:10:15 2014 +0200

    search: Simplify code for switching to the details view
    
    No need to have the search page refine the app before passing it to the
    details page; the details page handles it all for us.

 src/gs-shell-search.c |   45 +--------------------------------------------
 1 files changed, 1 insertions(+), 44 deletions(-)
---
diff --git a/src/gs-shell-search.c b/src/gs-shell-search.c
index 21d8cd2..13f4e5f 100644
--- a/src/gs-shell-search.c
+++ b/src/gs-shell-search.c
@@ -235,36 +235,6 @@ gs_shell_search_app_row_clicked_cb (GsAppRow *app_row,
                gs_shell_search_show_missing_url (app);
 }
 
-typedef struct {
-       GsShellSearch *shell_search;
-       GsApp *app;
-} RefineData;
-
-static void
-refine_cb (GObject *source,
-           GAsyncResult *res,
-           gpointer data)
-{
-       RefineData *refine = data;
-       GsShellSearchPrivate *priv = refine->shell_search->priv;
-       GError *error = NULL;
-
-       if (!gs_plugin_loader_app_refine_finish (priv->plugin_loader,
-                                                res,
-                                                &error)) {
-               g_warning ("%s", error->message);
-               g_error_free (error);
-               goto out;
-       }
-
-       refine->app = gs_plugin_loader_dedupe (priv->plugin_loader, refine->app);
-       gs_shell_show_app (priv->shell, refine->app);
-
-out:
-       g_object_unref (refine->app);
-       g_free (refine);
-}
-
 /**
  * gs_shell_search_get_search_cb:
  **/
@@ -323,20 +293,7 @@ gs_shell_search_get_search_cb (GObject *source_object,
        }
 
        if (priv->appid_to_show != NULL) {
-               RefineData *refine;
-
-               refine = g_new0 (RefineData, 1);
-               refine->shell_search = shell_search;
-               refine->app = gs_app_new (priv->appid_to_show);
-               gs_plugin_loader_app_refine_async (priv->plugin_loader,
-                                                  refine->app,
-                                                  GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENCE |
-                                                  GS_PLUGIN_REFINE_FLAGS_REQUIRE_SIZE |
-                                                  GS_PLUGIN_REFINE_FLAGS_REQUIRE_URL,
-                                                  priv->cancellable,
-                                                  refine_cb,
-                                                  refine);
-
+               gs_shell_show_details (priv->shell, priv->appid_to_show);
                g_clear_pointer (&priv->appid_to_show, g_free);
        }
 


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