[gnome-software] gs-content-rating: Drop function if appstream-glib is new enough



commit 6365017a2c9ffbca7dc16ef68abb7d0c80315ef8
Author: Philip Withnall <withnall endlessm com>
Date:   Thu May 21 11:22:38 2020 +0100

    gs-content-rating: Drop function if appstream-glib is new enough
    
    If appstream-glib is new enough, use its version of
    gs_content_rating_get_all_rating_ids(). Eventually, we can drop ours.
    
    This introduces no functional changes.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 src/gs-content-rating.c | 2 ++
 src/gs-content-rating.h | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-content-rating.c b/src/gs-content-rating.c
index 8984983b..fe214013 100644
--- a/src/gs-content-rating.c
+++ b/src/gs-content-rating.c
@@ -383,6 +383,7 @@ gs_content_rating_key_value_to_str (const gchar *id, AsContentRatingValue value)
        return NULL;
 }
 
+#if !AS_CHECK_VERSION(0, 7, 15)
 /* Equivalent to as_content_rating_get_all_rating_ids() */
 const gchar **
 gs_content_rating_get_all_rating_ids (void)
@@ -395,6 +396,7 @@ gs_content_rating_get_all_rating_ids (void)
 
        return (const gchar **) g_ptr_array_free (g_steal_pointer (&ids), FALSE);
 }
+#endif  /* appstream-glib < 0.7.15 */
 
 static char *
 get_esrb_string (gchar *source, gchar *translate)
diff --git a/src/gs-content-rating.h b/src/gs-content-rating.h
index 5494f2b5..58b17c76 100644
--- a/src/gs-content-rating.h
+++ b/src/gs-content-rating.h
@@ -38,7 +38,12 @@ gchar *gs_utils_content_rating_age_to_str (GsContentRatingSystem system,
 GsContentRatingSystem gs_utils_content_rating_system_from_locale (const gchar *locale);
 const gchar *gs_content_rating_key_value_to_str (const gchar *id,
                                                 AsContentRatingValue value);
-const gchar **gs_content_rating_get_all_rating_ids (void);
 const gchar *gs_content_rating_system_to_str (GsContentRatingSystem system);
 
+#if AS_CHECK_VERSION(0, 7, 15)
+#define gs_content_rating_get_all_rating_ids as_content_rating_get_all_rating_ids
+#else
+const gchar **gs_content_rating_get_all_rating_ids (void);
+#endif
+
 G_END_DECLS


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