[gnome-software] Award a kudo if an application ships an AppData screenshot
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Award a kudo if an application ships an AppData screenshot
- Date: Thu, 27 Feb 2014 14:39:55 +0000 (UTC)
commit aa9ab267fb7677e8a3768905764f4a519360768e
Author: Richard Hughes <richard hughsie com>
Date: Thu Feb 27 14:33:09 2014 +0000
Award a kudo if an application ships an AppData screenshot
src/gs-app.c | 4 ++++
src/gs-app.h | 1 +
src/plugins/gs-plugin-appdata.c | 1 +
src/plugins/gs-plugin-appstream.c | 1 +
4 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index e6efbf2..f1ffab9 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -243,6 +243,8 @@ gs_app_to_string (GsApp *app)
g_string_append (str, "\tkudo:\tuses-app-menu\n");
if ((priv->kudos & GS_APP_KUDO_HAS_KEYWORDS) > 0)
g_string_append (str, "\tkudo:\thas-keywords\n");
+ if ((priv->kudos & GS_APP_KUDO_HAS_SCREENSHOTS) > 0)
+ g_string_append (str, "\tkudo:\thas-screenshots\n");
g_string_append_printf (str, "\tkudo-percentage:\t%i\n",
gs_app_get_kudos_percentage (app));
if (priv->name != NULL)
@@ -1632,6 +1634,8 @@ gs_app_get_kudos_percentage (GsApp *app)
percentage += 5;
if ((app->priv->kudos & GS_APP_KUDO_USES_APP_MENU) > 0)
percentage += 10;
+ if ((app->priv->kudos & GS_APP_KUDO_HAS_SCREENSHOTS) > 0)
+ percentage += 20;
return MIN (percentage, 100);
}
diff --git a/src/gs-app.h b/src/gs-app.h
index 540cc90..2c1419f 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -108,6 +108,7 @@ typedef enum {
GS_APP_KUDO_USES_NOTIFICATIONS = 1 << 6,
GS_APP_KUDO_HAS_KEYWORDS = 1 << 7,
GS_APP_KUDO_USES_APP_MENU = 1 << 8,
+ GS_APP_KUDO_HAS_SCREENSHOTS = 1 << 9,
GS_APP_KUDO_LAST
} GsAppKudo;
diff --git a/src/plugins/gs-plugin-appdata.c b/src/plugins/gs-plugin-appdata.c
index ebab477..972a3a1 100644
--- a/src/plugins/gs-plugin-appdata.c
+++ b/src/plugins/gs-plugin-appdata.c
@@ -250,6 +250,7 @@ appdata_parse_text_cb (GMarkupParseContext *context,
appstream_markup_add_content (helper->markup, text, text_len);
break;
case APPSTREAM_TAG_SCREENSHOT:
+ gs_app_add_kudo (helper->app, GS_APP_KUDO_HAS_SCREENSHOTS);
/* FIXME: actually add to API */
//tmp = appstream_xml_unmunge (text, text_len);
//gs_app_add_screenshot (helper->app, tmp);
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 6bba9fc..f06a243 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -486,6 +486,7 @@ gs_plugin_refine_add_screenshots (GsApp *app, AppstreamApp *item)
return;
/* does the app already have some */
+ gs_app_add_kudo (app, GS_APP_KUDO_HAS_SCREENSHOTS);
if (gs_app_get_screenshots(app)->len > 0)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]