[gnome-software/wip/rancell/featured-snap-3-20: 5/5] snap: Only feature snaps



commit 15e4def8fbaa5620e1ece220c9582e6da14001e7
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed Aug 9 16:54:30 2017 +1200

    snap: Only feature snaps
    
    Run after the other plugins that populate featured apps and remove
    them when we set ours.

 src/plugins/gs-plugin-snap.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-snap.c b/src/plugins/gs-plugin-snap.c
index a8fdece..bab9721 100644
--- a/src/plugins/gs-plugin-snap.c
+++ b/src/plugins/gs-plugin-snap.c
@@ -38,6 +38,16 @@ gs_plugin_get_name (void)
        return "snap";
 }
 
+const gchar **
+gs_plugin_order_after (GsPlugin *plugin)
+{
+       static const gchar *deps[] = {
+               "appstream",
+               "hardcoded-featured",
+               NULL };
+       return deps;
+}
+
 void
 gs_plugin_initialize (GsPlugin *plugin)
 {
@@ -175,6 +185,12 @@ gs_plugin_destroy (GsPlugin *plugin)
        g_hash_table_unref (plugin->priv->store_snaps);
 }
 
+static gboolean
+remove_cb (GsApp *app, gpointer user_data)
+{
+       return FALSE;
+}
+
 gboolean
 gs_plugin_add_featured (GsPlugin *plugin,
                        GList **list,
@@ -242,6 +258,7 @@ gs_plugin_add_featured (GsPlugin *plugin,
        gs_app_set_metadata (app, "Featured::background", background_css->str);
        gs_app_set_metadata (app, "Featured::text-color", "#000000");
 
+       gs_plugin_list_filter (list, remove_cb, NULL);
        gs_plugin_add_app (list, app);
 
        return TRUE;


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