libmalcontent-ui: Load restricted apps and OARS when loading app filter

While the label for the OARS pseudo-combobox was updated when loading a
user’s app filter, the internal state (`self->selected_age`) was not.
Similarly, the set of restricted apps wasn’t loaded until the restricted
apps dialog was opened.

This caused problems when loading a user’s parental controls and then
editing a control which *wasn’t* restricted apps or the OARS level. The
resulting app filter would be built using default values for those two
controls, overwriting and losing their previous values when it was
saved.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2020-10-29 19:22:13 +00:00
parent e7588a2333
commit ecfb3035d5
1 changed files with 14 additions and 1 deletions

View File

@ -313,6 +313,12 @@ update_app_filter_from_user (MctUserControls *self)
g_debug ("Retrieved new app filter for user '%s'", act_user_get_user_name (self->user));
}
static void
update_restricted_apps (MctUserControls *self)
{
mct_restrict_applications_dialog_set_app_filter (self->restrict_applications_dialog, self->filter);
}
static void
update_categories_from_language (MctUserControls *self)
{
@ -385,7 +391,7 @@ update_oars_level (MctUserControls *self)
{
GsContentRatingSystem rating_system;
g_autofree gchar *rating_age_category = NULL;
guint maximum_age;
guint maximum_age, selected_age;
gsize i;
gboolean all_categories_unset;
#if AS_CHECK_VERSION(0, 7, 15)
@ -423,9 +429,15 @@ update_oars_level (MctUserControls *self)
{
g_clear_pointer (&rating_age_category, g_free);
rating_age_category = g_strdup (_("All Ages"));
selected_age = oars_disabled_age;
}
else
{
selected_age = maximum_age;
}
gtk_label_set_label (self->oars_button_label, rating_age_category);
self->selected_age = selected_age;
}
static void
@ -550,6 +562,7 @@ setup_parental_control_settings (MctUserControls *self)
gtk_widget_set_sensitive (GTK_WIDGET (self), is_authorized);
update_restricted_apps (self);
update_categories_from_language (self);
update_oars_level (self);
update_allow_app_installation (self);