[gnome-software/wip/rancell/featured-snap] snap: Replace other featured apps with snaps



commit a955b60bd9c17ac81b6e57c6dcda4921ae451c53
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed Aug 9 15:43:02 2017 +1200

    snap: Replace other featured apps with snaps

 plugins/snap/gs-plugin-snap.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index d9604e7..4cfd112 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -59,6 +59,7 @@ gs_plugin_initialize (GsPlugin *plugin)
 
        gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "desktop-categories");
        gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "ubuntu-reviews");
+       gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "appstream");
        gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_BETTER_THAN, "packagekit");
        gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_BEFORE, "icons");
 
@@ -302,6 +303,12 @@ gs_plugin_destroy (GsPlugin *plugin)
        g_clear_pointer (&priv->store_snaps, g_hash_table_unref);
 }
 
+static gboolean
+remove_cb (GsApp *app, gpointer user_data)
+{
+       return FALSE;
+}
+
 gboolean
 gs_plugin_add_featured (GsPlugin *plugin,
                        GsAppList *list,
@@ -364,6 +371,8 @@ gs_plugin_add_featured (GsPlugin *plugin,
                               background_css);
        gs_app_set_metadata (app, "GnomeSoftware::FeatureTile-css", css);
 
+       /* replace any other featured apps with our one */
+       gs_app_list_filter (list, remove_cb, NULL);
        gs_app_list_add (list, app);
 
        return TRUE;


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