[gnome-software] trivial: Split out some to-be-shared functionality



commit 12826ab2b0b06a80de56d4020163208928511ff0
Author: Richard Hughes <richard hughsie com>
Date:   Thu Dec 1 14:35:04 2016 +0000

    trivial: Split out some to-be-shared functionality

 src/plugins/gs-plugin-flatpak.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/gs-plugin-flatpak.c b/src/plugins/gs-plugin-flatpak.c
index 945e1ca..579d2ea 100644
--- a/src/plugins/gs-plugin-flatpak.c
+++ b/src/plugins/gs-plugin-flatpak.c
@@ -75,6 +75,16 @@ gs_plugin_initialize (GsPlugin *plugin)
        priv->destdir_for_tests = g_getenv ("GS_SELF_TEST_FLATPACK_DATADIR");
 }
 
+static gboolean
+_as_app_scope_is_compatible (AsAppScope scope1, AsAppScope scope2)
+{
+       if (scope1 == AS_APP_SCOPE_UNKNOWN)
+               return TRUE;
+       if (scope2 == AS_APP_SCOPE_UNKNOWN)
+               return TRUE;
+       return scope1 == scope2;
+}
+
 void
 gs_plugin_destroy (GsPlugin *plugin)
 {
@@ -367,8 +377,7 @@ gs_plugin_file_to_app (GsPlugin *plugin,
        /* run any objects with the corrext scope */
        for (guint i = 0; i < priv->flatpaks->len; i++) {
                GsFlatpak *flatpak = g_ptr_array_index (priv->flatpaks, i);
-               if (scope != AS_APP_SCOPE_UNKNOWN &&
-                   scope != gs_flatpak_get_scope (flatpak)) {
+               if (!_as_app_scope_is_compatible (scope, gs_flatpak_get_scope (flatpak))) {
                        g_debug ("not handling bundle as scope incorrect");
                        continue;
                }


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