[gnome-builder] flatpak: ignore .Sources refs



commit f03f8f98fc365e827f02b8af8aee7782e53f226e
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jun 18 18:30:53 2017 -0700

    flatpak: ignore .Sources refs
    
    This also unifies into a single ignore function so that we don't have to
    duplicate things.

 plugins/flatpak/gbp-flatpak-application-addin.c |   14 +++-----------
 plugins/flatpak/gbp-flatpak-preferences-addin.c |   11 ++---------
 plugins/flatpak/gbp-flatpak-util.c              |   15 +++++++++++++++
 plugins/flatpak/gbp-flatpak-util.h              |    5 +++--
 4 files changed, 23 insertions(+), 22 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-application-addin.c b/plugins/flatpak/gbp-flatpak-application-addin.c
index 5d6375d..faed205 100644
--- a/plugins/flatpak/gbp-flatpak-application-addin.c
+++ b/plugins/flatpak/gbp-flatpak-application-addin.c
@@ -22,6 +22,7 @@
 
 #include "gbp-flatpak-application-addin.h"
 #include "gbp-flatpak-runtime.h"
+#include "gbp-flatpak-util.h"
 
 typedef struct
 {
@@ -86,16 +87,6 @@ static BuiltinFlatpakRepo builtin_flatpak_repos[] = {
 
 static void gbp_flatpak_application_addin_reload (GbpFlatpakApplicationAddin *self);
 
-static gboolean
-is_ignored (FlatpakRef *ref)
-{
-  const gchar *name = flatpak_ref_get_name (ref);
-
-  return g_str_has_suffix (name, ".Locale") ||
-         g_str_has_suffix (name, ".Debug") ||
-         g_str_has_suffix (name, ".Var");
-}
-
 static void
 install_info_installation_changed (GFileMonitor      *monitor,
                                    GFile             *file,
@@ -359,8 +350,9 @@ gbp_flatpak_application_addin_get_runtimes (GbpFlatpakApplicationAddin *self)
           for (guint j = 0; j < ar->len; j++)
             {
               FlatpakInstalledRef *ref = g_ptr_array_index (ar, j);
+              const gchar *name = flatpak_ref_get_name (ref);
 
-              if (!is_ignored (FLATPAK_REF (ref)))
+              if (!gbp_flatpak_is_ignored (name))
                 g_ptr_array_add (ret, g_object_ref (ref));
             }
         }
diff --git a/plugins/flatpak/gbp-flatpak-preferences-addin.c b/plugins/flatpak/gbp-flatpak-preferences-addin.c
index 5487677..30ff1f2 100644
--- a/plugins/flatpak/gbp-flatpak-preferences-addin.c
+++ b/plugins/flatpak/gbp-flatpak-preferences-addin.c
@@ -25,6 +25,7 @@
 #include "gbp-flatpak-application-addin.h"
 #include "gbp-flatpak-preferences-addin.h"
 #include "gbp-flatpak-transfer.h"
+#include "gbp-flatpak-util.h"
 
 struct _GbpFlatpakPreferencesAddin
 {
@@ -51,14 +52,6 @@ gbp_flatpak_preferences_addin_view_more (GbpFlatpakPreferencesAddin *self,
     gbp_flatpak_preferences_addin_reload (self);
 }
 
-static gboolean
-is_ignored (const gchar *name)
-{
-  return g_str_has_suffix (name, ".Locale") ||
-         g_str_has_suffix (name, ".Debug") ||
-         g_str_has_suffix (name, ".Var");
-}
-
 static GtkWidget *
 create_row (GbpFlatpakPreferencesAddin *self,
             const gchar                *name,
@@ -287,7 +280,7 @@ gbp_flatpak_preferences_addin_reload_cb (GObject      *object,
       GtkWidget *row;
       guint id;
 
-      if (is_ignored (name))
+      if (gbp_flatpak_is_ignored (name))
         continue;
 
       /* Don't show this item by default if it's not GNOME or an old branch */
diff --git a/plugins/flatpak/gbp-flatpak-util.c b/plugins/flatpak/gbp-flatpak-util.c
index 6203f8b..9c785b0 100644
--- a/plugins/flatpak/gbp-flatpak-util.c
+++ b/plugins/flatpak/gbp-flatpak-util.c
@@ -18,6 +18,8 @@
 
 #define G_LOG_DOMAIN "gbp-flatpak-util"
 
+#include <flatpak.h>
+
 #include "gbp-flatpak-util.h"
 
 gchar *
@@ -71,3 +73,16 @@ gbp_flatpak_get_staging_dir (IdeConfiguration *configuration)
                            runtime_id,
                            NULL);
 }
+
+gboolean
+gbp_flatpak_is_ignored (const gchar *name)
+{
+  if (name == NULL)
+    return TRUE;
+
+  return g_str_has_suffix (name, ".Locale") ||
+         g_str_has_suffix (name, ".Debug") ||
+         g_str_has_suffix (name, ".Sources") ||
+         g_str_has_suffix (name, ".Var");
+}
+
diff --git a/plugins/flatpak/gbp-flatpak-util.h b/plugins/flatpak/gbp-flatpak-util.h
index f3afc22..8e57d37 100644
--- a/plugins/flatpak/gbp-flatpak-util.h
+++ b/plugins/flatpak/gbp-flatpak-util.h
@@ -23,8 +23,9 @@
 
 G_BEGIN_DECLS
 
-gchar *gbp_flatpak_get_repo_dir    (IdeConfiguration *configuration);
-gchar *gbp_flatpak_get_staging_dir (IdeConfiguration *configuration);
+gboolean  gbp_flatpak_is_ignored      (const gchar      *name);
+gchar    *gbp_flatpak_get_repo_dir    (IdeConfiguration *configuration);
+gchar    *gbp_flatpak_get_staging_dir (IdeConfiguration *configuration);
 
 G_END_DECLS
 


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