[gnome-software] gs-content-rating: Drop all content rating code if as-glib is new enough
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] gs-content-rating: Drop all content rating code if as-glib is new enough
- Date: Tue, 30 Jun 2020 16:39:19 +0000 (UTC)
commit e12b77a21b2d63d96483a6e337559ad666b97f82
Author: Philip Withnall <withnall endlessm com>
Date: Thu May 21 15:54:13 2020 +0100
gs-content-rating: Drop all content rating code if as-glib is new enough
This code has all been moved into appstream-glib 0.7.18
(https://github.com/hughsie/appstream-glib/pull/364), so gnome-software
can ship some compatibility defines until it has a hard dependency on
the new appstream-glib, at which point `gs-content-rating.[ch]` can be
deleted.
gnome-software can’t depend on appstream-glib > 0.7.14 yet, as that’s
what’s in Debian Stable, which is used for CI.
Signed-off-by: Philip Withnall <withnall endlessm com>
src/gs-content-rating.c | 4 ++++
src/gs-content-rating.h | 26 ++++++++++++++++++++++++++
2 files changed, 30 insertions(+)
---
diff --git a/src/gs-content-rating.c b/src/gs-content-rating.c
index fe214013..16c36f6b 100644
--- a/src/gs-content-rating.c
+++ b/src/gs-content-rating.c
@@ -12,6 +12,7 @@
#include <string.h>
#include "gs-content-rating.h"
+#if !AS_CHECK_VERSION(0, 7, 18)
static const gchar *rating_system_names[] = {
[GS_CONTENT_RATING_SYSTEM_UNKNOWN] = NULL,
[GS_CONTENT_RATING_SYSTEM_INCAA] = "INCAA",
@@ -382,6 +383,7 @@ gs_content_rating_key_value_to_str (const gchar *id, AsContentRatingValue value)
return NULL;
}
+#endif /* appstream-glib < 0.7.18 */
#if !AS_CHECK_VERSION(0, 7, 15)
/* Equivalent to as_content_rating_get_all_rating_ids() */
@@ -398,6 +400,7 @@ gs_content_rating_get_all_rating_ids (void)
}
#endif /* appstream-glib < 0.7.15 */
+#if !AS_CHECK_VERSION(0, 7, 18)
static char *
get_esrb_string (gchar *source, gchar *translate)
{
@@ -777,3 +780,4 @@ gs_utils_content_rating_system_from_locale (const gchar *locale)
/* everything else is IARC */
return GS_CONTENT_RATING_SYSTEM_IARC;
}
+#endif /* appstream-glib < 0.7.18 */
diff --git a/src/gs-content-rating.h b/src/gs-content-rating.h
index 58b17c76..cec7011f 100644
--- a/src/gs-content-rating.h
+++ b/src/gs-content-rating.h
@@ -12,6 +12,31 @@ G_BEGIN_DECLS
#include <appstream-glib.h>
#include <glib-object.h>
+#if AS_CHECK_VERSION(0, 7, 18)
+#define GS_CONTENT_RATING_SYSTEM_UNKNOWN AS_CONTENT_RATING_SYSTEM_UNKNOWN
+#define GS_CONTENT_RATING_SYSTEM_INCAA AS_CONTENT_RATING_SYSTEM_INCAA
+#define GS_CONTENT_RATING_SYSTEM_ACB AS_CONTENT_RATING_SYSTEM_ACB
+#define GS_CONTENT_RATING_SYSTEM_DJCTQ AS_CONTENT_RATING_SYSTEM_DJCTQ
+#define GS_CONTENT_RATING_SYSTEM_GSRR AS_CONTENT_RATING_SYSTEM_GSRR
+#define GS_CONTENT_RATING_SYSTEM_PEGI AS_CONTENT_RATING_SYSTEM_PEGI
+#define GS_CONTENT_RATING_SYSTEM_KAVI AS_CONTENT_RATING_SYSTEM_KAVI
+#define GS_CONTENT_RATING_SYSTEM_USK AS_CONTENT_RATING_SYSTEM_USK
+#define GS_CONTENT_RATING_SYSTEM_ESRA AS_CONTENT_RATING_SYSTEM_ESRA
+#define GS_CONTENT_RATING_SYSTEM_CERO AS_CONTENT_RATING_SYSTEM_CERO
+#define GS_CONTENT_RATING_SYSTEM_OFLCNZ AS_CONTENT_RATING_SYSTEM_OFLCNZ
+#define GS_CONTENT_RATING_SYSTEM_RUSSIA AS_CONTENT_RATING_SYSTEM_RUSSIA
+#define GS_CONTENT_RATING_SYSTEM_MDA AS_CONTENT_RATING_SYSTEM_MDA
+#define GS_CONTENT_RATING_SYSTEM_GRAC AS_CONTENT_RATING_SYSTEM_GRAC
+#define GS_CONTENT_RATING_SYSTEM_ESRB AS_CONTENT_RATING_SYSTEM_ESRB
+#define GS_CONTENT_RATING_SYSTEM_IARC AS_CONTENT_RATING_SYSTEM_IARC
+#define GS_CONTENT_RATING_SYSTEM_LAST AS_CONTENT_RATING_SYSTEM_LAST
+#define GsContentRatingSystem AsContentRatingSystem
+
+#define gs_utils_content_rating_age_to_str as_content_rating_system_format_age
+#define gs_utils_content_rating_system_from_locale as_content_rating_system_from_locale
+#define gs_content_rating_key_value_to_str as_content_rating_attribute_get_description
+#define gs_content_rating_system_to_str as_content_rating_system_to_string
+#else
typedef enum {
GS_CONTENT_RATING_SYSTEM_UNKNOWN,
GS_CONTENT_RATING_SYSTEM_INCAA,
@@ -39,6 +64,7 @@ GsContentRatingSystem gs_utils_content_rating_system_from_locale (const gchar *l
const gchar *gs_content_rating_key_value_to_str (const gchar *id,
AsContentRatingValue value);
const gchar *gs_content_rating_system_to_str (GsContentRatingSystem system);
+#endif
#if AS_CHECK_VERSION(0, 7, 15)
#define gs_content_rating_get_all_rating_ids as_content_rating_get_all_rating_ids
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]