From ecfb3035d53ef971c84daf31dd13292c6fc5317d Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 29 Oct 2020 19:22:13 +0000 Subject: [PATCH] libmalcontent-ui: Load restricted apps and OARS when loading app filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- libmalcontent-ui/user-controls.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libmalcontent-ui/user-controls.c b/libmalcontent-ui/user-controls.c index 8689a78..22942fd 100644 --- a/libmalcontent-ui/user-controls.c +++ b/libmalcontent-ui/user-controls.c @@ -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);