[gnome-software] Check the flatpak's user level for runtimes too



commit e1275236d32c7c2ce3a4a41cfc48b900e58e7913
Author: Joaquim Rocha <jrocha endlessm com>
Date:   Tue Jul 26 14:14:31 2016 +0100

    Check the flatpak's user level for runtimes too
    
    When a runtime is missing in the system installation, we should verify
    the user's because it can be a runtime extension (e.g. an add-on for
    Firefox) that belongs only to the user.

 src/plugins/gs-flatpak.c |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index f2498f5..fdaa88a 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -838,6 +838,17 @@ refine_origin_from_installation (GsFlatpak *self,
        return FALSE;
 }
 
+static FlatpakInstallation *
+gs_flatpak_get_installation_counterpart (GsFlatpak *self,
+                                        GCancellable *cancellable,
+                                        GError **error)
+{
+       if (flatpak_installation_get_is_user (self->installation))
+               return flatpak_installation_new_system (cancellable, error);
+
+       return flatpak_installation_new_user (cancellable, error);
+}
+
 static gboolean
 gs_plugin_refine_item_origin (GsFlatpak *self,
                              GsApp *app,
@@ -979,13 +990,13 @@ gs_plugin_refine_item_state (GsFlatpak *self,
                return FALSE;
 
        /* special case: if this is per-user instance and the runtime is
-        * available system-wide then mark it installed */
-       if (flatpak_installation_get_is_user (self->installation) &&
-           gs_app_get_flatpak_kind (app) == FLATPAK_REF_KIND_RUNTIME &&
+        * available system-wide then mark it installed, and vice-versa */
+       if (gs_app_get_flatpak_kind (app) == FLATPAK_REF_KIND_RUNTIME &&
            gs_app_get_state (app) == AS_APP_STATE_UNKNOWN) {
-               g_autoptr(FlatpakInstallation) installation = NULL;
-               installation = flatpak_installation_new_system (cancellable,
-                                                               error);
+               g_autoptr(FlatpakInstallation) installation =
+                       gs_flatpak_get_installation_counterpart (self,
+                                                                cancellable,
+                                                                error);
                if (installation == NULL)
                        return FALSE;
                xrefs = flatpak_installation_list_installed_refs (installation,


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