libmalcontent-ui: Add an explicit array length argument to a function
This aligns the copy of the API here with what’s being proposed in appstream-glib (https://github.com/hughsie/appstream-glib/pull/364). In a few commits’ time, this copy will be deprecated. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
150d303d39
commit
2a87b85fe1
3 changed files with 16 additions and 6 deletions
|
@ -319,7 +319,7 @@ update_categories_from_language (MctUserControls *self)
|
|||
g_auto(GStrv) entries = NULL;
|
||||
const gchar *rating_system_str;
|
||||
const guint *ages;
|
||||
gsize i;
|
||||
gsize i, n_ages;
|
||||
g_autofree gchar *disabled_action = NULL;
|
||||
|
||||
rating_system = get_content_rating_system (self);
|
||||
|
@ -328,7 +328,7 @@ update_categories_from_language (MctUserControls *self)
|
|||
g_debug ("Using rating system %s", rating_system_str);
|
||||
|
||||
entries = gs_utils_content_rating_get_values (rating_system);
|
||||
ages = gs_utils_content_rating_get_ages (rating_system);
|
||||
ages = gs_utils_content_rating_get_ages (rating_system, &n_ages);
|
||||
|
||||
/* Fill in the age menu */
|
||||
g_menu_remove_all (self->age_menu);
|
||||
|
@ -346,6 +346,8 @@ update_categories_from_language (MctUserControls *self)
|
|||
|
||||
g_menu_append (self->age_menu, entries[i], action);
|
||||
}
|
||||
|
||||
g_assert (i == n_ages);
|
||||
}
|
||||
|
||||
/* Returns a human-readable but untranslated string, not suitable
|
||||
|
@ -684,13 +686,14 @@ on_set_age_action_activated (GSimpleAction *action,
|
|||
const guint *ages;
|
||||
guint age;
|
||||
guint i;
|
||||
gsize n_ages;
|
||||
|
||||
self = MCT_USER_CONTROLS (user_data);
|
||||
age = g_variant_get_uint32 (param);
|
||||
|
||||
rating_system = get_content_rating_system (self);
|
||||
entries = gs_utils_content_rating_get_values (rating_system);
|
||||
ages = gs_utils_content_rating_get_ages (rating_system);
|
||||
ages = gs_utils_content_rating_get_ages (rating_system, &n_ages);
|
||||
|
||||
/* Update the button */
|
||||
if (age == oars_disabled_age)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue