[gnome-software/wip/kalev/gnome-3-22-prep: 21/52] Allow filtering by the default flatpak branch



commit 5023aa1f430a176b08c731325329c6529665f6d1
Author: Kalev Lember <klember redhat com>
Date:   Wed Nov 2 15:57:23 2016 +0100

    Allow filtering by the default flatpak branch
    
    This matches with commit 5fa03af8e7f1ff60cc4af81a91d1a105cacf545a on
    master, except that we don't add a new gsettings key for 3.22 to avoid
    breaking the string freeze.
    
    (cherry picked from commit 5fa03af8e7f1ff60cc4af81a91d1a105cacf545a)

 configure.ac             |    2 +-
 src/plugins/gs-flatpak.c |   11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6e45479..db2db98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -242,7 +242,7 @@ AC_ARG_ENABLE(flatpak,
               enable_flatpak=maybe)
 AS_IF([test "x$enable_flatpak" != "xno"], [
     PKG_CHECK_MODULES(FLATPAK,
-                      [flatpak >= 0.4.14],
+                      [flatpak >= 0.6.12],
                       [have_flatpak=yes],
                       [have_flatpak=no])
 ], [
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 405f433..bc31acd 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -113,6 +113,7 @@ gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
        guint i;
        g_autofree gchar *appstream_dir_fn = NULL;
        g_autofree gchar *appstream_fn = NULL;
+       g_autofree gchar *default_branch = NULL;
        g_autofree gchar *only_app_id = NULL;
        g_autoptr(AsStore) store = NULL;
        g_autoptr(GFile) appstream_dir = NULL;
@@ -151,6 +152,8 @@ gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
                only_app_id = g_strdup_printf ("%s.desktop", tmp);
        }
 
+       default_branch = flatpak_remote_get_default_branch (xremote);
+
        /* get all the apps and fix them up */
        apps = as_store_get_apps (store);
        for (i = 0; i < apps->len; i++) {
@@ -163,6 +166,14 @@ gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
                        continue;
                }
 
+               /* filter by branch */
+               if (default_branch != NULL &&
+                   g_strcmp0 (as_app_get_branch (app), default_branch) != 0) {
+                       g_debug ("not adding app with branch %s as filtering to %s",
+                                as_app_get_branch (app), default_branch);
+                       continue;
+               }
+
                /* fix the names when using old versions of appstream-compose */
                gs_flatpak_remove_prefixed_names (app);
 


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