[gnome-software] trivial: Add gs_app_has_kudo() convenience function



commit 84cd2217d789a261f52d7a50c2e60642207c4cb6
Author: Richard Hughes <richard hughsie com>
Date:   Tue Sep 20 10:42:26 2016 +0100

    trivial: Add gs_app_has_kudo() convenience function

 src/gs-app.c |   18 ++++++++++++++++++
 src/gs-app.h |    2 ++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 048ee64..30b01e1 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -2948,6 +2948,24 @@ gs_app_add_kudo (GsApp *app, GsAppKudo kudo)
 }
 
 /**
+ * gs_app_has_kudo:
+ * @app: a #GsApp
+ * @kudo: a #GsAppKudo, e.g. %GS_APP_KUDO_MY_LANGUAGE
+ *
+ * Finds out if a kudo has been awarded by the application.
+ *
+ * Returns: %TRUE if the app has the specified kudo
+ *
+ * Since: 3.22
+ **/
+gboolean
+gs_app_has_kudo (GsApp *app, GsAppKudo kudo)
+{
+       g_return_val_if_fail (GS_IS_APP (app), FALSE);
+       return (app->kudos & kudo) > 0;
+}
+
+/**
  * gs_app_get_kudos:
  * @app: a #GsApp
  *
diff --git a/src/gs-app.h b/src/gs-app.h
index 0593365..173cca1 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -271,6 +271,8 @@ void                 gs_app_set_keywords            (GsApp          *app,
                                                 GPtrArray      *keywords);
 void            gs_app_add_kudo                (GsApp          *app,
                                                 GsAppKudo       kudo);
+gboolean        gs_app_has_kudo                (GsApp          *app,
+                                                GsAppKudo       kudo);
 guint64                 gs_app_get_kudos               (GsApp          *app);
 guint           gs_app_get_kudos_percentage    (GsApp          *app);
 gboolean        gs_app_get_to_be_installed     (GsApp          *app);


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