libmalcontent-ui: Bump appstream-glib dependency to ≥ 0.7.15

This allows some (but not all) of the fallback code to be dropped.
appstream-glib 0.7.17 is available on all versions of Fedora and Debian
which malcontent is packaged for:
 • https://packages.debian.org/search?suite=bullseye&searchon=names&keywords=appstream-glibhttps://src.fedoraproject.org/rpms/libappstream-glib

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2020-10-29 15:10:00 +00:00
parent e1cd202ad5
commit 1371e1c819
3 changed files with 1 additions and 84 deletions

View File

@ -577,51 +577,6 @@ static const struct {
}; };
#endif /* appstream-glib < 0.7.18 */ #endif /* appstream-glib < 0.7.18 */
#if !AS_CHECK_VERSION(0, 7, 15)
/**
* as_content_rating_id_value_to_csm_age:
* @id: the subsection ID e.g. "violence-cartoon"
* @value: the #AsContentRatingValue, e.g. %MCT_APP_FILTER_OARS_VALUE_INTENSE
*
* Gets the Common Sense Media approved age for a specific rating level.
*
* Returns: The age in years, or 0 for no details.
*
* Since: 0.5.12
**/
guint
as_content_rating_id_value_to_csm_age (const gchar *id, MctAppFilterOarsValue value)
{
if (value == AS_CONTENT_RATING_VALUE_UNKNOWN ||
value == AS_CONTENT_RATING_VALUE_LAST)
return 0;
for (gsize i = 0; i < G_N_ELEMENTS (oars_to_csm_mappings); i++) {
if (g_str_equal (id, oars_to_csm_mappings[i].id)) {
switch (value) {
case AS_CONTENT_RATING_VALUE_NONE:
return oars_to_csm_mappings[i].csm_age_none;
case AS_CONTENT_RATING_VALUE_MILD:
return oars_to_csm_mappings[i].csm_age_mild;
case AS_CONTENT_RATING_VALUE_MODERATE:
return oars_to_csm_mappings[i].csm_age_moderate;
case AS_CONTENT_RATING_VALUE_INTENSE:
return oars_to_csm_mappings[i].csm_age_intense;
case AS_CONTENT_RATING_VALUE_UNKNOWN:
case AS_CONTENT_RATING_VALUE_LAST:
default:
/* Handled above. */
g_assert_not_reached ();
return 0;
}
}
}
/* @id not found. */
return 0;
}
#endif /* appstream-glib < 0.7.15 */
#if !AS_CHECK_VERSION(0, 7, 18) #if !AS_CHECK_VERSION(0, 7, 18)
/** /**
* as_content_rating_id_csm_age_to_value: * as_content_rating_id_csm_age_to_value:

View File

@ -36,7 +36,7 @@ libmalcontent_ui_public_deps = [
libmalcontent_dep, libmalcontent_dep,
] ]
libmalcontent_ui_private_deps = [ libmalcontent_ui_private_deps = [
dependency('appstream-glib'), dependency('appstream-glib', version: '>= 0.7.15'),
dependency('flatpak'), dependency('flatpak'),
] ]

View File

@ -167,40 +167,6 @@ static const GActionEntry actions[] = {
{ "set-age", on_set_age_action_activated, "u", NULL, NULL, { 0, }} { "set-age", on_set_age_action_activated, "u", NULL, NULL, { 0, }}
}; };
#if !AS_CHECK_VERSION(0, 7, 15)
static const gchar * const oars_categories[] =
{
"violence-cartoon",
"violence-fantasy",
"violence-realistic",
"violence-bloodshed",
"violence-sexual",
"violence-desecration",
"violence-slavery",
"violence-worship",
"drugs-alcohol",
"drugs-narcotics",
"drugs-tobacco",
"sex-nudity",
"sex-themes",
"sex-homosexuality",
"sex-prostitution",
"sex-adultery",
"sex-appearance",
"language-profanity",
"language-humor",
"language-discrimination",
"social-chat",
"social-info",
"social-audio",
"social-location",
"social-contacts",
"money-purchasing",
"money-gambling",
NULL
};
#endif /* appstream-glib < 0.7.15 */
/* Auxiliary methods */ /* Auxiliary methods */
static GsContentRatingSystem static GsContentRatingSystem
@ -388,9 +354,7 @@ update_oars_level (MctUserControls *self)
guint maximum_age; guint maximum_age;
gsize i; gsize i;
gboolean all_categories_unset; gboolean all_categories_unset;
#if AS_CHECK_VERSION(0, 7, 15)
g_autofree const gchar **oars_categories = as_content_rating_get_all_rating_ids (); g_autofree const gchar **oars_categories = as_content_rating_get_all_rating_ids ();
#endif
g_assert (self->filter != NULL); g_assert (self->filter != NULL);
@ -1495,9 +1459,7 @@ mct_user_controls_build_app_filter (MctUserControls *self,
{ {
gboolean restrict_web_browsers; gboolean restrict_web_browsers;
gsize i; gsize i;
#if AS_CHECK_VERSION(0, 7, 15)
g_autofree const gchar **oars_categories = as_content_rating_get_all_rating_ids (); g_autofree const gchar **oars_categories = as_content_rating_get_all_rating_ids ();
#endif
g_return_if_fail (MCT_IS_USER_CONTROLS (self)); g_return_if_fail (MCT_IS_USER_CONTROLS (self));
g_return_if_fail (builder != NULL); g_return_if_fail (builder != NULL);