[gnome-software/wip/kalev/gnome-3-22-prep: 37/52] trivial: Merge some common code



commit 848a497b26e3105e6af3fb3e8514413727c49c06
Author: Richard Hughes <richard hughsie com>
Date:   Fri Oct 21 13:51:41 2016 +0100

    trivial: Merge some common code
    
    (cherry picked from commit 3a067fae505c756c6d39b4094d2d85e73bfc34e8)

 src/plugins/gs-flatpak.c |   52 +++++++++++----------------------------------
 1 files changed, 13 insertions(+), 39 deletions(-)
---
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 57c1bc9..ff2cc28 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -349,12 +349,15 @@ gs_flatpak_refresh_appstream_remote (GsFlatpak *self,
                                     GCancellable *cancellable,
                                     GError **error)
 {
-       return flatpak_installation_update_appstream_sync (self->installation,
-                                                          remote_name,
-                                                          NULL, /* arch */
-                                                          NULL, /* out_changed */
-                                                          cancellable,
-                                                          error);
+       if (!flatpak_installation_update_appstream_sync (self->installation,
+                                                        remote_name,
+                                                        NULL,
+                                                        NULL,
+                                                        cancellable,
+                                                        error)) {
+               return FALSE;
+       }
+       return TRUE;
 }
 
 static gboolean
@@ -412,11 +415,8 @@ gs_flatpak_refresh_appstream (GsFlatpak *self, guint cache_age,
                                                           &error_local);
                if (!ret) {
                        if (g_error_matches (error_local,
-                                            G_IO_ERROR,
-                                            G_IO_ERROR_FAILED) ||
-                           g_error_matches (error_local,
-                                            G_IO_ERROR,
-                                            G_IO_ERROR_NOT_FOUND)) {
+                                            GS_PLUGIN_ERROR,
+                                            GS_PLUGIN_ERROR_FAILED)) {
                                g_debug ("Failed to get AppStream metadata: %s",
                                         error_local->message);
                                /* don't try to fetch this again until refresh() */
@@ -2228,32 +2228,6 @@ gs_flatpak_file_to_app_repo (GsFlatpak *self,
 }
 
 static gboolean
-gs_flatpak_update_appstream_for_remote (GsFlatpak *self,
-                                       const gchar *remote_name,
-                                       GCancellable *cancellable,
-                                       GError **error)
-{
-       g_autoptr(AsProfileTask) ptask = NULL;
-
-       /* search categories for the search term */
-       ptask = as_profile_start (gs_plugin_get_profile (self->plugin),
-                                 "flatpak::update-appstream{%s}",
-                                 remote_name);
-       g_assert (ptask != NULL);
-
-       /* get the new appstream data */
-       if (!flatpak_installation_update_appstream_sync (self->installation,
-                                                        remote_name,
-                                                        NULL,
-                                                        NULL,
-                                                        cancellable,
-                                                        error)) {
-               return FALSE;
-       }
-       return TRUE;
-}
-
-static gboolean
 gs_flatpak_file_to_app_ref (GsFlatpak *self,
                            GsAppList *list,
                            GFile *file,
@@ -2341,8 +2315,8 @@ gs_flatpak_file_to_app_ref (GsFlatpak *self,
        gs_app_set_origin_ui (app, origin_title);
 
        /* get the new appstream data */
-       if (!gs_flatpak_update_appstream_for_remote (self, remote_name,
-                                                    cancellable, error)) {
+       if (!gs_flatpak_refresh_appstream_remote (self, remote_name,
+                                                 cancellable, error)) {
                return FALSE;
        }
 


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