user-controls: Don’t clear filter if updating it is a no-op
If `self->user == NULL`, don’t clear the app filter, as that leaves us in a worse-off position than before. Rename the method to make it clearer that it queries the filter from the user. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
3519ac2dc1
commit
e3f923b294
|
@ -198,12 +198,10 @@ flush_update_blacklisted_apps (MctUserControls *self)
|
|||
}
|
||||
|
||||
static void
|
||||
update_app_filter (MctUserControls *self)
|
||||
update_app_filter_from_user (MctUserControls *self)
|
||||
{
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
g_clear_pointer (&self->filter, mct_app_filter_unref);
|
||||
|
||||
if (self->user == NULL)
|
||||
return;
|
||||
|
||||
|
@ -217,6 +215,7 @@ update_app_filter (MctUserControls *self)
|
|||
return;
|
||||
|
||||
/* FIXME: make it asynchronous */
|
||||
g_clear_pointer (&self->filter, mct_app_filter_unref);
|
||||
self->filter = mct_manager_get_app_filter (self->manager,
|
||||
act_user_get_uid (self->user),
|
||||
MCT_MANAGER_GET_VALUE_FLAGS_NONE,
|
||||
|
@ -847,7 +846,7 @@ mct_user_controls_set_user (MctUserControls *self,
|
|||
|
||||
if (g_set_object (&self->user, user))
|
||||
{
|
||||
update_app_filter (self);
|
||||
update_app_filter_from_user (self);
|
||||
setup_parental_control_settings (self);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_USER]);
|
||||
|
@ -861,7 +860,7 @@ on_permission_allowed_cb (GObject *obj,
|
|||
{
|
||||
MctUserControls *self = MCT_USER_CONTROLS (user_data);
|
||||
|
||||
update_app_filter (self);
|
||||
update_app_filter_from_user (self);
|
||||
setup_parental_control_settings (self);
|
||||
}
|
||||
|
||||
|
@ -901,7 +900,7 @@ mct_user_controls_set_permission (MctUserControls *self,
|
|||
}
|
||||
|
||||
/* Handle changes. */
|
||||
update_app_filter (self);
|
||||
update_app_filter_from_user (self);
|
||||
setup_parental_control_settings (self);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PERMISSION]);
|
||||
|
|
Loading…
Reference in New Issue