[gnome-software] Add a kudo if an application is featured or recommended



commit ab625bb6e72e51f26bee3df2b1e94ddf2f150e14
Author: Richard Hughes <richard hughsie com>
Date:   Wed Feb 26 21:19:23 2014 +0000

    Add a kudo if an application is featured or recommended

 src/plugins/gs-plugin-hardcoded-categories.c |   29 ++++++++++++++++++++++++++
 src/plugins/gs-plugin-hardcoded-featured.c   |    1 +
 src/plugins/gs-plugin-moduleset.c            |    1 +
 3 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-hardcoded-categories.c b/src/plugins/gs-plugin-hardcoded-categories.c
index b967850..286e325 100644
--- a/src/plugins/gs-plugin-hardcoded-categories.c
+++ b/src/plugins/gs-plugin-hardcoded-categories.c
@@ -199,4 +199,33 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
        return TRUE;
 }
 
+/**
+ * gs_plugin_refine:
+ */
+gboolean
+gs_plugin_refine (GsPlugin *plugin,
+                 GList **list,
+                 GsPluginRefineFlags flags,
+                 GCancellable *cancellable,
+                 GError **error)
+{
+       const gchar *id;
+       GList *l;
+       GsApp *app;
+       guint i;
+
+       for (i = 0; i < G_N_ELEMENTS (featured); i++) {
+               for (l = *list; l != NULL; l = l->next) {
+                       app = GS_APP (l->data);
+                       id = gs_app_get_id_full (app);
+                       if (g_strcmp0 (id, featured[i].app) != 0)
+                               continue;
+                       gs_app_add_kudo (app, GS_APP_KUDO_FEATURED_RECOMMENDED);
+               }
+       }
+
+       return TRUE;
+
+}
+
 /* vim: set noexpandtab: */
diff --git a/src/plugins/gs-plugin-hardcoded-featured.c b/src/plugins/gs-plugin-hardcoded-featured.c
index bbf6cbc..35712e7 100644
--- a/src/plugins/gs-plugin-hardcoded-featured.c
+++ b/src/plugins/gs-plugin-hardcoded-featured.c
@@ -69,6 +69,7 @@ gs_plugin_add_featured_app (GList **list,
 
        /* add app */
        app = gs_app_new (id);
+       gs_app_add_kudo (app, GS_APP_KUDO_FEATURED_RECOMMENDED);
        gs_app_set_metadata (app, "Featured::background", background);
        gs_app_set_metadata (app, "Featured::stroke-color", stroke_color);
        gs_app_set_metadata (app, "Featured::text-color", text_color);
diff --git a/src/plugins/gs-plugin-moduleset.c b/src/plugins/gs-plugin-moduleset.c
index 4b90814..65c4cca 100644
--- a/src/plugins/gs-plugin-moduleset.c
+++ b/src/plugins/gs-plugin-moduleset.c
@@ -129,6 +129,7 @@ gs_plugin_add_popular (GsPlugin *plugin,
        for (i = 0; apps[i]; i++) {
                app = gs_app_new (apps[i]);
                gs_plugin_add_app (list, app);
+               gs_app_add_kudo (app, GS_APP_KUDO_FEATURED_RECOMMENDED);
                g_object_unref (app);
        }
 out:


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