[gnome-software/wip/ubuntu-master] snap: Only feature snaps
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/ubuntu-master] snap: Only feature snaps
- Date: Thu, 17 Aug 2017 23:20:44 +0000 (UTC)
commit 7a6ce654df1bc7357fa1d419ade14de56e3c4335
Author: Robert Ancell <robert ancell canonical com>
Date: Wed Aug 9 15:43:02 2017 +1200
snap: Only feature snaps
Run after the other plugins that populate featured/popular apps and remove
them when we set ours.
plugins/snap/gs-plugin-snap.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index 7210e34..4a1c510 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -59,11 +59,13 @@ 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");
/* Override hardcoded popular apps */
- gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_BEFORE, "hardcoded-popular");
+ gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "hardcoded-popular");
+ gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "hardcoded-featured");
/* set name of MetaInfo file */
gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Snap");
@@ -303,6 +305,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,
@@ -375,6 +383,8 @@ gs_plugin_add_featured (GsPlugin *plugin,
background_css->str);
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;
@@ -393,6 +403,9 @@ gs_plugin_add_popular (GsPlugin *plugin,
if (snaps == NULL)
return FALSE;
+ /* replace any other popular apps with our one */
+ gs_app_list_filter (list, remove_cb, NULL);
+
/* skip first snap - it is used as the featured app */
for (i = 1; i < snaps->len; i++) {
g_autoptr(GsApp) app = snap_to_app (plugin, g_ptr_array_index (snaps, i));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]