From e65a4ba77ba741fb372734c5a862d892c9ba102b Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Thu, 26 Aug 2021 16:33:20 +0200 Subject: [PATCH 1/4] user-accounts: Fix spurious underscore in front of "Parental Controls" label --- panels/user-accounts/cc-user-panel.ui | 1 + 1 file changed, 1 insertion(+) diff --git a/panels/user-accounts/cc-user-panel.ui b/panels/user-accounts/cc-user-panel.ui index a1092eed7..6a3f92247 100644 --- a/panels/user-accounts/cc-user-panel.ui +++ b/panels/user-accounts/cc-user-panel.ui @@ -284,6 +284,7 @@ _Parental Controls Open the Parental Controls application. 0 + True True -- 2.31.1 From 820aea267d8db1b84d53651ffd63ac36028e0390 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 26 Aug 2021 16:49:40 +0200 Subject: [PATCH 2/4] user-accounts: Hide parental controls row if unavailable Don't show the parental controls line for administrator accounts. --- panels/user-accounts/cc-user-panel.c | 15 ++++++++------- panels/user-accounts/cc-user-panel.ui | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/panels/user-accounts/cc-user-panel.c b/panels/user-accounts/cc-user-panel.c index 57cd019db..73af3a98a 100644 --- a/panels/user-accounts/cc-user-panel.c +++ b/panels/user-accounts/cc-user-panel.c @@ -331,7 +331,12 @@ reload_users (CcUserPanel *self, ActUser *selected_user) g_object_set (settings, "gtk-enable-animations", animations, NULL); #ifdef HAVE_MALCONTENT /* Parental Controls row not to be shown for single user setups. */ - gtk_widget_set_visible (GTK_WIDGET (self->parental_controls_row), users_count > 1); + if (selected_user != NULL) { + gtk_widget_set_visible (GTK_WIDGET (self->parental_controls_row), + act_user_get_account_type (selected_user) != ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR); + } else { + gtk_widget_set_visible (GTK_WIDGET (self->parental_controls_row), users_count > 1); + } #endif } @@ -921,12 +926,7 @@ show_user (ActUser *user, CcUserPanel *self) #ifdef HAVE_MALCONTENT /* Parental Controls: Unavailable if user is admin */ if (act_user_get_account_type (user) == ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR) { - GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self->parental_controls_button_label)); - - gtk_widget_hide (GTK_WIDGET (self->parental_control_go_next)); - /* TRANSLATORS: Status of Parental Controls setup */ - gtk_label_set_text (self->parental_controls_button_label, _("Unavailable")); - gtk_style_context_add_class (context, "dim-label"); + gtk_widget_hide (GTK_WIDGET (self->parental_controls_row)); } else { GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self->parental_controls_button_label)); @@ -939,6 +939,7 @@ show_user (ActUser *user, CcUserPanel *self) gtk_style_context_remove_class (context, "dim-label"); gtk_widget_show (GTK_WIDGET (self->parental_control_go_next)); + gtk_widget_show (GTK_WIDGET (self->parental_controls_row)); } #endif diff --git a/panels/user-accounts/cc-user-panel.ui b/panels/user-accounts/cc-user-panel.ui index 6a3f92247..134a9a39a 100644 --- a/panels/user-accounts/cc-user-panel.ui +++ b/panels/user-accounts/cc-user-panel.ui @@ -286,6 +286,7 @@ 0 True True + False True -- 2.31.1 From b59aec45372cfe6ea790793ae8fc5a3a32b5555d Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 26 Aug 2021 16:49:55 +0200 Subject: [PATCH 3/4] user-accounts: Avoid double password prompt Don't require a password to be typed just to be able to launch the parental controls app which itself will ask for a password to be typed. --- panels/user-accounts/cc-user-panel.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/panels/user-accounts/cc-user-panel.c b/panels/user-accounts/cc-user-panel.c index 73af3a98a..249daa578 100644 --- a/panels/user-accounts/cc-user-panel.c +++ b/panels/user-accounts/cc-user-panel.c @@ -1438,10 +1438,6 @@ on_permission_changed (CcUserPanel *self) gtk_widget_set_sensitive (GTK_WIDGET (self->last_login_row), TRUE); remove_unlock_tooltip (GTK_WIDGET (self->last_login_row)); -#ifdef HAVE_MALCONTENT - gtk_widget_set_sensitive (GTK_WIDGET (self->parental_controls_row), TRUE); - remove_unlock_tooltip (GTK_WIDGET (self->parental_controls_row)); -#endif } else { gtk_stack_set_visible_child (self->user_icon_stack, GTK_WIDGET (self->user_icon_image)); @@ -1457,10 +1453,6 @@ on_permission_changed (CcUserPanel *self) gtk_widget_set_sensitive (GTK_WIDGET (self->last_login_row), FALSE); add_unlock_tooltip (GTK_WIDGET (self->last_login_row)); -#ifdef HAVE_MALCONTENT - gtk_widget_set_sensitive (GTK_WIDGET (self->parental_controls_row), FALSE); - add_unlock_tooltip (GTK_WIDGET (self->parental_controls_row)); -#endif } } -- 2.31.1 From 14d29b8e45504b475ffb07a6a5617ba064892802 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 26 Aug 2021 17:20:56 +0200 Subject: [PATCH 4/4] user-accounts: Add debug when launching malcontent-control --- panels/user-accounts/cc-user-panel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/panels/user-accounts/cc-user-panel.c b/panels/user-accounts/cc-user-panel.c index 249daa578..aa273fca2 100644 --- a/panels/user-accounts/cc-user-panel.c +++ b/panels/user-accounts/cc-user-panel.c @@ -1214,7 +1214,11 @@ spawn_malcontent_control (CcUserPanel *self) #endif /* HAVE_MALCONTENT_0_10 */ NULL }; - g_spawn_async (NULL, (char **)argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL); + g_autoptr(GError) error = NULL; + if (!g_spawn_async (NULL, (char **)argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error)) + g_debug ("Couldn't launch malcontent-control: %s", error->message); + } else { + g_debug ("Not launching malcontent because selected user is an admin"); } } #endif -- 2.31.1