[gnome-software] Allow filtering by the default flatpak branch
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Allow filtering by the default flatpak branch
- Date: Thu, 6 Oct 2016 10:45:21 +0000 (UTC)
commit 5fa03af8e7f1ff60cc4af81a91d1a105cacf545a
Author: Richard Hughes <richard hughsie com>
Date: Thu Oct 6 11:30:17 2016 +0100
Allow filtering by the default flatpak branch
configure.ac | 2 +-
data/org.gnome.software.gschema.xml | 4 ++++
src/plugins/gs-flatpak.c | 15 +++++++++++++++
3 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0a7c49f..f115c23 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/data/org.gnome.software.gschema.xml b/data/org.gnome.software.gschema.xml
index 92e6e07..c33924f 100644
--- a/data/org.gnome.software.gschema.xml
+++ b/data/org.gnome.software.gschema.xml
@@ -18,6 +18,10 @@
<default>false</default>
<summary>Show star ratings next to applications</summary>
</key>
+ <key name="filter-default-branch" type="b">
+ <default>true</default>
+ <summary>Filter applications based on the default branch set for the remote</summary>
+ </key>
<key name="prompt-for-nonfree" type="b">
<default>true</default>
<summary>Non-free applications show a warning dialog before install</summary>
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 483ea31..f64fd19 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -193,10 +193,12 @@ 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;
g_autoptr(GFile) file = NULL;
+ g_autoptr(GSettings) settings = NULL;
/* get the AppStream data location */
appstream_dir = flatpak_remote_get_appstream_dir (xremote, NULL);
@@ -232,6 +234,11 @@ gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
only_app_id = g_strdup_printf ("%s.desktop", tmp);
}
+ /* do we want to filter to the default branch */
+ settings = g_settings_new ("org.gnome.software");
+ if (g_settings_get_boolean (settings, "filter-default-branch"))
+ 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++) {
@@ -244,6 +251,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]