[gnome-control-center/wip/hadess/parental-controls-fixes: 1/3] user-accounts: Hide parental controls row if unavailable
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/hadess/parental-controls-fixes: 1/3] user-accounts: Hide parental controls row if unavailable
- Date: Thu, 26 Aug 2021 15:22:15 +0000 (UTC)
commit 820aea267d8db1b84d53651ffd63ac36028e0390
Author: Bastien Nocera <hadess hadess net>
Date: Thu Aug 26 16:49:40 2021 +0200
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 @@
<property name="subtitle-lines">0</property>
<property name="use_underline">True</property>
<property name="activatable">True</property>
+ <property name="visible">False</property>
<child>
<object class="GtkLabel" id="parental_controls_button_label">
<property name="visible">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]