Commit f03f8f98 authored by Christian Hergert's avatar Christian Hergert

flatpak: ignore .Sources refs

This also unifies into a single ignore function so that we don't have to
duplicate things.
parent 1cc7bfef
......@@ -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));
}
}
......
......@@ -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 */
......
......@@ -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");
}
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment