+ gnome-control-center-41~beta-3

Parental controls fixes
This commit is contained in:
Bastien Nocera 2021-08-26 18:11:20 +02:00
parent d1d1709b4a
commit 6386df01b9
2 changed files with 172 additions and 1 deletions

View File

@ -13,7 +13,7 @@
Name: gnome-control-center
Version: 41~beta
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Utilities to configure the GNOME desktop
License: GPLv2+ and CC-BY-SA
@ -23,6 +23,9 @@ Source0: https://download.gnome.org/sources/gnome-control-center/41/gnome
# https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/965
Patch0: distro-logo.patch
# https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1049
Patch1: parental-controls.patch
BuildRequires: chrpath
BuildRequires: cups-devel
BuildRequires: desktop-file-utils
@ -215,6 +218,10 @@ chrpath --delete $RPM_BUILD_ROOT%{_bindir}/gnome-control-center
%dir %{_datadir}/gnome/wm-properties
%changelog
* Thu Aug 26 2021 Bastien Nocera <bnocera@redhat.com> - 41~beta-3
+ gnome-control-center-41~beta-3
- Parental controls fixes
* Tue Aug 24 2021 Kalev Lember <klember@redhat.com> - 41~beta-2
- Require malcontent and malcontent-control for parental controls support

164
parental-controls.patch Normal file
View File

@ -0,0 +1,164 @@
From e65a4ba77ba741fb372734c5a862d892c9ba102b Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
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 @@
<property name="title" translatable="yes">_Parental Controls</property>
<property name="subtitle" translatable="yes">Open the Parental Controls application.</property>
<property name="subtitle-lines">0</property>
+ <property name="use_underline">True</property>
<property name="activatable">True</property>
<child>
<object class="GtkLabel" id="parental_controls_button_label">
--
2.31.1
From 820aea267d8db1b84d53651ffd63ac36028e0390 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
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 @@
<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>
--
2.31.1
From b59aec45372cfe6ea790793ae8fc5a3a32b5555d Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
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 <hadess@hadess.net>
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