[gnome-software] Popular applications should imply a certain level of quality



commit 9d95dbe8c292381cbaf7ee5a782dc86606932f98
Author: Richard Hughes <richard hughsie com>
Date:   Wed Apr 9 09:27:20 2014 +0100

    Popular applications should imply a certain level of quality
    
    Discussed with the GNOME designers at LGM, who came up with the idea.

 src/gs-app.c                                  |    7 +++++++
 src/gs-app.h                                  |    1 +
 src/plugins/gs-plugin-appstream.c             |    2 ++
 src/plugins/gs-plugin-fedora-tagger-ratings.c |    5 +++++
 src/plugins/gs-plugin-local-ratings.c         |    2 ++
 5 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 5856428..f786c0b 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:\thas-keywords\n");
        if ((priv->kudos & GS_APP_KUDO_HAS_SCREENSHOTS) > 0)
                g_string_append (str, "\tkudo:\thas-screenshots\n");
+       if ((priv->kudos & GS_APP_KUDO_POPULAR) > 0)
+               g_string_append (str, "\tkudo:\tpopular\n");
        g_string_append_printf (str, "\tkudo-percentage:\t%i\n",
                                gs_app_get_kudos_percentage (app));
        if (priv->name != NULL)
@@ -1672,6 +1674,11 @@ gs_app_get_kudos_percentage (GsApp *app)
                percentage += 10;
        if ((app->priv->kudos & GS_APP_KUDO_HAS_SCREENSHOTS) > 0)
                percentage += 20;
+
+       /* popular apps should be at *least* 50% */
+       if ((app->priv->kudos & GS_APP_KUDO_POPULAR) > 0)
+               percentage = MAX (percentage, 50);
+
        return MIN (percentage, 100);
 }
 
diff --git a/src/gs-app.h b/src/gs-app.h
index 2c1419f..577d4d8 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -109,6 +109,7 @@ typedef enum {
        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_POPULAR                     = 1 << 10,
        GS_APP_KUDO_LAST
 } GsAppKudo;
 
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 848edec..4bcdb6d 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -481,6 +481,8 @@ gs_plugin_refine_item (GsPlugin *plugin,
                gs_app_add_kudo (app, GS_APP_KUDO_RECENT_RELEASE);
        if (as_app_get_metadata_item (item, "X-Kudo-UsesAppMenu") != NULL)
                gs_app_add_kudo (app, GS_APP_KUDO_USES_APP_MENU);
+       if (as_app_get_metadata_item (item, "X-Kudo-Popular") != NULL)
+               gs_app_add_kudo (app, GS_APP_KUDO_POPULAR);
 out:
        return ret;
 }
diff --git a/src/plugins/gs-plugin-fedora-tagger-ratings.c b/src/plugins/gs-plugin-fedora-tagger-ratings.c
index d73d3e6..eebb154 100644
--- a/src/plugins/gs-plugin-fedora-tagger-ratings.c
+++ b/src/plugins/gs-plugin-fedora-tagger-ratings.c
@@ -702,6 +702,11 @@ gs_plugin_refine (GsPlugin *plugin,
                                gs_app_set_rating (app, rating);
                                gs_app_set_rating_confidence (app, confidence);
                                gs_app_set_rating_kind (app, GS_APP_RATING_KIND_SYSTEM);
+                               if (confidence > 50 && rating > 80) {
+                                       g_debug ("%s is popular [confidence %i]",
+                                                gs_app_get_id (app), confidence);
+                                       gs_app_add_kudo (app, GS_APP_KUDO_POPULAR);
+                               }
                        }
                }
        }
diff --git a/src/plugins/gs-plugin-local-ratings.c b/src/plugins/gs-plugin-local-ratings.c
index e0dda05..d4a96dd 100644
--- a/src/plugins/gs-plugin-local-ratings.c
+++ b/src/plugins/gs-plugin-local-ratings.c
@@ -240,6 +240,8 @@ gs_plugin_refine (GsPlugin *plugin,
                        gs_app_set_rating (app, rating);
                        gs_app_set_rating_confidence (app, 100);
                        gs_app_set_rating_kind (app, GS_APP_RATING_KIND_USER);
+                       if (rating > 80)
+                               gs_app_add_kudo (app, GS_APP_KUDO_POPULAR);
                }
        }
 out:


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