Merge branch 'appstream-glib-dep' into 'master'

Bump appstream-glib dep and update content rating code

See merge request pwithnall/malcontent!100
This commit is contained in:
Philip Withnall 2020-12-08 12:18:09 +00:00
commit 351a7811e5
3 changed files with 2 additions and 85 deletions

View File

@ -567,7 +567,7 @@ static const struct {
{ "social-info", OARS_1_0, 0, 0, 13, 13 },
{ "social-location", OARS_1_0, 0, 13, 13, 13 },
/* v1.1 additions */
{ "sex-homosexuality", OARS_1_1, 0, 10, 13, 15 },
{ "sex-homosexuality", OARS_1_1, 0, 13, 14, 15 },
{ "sex-prostitution", OARS_1_1, 0, 12, 14, 18 },
{ "sex-adultery", OARS_1_1, 0, 8, 10, 18 },
{ "sex-appearance", OARS_1_1, 0, 10, 10, 15 },
@ -577,51 +577,6 @@ static const struct {
};
#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)
/**
* as_content_rating_id_csm_age_to_value:

View File

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

View File

@ -166,40 +166,6 @@ static const GActionEntry actions[] = {
{ "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 */
static GsContentRatingSystem
@ -396,9 +362,7 @@ update_oars_level (MctUserControls *self)
guint maximum_age, selected_age;
gsize i;
gboolean all_categories_unset;
#if AS_CHECK_VERSION(0, 7, 15)
g_autofree const gchar **oars_categories = as_content_rating_get_all_rating_ids ();
#endif
g_assert (self->filter != NULL);
@ -1488,9 +1452,7 @@ mct_user_controls_build_app_filter (MctUserControls *self,
{
gboolean restrict_web_browsers;
gsize i;
#if AS_CHECK_VERSION(0, 7, 15)
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 (builder != NULL);