From 98395185e33dea4d20c2742f9f657e6ffe97ebb6 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 14 Feb 2020 15:21:01 +0000 Subject: [PATCH 01/16] user-controls: Add full stops to end of control descriptions They are sentences. Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/user-controls.ui | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index 4042174..8dce138 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -84,7 +84,7 @@ True end 0 - Prevents the user from running web browsers, but limited web content may still be available in other applications + Prevents the user from running web browsers, but limited web content may still be available in other applications. @@ -163,7 +163,7 @@ True end 0 - Prevents particular applications from being used + Prevents particular applications from being used. @@ -290,7 +290,7 @@ True end 0 - Restricts the user from installing applications + Restricts the user from installing applications. @@ -370,7 +370,7 @@ True end 0 - Restricts the user from installing applications for all users + Restricts the user from installing applications for all users. @@ -451,7 +451,7 @@ True end 0 - Restricts the applications the user can browse or install to those suitable for certain ages + Restricts the applications the user can browse or install to those suitable for certain ages. From ef6fc0a7f50135f6226ff08f9fd6f580b2662c81 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 14 Feb 2020 15:21:58 +0000 Subject: [PATCH 02/16] =?UTF-8?q?user-controls:=20Fix=20icon=20for=20?= =?UTF-8?q?=E2=80=98Restrict=20Applications=E2=80=99=20button?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/user-controls.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index 8dce138..a1a3bcf 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -190,7 +190,7 @@ True - pan-end-symbolic + go-next-symbolic 4 From 67ca6806e6ee22deb5bb9ffff04a69c1b98a38a5 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 14 Feb 2020 15:48:23 +0000 Subject: [PATCH 03/16] user-controls: Add separators between rows Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/user-controls.c | 33 +++++++++++++++++++++++++++++++ libmalcontent-ui/user-controls.ui | 4 ++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/libmalcontent-ui/user-controls.c b/libmalcontent-ui/user-controls.c index 20ab0ba..080eb95 100644 --- a/libmalcontent-ui/user-controls.c +++ b/libmalcontent-ui/user-controls.c @@ -82,6 +82,9 @@ struct _MctUserControls GtkPopover *restriction_popover; MctRestrictApplicationsDialog *restrict_applications_dialog; + GtkListBox *application_usage_permissions_listbox; + GtkListBox *software_installation_permissions_listbox; + GSimpleActionGroup *action_group; /* (owned) */ ActUser *user; /* (owned) (nullable) */ @@ -659,6 +662,28 @@ on_set_age_action_activated (GSimpleAction *action, schedule_update_blacklisted_apps (self); } +static void +list_box_header_func (GtkListBoxRow *row, + GtkListBoxRow *before, + gpointer user_data) +{ + GtkWidget *current; + + if (before == NULL) + { + gtk_list_box_row_set_header (row, NULL); + return; + } + + current = gtk_list_box_row_get_header (row); + if (current == NULL) + { + current = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); + gtk_widget_show (current); + gtk_list_box_row_set_header (row, current); + } +} + /* GObject overrides */ static void @@ -909,6 +934,8 @@ mct_user_controls_class_init (MctUserControlsClass *klass) gtk_widget_class_bind_template_child (widget_class, MctUserControls, restriction_button); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restriction_popover); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_dialog); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, application_usage_permissions_listbox); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, software_installation_permissions_listbox); gtk_widget_class_bind_template_callback (widget_class, on_allow_installation_switch_active_changed_cb); gtk_widget_class_bind_template_callback (widget_class, on_allow_web_browsers_switch_active_changed_cb); @@ -957,6 +984,12 @@ mct_user_controls_init (MctUserControls *self) g_object_bind_property (self->allow_user_installation_switch, "active", self->allow_system_installation_switch, "sensitive", G_BINDING_DEFAULT); + + /* Automatically add separators between rows. */ + gtk_list_box_set_header_func (self->application_usage_permissions_listbox, + list_box_header_func, NULL, NULL); + gtk_list_box_set_header_func (self->software_installation_permissions_listbox, + list_box_header_func, NULL, NULL); } /** diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index a1a3bcf..3d0350b 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -33,7 +33,7 @@ 0 in - + True False True @@ -239,7 +239,7 @@ 0 in - + True False True From b9a2b7a6a741d0aaabdb76d4beab84395e6b90c9 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 24 Feb 2020 16:31:51 +0000 Subject: [PATCH 04/16] =?UTF-8?q?user-controls:=20Add=20CSS=20to=20support?= =?UTF-8?q?=20styling=20switches=20as=20=E2=80=98restrictive=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will be used in upcoming commits to mark switches as restricting something when they’re active, rather than allowing something. Their background will be red, rather than blue. Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/malcontent-ui.gresource.xml | 1 + libmalcontent-ui/restricts-switch.css | 18 ++++++++++++++++++ libmalcontent-ui/user-controls.c | 8 ++++++++ 3 files changed, 27 insertions(+) create mode 100644 libmalcontent-ui/restricts-switch.css diff --git a/libmalcontent-ui/malcontent-ui.gresource.xml b/libmalcontent-ui/malcontent-ui.gresource.xml index cbdaa9f..089d8a5 100644 --- a/libmalcontent-ui/malcontent-ui.gresource.xml +++ b/libmalcontent-ui/malcontent-ui.gresource.xml @@ -4,6 +4,7 @@ restrict-applications-dialog.ui restrict-applications-selector.ui + restricts-switch.css user-controls.ui diff --git a/libmalcontent-ui/restricts-switch.css b/libmalcontent-ui/restricts-switch.css new file mode 100644 index 0000000..c44debe --- /dev/null +++ b/libmalcontent-ui/restricts-switch.css @@ -0,0 +1,18 @@ +/* FIXME: This ‘negative’ variant of a GtkSwitch should probably be + * upstreamed to GTK. See https://gitlab.gnome.org/GNOME/gtk/issues/2470 */ +switch:checked.restricts { + background-color: @error_color; +} + +switch:checked.restricts, switch:checked.restricts slider { + border-color: #8b0000; +} + +switch:disabled.restricts { + border-color: @borders; + background-color: @insensitive_bg_color; +} + +switch:disabled.restricts slider { + border-color: #bfb8b1; +} diff --git a/libmalcontent-ui/user-controls.c b/libmalcontent-ui/user-controls.c index 080eb95..5326df4 100644 --- a/libmalcontent-ui/user-controls.c +++ b/libmalcontent-ui/user-controls.c @@ -949,12 +949,20 @@ mct_user_controls_init (MctUserControls *self) { g_autoptr(GDBusConnection) system_bus = NULL; g_autoptr(GError) error = NULL; + g_autoptr(GtkCssProvider) provider = NULL; /* Ensure the types used in the UI are registered. */ g_type_ensure (MCT_TYPE_RESTRICT_APPLICATIONS_DIALOG); gtk_widget_init_template (GTK_WIDGET (self)); + provider = gtk_css_provider_new (); + gtk_css_provider_load_from_resource (provider, + "/org/freedesktop/MalcontentUi/ui/restricts-switch.css"); + gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION - 1); + self->selected_age = (guint) -1; self->cancellable = g_cancellable_new (); From 8027351f5842fd6aabbfb09ccfd2a23796a5f032 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 24 Feb 2020 16:32:54 +0000 Subject: [PATCH 05/16] carousel: Lower CSS priority MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise an application won’t be able to override the CSS installed by libmalcontent-ui if this is ever moved into libmalcontent-ui. Signed-off-by: Philip Withnall --- malcontent-control/carousel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/malcontent-control/carousel.c b/malcontent-control/carousel.c index c69fc9f..bd56848 100644 --- a/malcontent-control/carousel.c +++ b/malcontent-control/carousel.c @@ -447,7 +447,7 @@ mct_carousel_init (MctCarousel *self) gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), provider, - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION - 1); g_object_unref (provider); From 8e4fa643d35b21ea190e7b1a69e0b4650171982b Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 24 Feb 2020 16:34:37 +0000 Subject: [PATCH 06/16] =?UTF-8?q?user-controls:=20Relabel=20=E2=80=98allow?= =?UTF-8?q?=20web=20browsers=E2=80=99=20as=20=E2=80=98restrict=20web=20bro?= =?UTF-8?q?wsers=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is part of a move to make all the controls restrictive, rather than permissive. Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/user-controls.c | 48 +++++++++++++++---------------- libmalcontent-ui/user-controls.ui | 23 ++++++++------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/libmalcontent-ui/user-controls.c b/libmalcontent-ui/user-controls.c index 5326df4..6419370 100644 --- a/libmalcontent-ui/user-controls.c +++ b/libmalcontent-ui/user-controls.c @@ -77,7 +77,7 @@ struct _MctUserControls GMenu *age_menu; GtkSwitch *allow_system_installation_switch; GtkSwitch *allow_user_installation_switch; - GtkSwitch *allow_web_browsers_switch; + GtkSwitch *restrict_web_browsers_switch; GtkButton *restriction_button; GtkPopover *restriction_popover; MctRestrictApplicationsDialog *restrict_applications_dialog; @@ -111,9 +111,9 @@ static void on_allow_installation_switch_active_changed_cb (GtkSwitch *s, GParamSpec *pspec, MctUserControls *self); -static void on_allow_web_browsers_switch_active_changed_cb (GtkSwitch *s, - GParamSpec *pspec, - MctUserControls *self); +static void on_restrict_web_browsers_switch_active_changed_cb (GtkSwitch *s, + GParamSpec *pspec, + MctUserControls *self); static void on_restrict_applications_button_clicked_cb (GtkButton *button, gpointer user_data); @@ -455,23 +455,23 @@ update_allow_app_installation (MctUserControls *self) } static void -update_allow_web_browsers (MctUserControls *self) +update_restrict_web_browsers (MctUserControls *self) { - gboolean allow_web_browsers; + gboolean restrict_web_browsers; - allow_web_browsers = mct_app_filter_is_content_type_allowed (self->filter, - WEB_BROWSERS_CONTENT_TYPE); + restrict_web_browsers = !mct_app_filter_is_content_type_allowed (self->filter, + WEB_BROWSERS_CONTENT_TYPE); - g_signal_handlers_block_by_func (self->allow_web_browsers_switch, - on_allow_web_browsers_switch_active_changed_cb, + g_signal_handlers_block_by_func (self->restrict_web_browsers_switch, + on_restrict_web_browsers_switch_active_changed_cb, self); - gtk_switch_set_active (self->allow_web_browsers_switch, allow_web_browsers); + gtk_switch_set_active (self->restrict_web_browsers_switch, restrict_web_browsers); - g_debug ("Allow web browsers: %s", allow_web_browsers ? "yes" : "no"); + g_debug ("Restrict web browsers: %s", restrict_web_browsers ? "yes" : "no"); - g_signal_handlers_unblock_by_func (self->allow_web_browsers_switch, - on_allow_web_browsers_switch_active_changed_cb, + g_signal_handlers_unblock_by_func (self->restrict_web_browsers_switch, + on_restrict_web_browsers_switch_active_changed_cb, self); } @@ -497,7 +497,7 @@ setup_parental_control_settings (MctUserControls *self) update_oars_level (self); update_categories_from_language (self); update_allow_app_installation (self); - update_allow_web_browsers (self); + update_restrict_web_browsers (self); } /* Callbacks */ @@ -562,9 +562,9 @@ on_allow_installation_switch_active_changed_cb (GtkSwitch *s, } static void -on_allow_web_browsers_switch_active_changed_cb (GtkSwitch *s, - GParamSpec *pspec, - MctUserControls *self) +on_restrict_web_browsers_switch_active_changed_cb (GtkSwitch *s, + GParamSpec *pspec, + MctUserControls *self) { /* Save the changes. */ schedule_update_blacklisted_apps (self); @@ -930,7 +930,7 @@ mct_user_controls_class_init (MctUserControlsClass *klass) gtk_widget_class_bind_template_child (widget_class, MctUserControls, age_menu); gtk_widget_class_bind_template_child (widget_class, MctUserControls, allow_system_installation_switch); gtk_widget_class_bind_template_child (widget_class, MctUserControls, allow_user_installation_switch); - gtk_widget_class_bind_template_child (widget_class, MctUserControls, allow_web_browsers_switch); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_web_browsers_switch); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restriction_button); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restriction_popover); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_dialog); @@ -938,7 +938,7 @@ mct_user_controls_class_init (MctUserControlsClass *klass) gtk_widget_class_bind_template_child (widget_class, MctUserControls, software_installation_permissions_listbox); gtk_widget_class_bind_template_callback (widget_class, on_allow_installation_switch_active_changed_cb); - gtk_widget_class_bind_template_callback (widget_class, on_allow_web_browsers_switch_active_changed_cb); + gtk_widget_class_bind_template_callback (widget_class, on_restrict_web_browsers_switch_active_changed_cb); gtk_widget_class_bind_template_callback (widget_class, on_restrict_applications_button_clicked_cb); gtk_widget_class_bind_template_callback (widget_class, on_restrict_applications_dialog_delete_event_cb); gtk_widget_class_bind_template_callback (widget_class, on_restrict_applications_dialog_response_cb); @@ -1354,7 +1354,7 @@ void mct_user_controls_build_app_filter (MctUserControls *self, MctAppFilterBuilder *builder) { - gboolean allow_web_browsers; + gboolean restrict_web_browsers; gsize i; g_return_if_fail (MCT_IS_USER_CONTROLS (self)); @@ -1389,11 +1389,11 @@ mct_user_controls_build_app_filter (MctUserControls *self, } /* Web browsers */ - allow_web_browsers = gtk_switch_get_active (self->allow_web_browsers_switch); + restrict_web_browsers = gtk_switch_get_active (self->restrict_web_browsers_switch); - g_debug ("\t → %s web browsers", allow_web_browsers ? "Enabling" : "Disabling"); + g_debug ("\t → %s web browsers", restrict_web_browsers ? "Restricting" : "Allowing"); - if (!allow_web_browsers) + if (restrict_web_browsers) mct_app_filter_builder_blacklist_content_type (builder, WEB_BROWSERS_CONTENT_TYPE); /* App installation */ diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index 3d0350b..0693332 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -57,18 +57,18 @@ 4 4 - + True False start True end 0 - Allow _Web Browsers + Restrict _Web Browsers True - allow_web_browsers_switch + restrict_web_browsers_switch - + @@ -77,7 +77,7 @@ - + True False start @@ -92,7 +92,7 @@ - + @@ -101,12 +101,15 @@ - + True True end center - + + 1 @@ -514,8 +517,8 @@ horizontal - - + + From f956fab427fa7249399e2f7bc7c637ed50d37a06 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 24 Feb 2020 16:36:16 +0000 Subject: [PATCH 07/16] =?UTF-8?q?user-controls:=20Tweak=20the=20wording=20?= =?UTF-8?q?of=20the=20=E2=80=98restrict=20applications=E2=80=99=20label?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/user-controls.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index 0693332..c135f3a 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -166,7 +166,7 @@ True end 0 - Prevents particular applications from being used. + Prevents specified applications from being used. From 516e3936eb23204752b6998dc453280684785c45 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 24 Feb 2020 16:44:15 +0000 Subject: [PATCH 08/16] =?UTF-8?q?user-controls:=20Relabel=20=E2=80=98allow?= =?UTF-8?q?=20installation=E2=80=99=20as=20=E2=80=98restrict=20installatio?= =?UTF-8?q?n=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is part of a move to make all the controls restrictive, rather than permissive. Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/user-controls.c | 100 +++++++++++++++--------------- libmalcontent-ui/user-controls.ui | 50 ++++++++------- 2 files changed, 78 insertions(+), 72 deletions(-) diff --git a/libmalcontent-ui/user-controls.c b/libmalcontent-ui/user-controls.c index 6419370..352f4b2 100644 --- a/libmalcontent-ui/user-controls.c +++ b/libmalcontent-ui/user-controls.c @@ -75,8 +75,8 @@ struct _MctUserControls GtkGrid parent_instance; GMenu *age_menu; - GtkSwitch *allow_system_installation_switch; - GtkSwitch *allow_user_installation_switch; + GtkSwitch *restrict_system_installation_switch; + GtkSwitch *restrict_user_installation_switch; GtkSwitch *restrict_web_browsers_switch; GtkButton *restriction_button; GtkPopover *restriction_popover; @@ -107,9 +107,9 @@ struct _MctUserControls static gboolean blacklist_apps_cb (gpointer data); -static void on_allow_installation_switch_active_changed_cb (GtkSwitch *s, - GParamSpec *pspec, - MctUserControls *self); +static void on_restrict_installation_switch_active_changed_cb (GtkSwitch *s, + GParamSpec *pspec, + MctUserControls *self); static void on_restrict_web_browsers_switch_active_changed_cb (GtkSwitch *s, GParamSpec *pspec, @@ -401,8 +401,8 @@ update_oars_level (MctUserControls *self) static void update_allow_app_installation (MctUserControls *self) { - gboolean allow_system_installation; - gboolean allow_user_installation; + gboolean restrict_system_installation; + gboolean restrict_user_installation; gboolean non_admin_user = TRUE; if (self->user_account_type == ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR) @@ -410,8 +410,8 @@ update_allow_app_installation (MctUserControls *self) /* Admins are always allowed to install apps for all users. This behaviour is governed * by flatpak polkit rules. Hence, these hide these defunct switches for admins. */ - gtk_widget_set_visible (GTK_WIDGET (self->allow_system_installation_switch), non_admin_user); - gtk_widget_set_visible (GTK_WIDGET (self->allow_user_installation_switch), non_admin_user); + gtk_widget_set_visible (GTK_WIDGET (self->restrict_system_installation_switch), non_admin_user); + gtk_widget_set_visible (GTK_WIDGET (self->restrict_user_installation_switch), non_admin_user); /* If user is admin, we are done here, bail out. */ if (!non_admin_user) @@ -421,36 +421,36 @@ update_allow_app_installation (MctUserControls *self) return; } - allow_system_installation = mct_app_filter_is_system_installation_allowed (self->filter); - allow_user_installation = mct_app_filter_is_user_installation_allowed (self->filter); + restrict_system_installation = !mct_app_filter_is_system_installation_allowed (self->filter); + restrict_user_installation = !mct_app_filter_is_user_installation_allowed (self->filter); /* While the underlying permissions storage allows the system and user settings * to be stored completely independently, force the system setting to OFF if * the user setting is OFF in the UI. This keeps the policy in use for most * people simpler. */ - if (!allow_user_installation) - allow_system_installation = FALSE; + if (restrict_user_installation) + restrict_system_installation = TRUE; - g_signal_handlers_block_by_func (self->allow_system_installation_switch, - on_allow_installation_switch_active_changed_cb, + g_signal_handlers_block_by_func (self->restrict_system_installation_switch, + on_restrict_installation_switch_active_changed_cb, self); - g_signal_handlers_block_by_func (self->allow_user_installation_switch, - on_allow_installation_switch_active_changed_cb, + g_signal_handlers_block_by_func (self->restrict_user_installation_switch, + on_restrict_installation_switch_active_changed_cb, self); - gtk_switch_set_active (self->allow_system_installation_switch, allow_system_installation); - gtk_switch_set_active (self->allow_user_installation_switch, allow_user_installation); + gtk_switch_set_active (self->restrict_system_installation_switch, restrict_system_installation); + gtk_switch_set_active (self->restrict_user_installation_switch, restrict_user_installation); - g_debug ("Allow system installation: %s", allow_system_installation ? "yes" : "no"); - g_debug ("Allow user installation: %s", allow_user_installation ? "yes" : "no"); + g_debug ("Restrict system installation: %s", restrict_system_installation ? "yes" : "no"); + g_debug ("Restrict user installation: %s", restrict_user_installation ? "yes" : "no"); - g_signal_handlers_unblock_by_func (self->allow_system_installation_switch, - on_allow_installation_switch_active_changed_cb, + g_signal_handlers_unblock_by_func (self->restrict_system_installation_switch, + on_restrict_installation_switch_active_changed_cb, self); - g_signal_handlers_unblock_by_func (self->allow_user_installation_switch, - on_allow_installation_switch_active_changed_cb, + g_signal_handlers_unblock_by_func (self->restrict_user_installation_switch, + on_restrict_installation_switch_active_changed_cb, self); } @@ -539,21 +539,21 @@ blacklist_apps_cb (gpointer data) } static void -on_allow_installation_switch_active_changed_cb (GtkSwitch *s, - GParamSpec *pspec, - MctUserControls *self) +on_restrict_installation_switch_active_changed_cb (GtkSwitch *s, + GParamSpec *pspec, + MctUserControls *self) { /* See the comment about policy in update_allow_app_installation(). */ - if (s == self->allow_user_installation_switch && - !gtk_switch_get_active (s) && - gtk_switch_get_active (self->allow_system_installation_switch)) + if (s == self->restrict_user_installation_switch && + gtk_switch_get_active (s) && + !gtk_switch_get_active (self->restrict_system_installation_switch)) { - g_signal_handlers_block_by_func (self->allow_system_installation_switch, - on_allow_installation_switch_active_changed_cb, + g_signal_handlers_block_by_func (self->restrict_system_installation_switch, + on_restrict_installation_switch_active_changed_cb, self); - gtk_switch_set_active (self->allow_system_installation_switch, FALSE); - g_signal_handlers_unblock_by_func (self->allow_system_installation_switch, - on_allow_installation_switch_active_changed_cb, + gtk_switch_set_active (self->restrict_system_installation_switch, TRUE); + g_signal_handlers_unblock_by_func (self->restrict_system_installation_switch, + on_restrict_installation_switch_active_changed_cb, self); } @@ -928,8 +928,8 @@ mct_user_controls_class_init (MctUserControlsClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/freedesktop/MalcontentUi/ui/user-controls.ui"); gtk_widget_class_bind_template_child (widget_class, MctUserControls, age_menu); - gtk_widget_class_bind_template_child (widget_class, MctUserControls, allow_system_installation_switch); - gtk_widget_class_bind_template_child (widget_class, MctUserControls, allow_user_installation_switch); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_system_installation_switch); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_user_installation_switch); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_web_browsers_switch); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restriction_button); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restriction_popover); @@ -937,7 +937,7 @@ mct_user_controls_class_init (MctUserControlsClass *klass) gtk_widget_class_bind_template_child (widget_class, MctUserControls, application_usage_permissions_listbox); gtk_widget_class_bind_template_child (widget_class, MctUserControls, software_installation_permissions_listbox); - gtk_widget_class_bind_template_callback (widget_class, on_allow_installation_switch_active_changed_cb); + gtk_widget_class_bind_template_callback (widget_class, on_restrict_installation_switch_active_changed_cb); gtk_widget_class_bind_template_callback (widget_class, on_restrict_web_browsers_switch_active_changed_cb); gtk_widget_class_bind_template_callback (widget_class, on_restrict_applications_button_clicked_cb); gtk_widget_class_bind_template_callback (widget_class, on_restrict_applications_dialog_delete_event_cb); @@ -989,9 +989,9 @@ mct_user_controls_init (MctUserControls *self) gtk_popover_bind_model (self->restriction_popover, G_MENU_MODEL (self->age_menu), NULL); - g_object_bind_property (self->allow_user_installation_switch, "active", - self->allow_system_installation_switch, "sensitive", - G_BINDING_DEFAULT); + g_object_bind_property (self->restrict_user_installation_switch, "active", + self->restrict_system_installation_switch, "sensitive", + G_BINDING_DEFAULT | G_BINDING_INVERT_BOOLEAN); /* Automatically add separators between rows. */ gtk_list_box_set_header_func (self->application_usage_permissions_listbox, @@ -1399,16 +1399,16 @@ mct_user_controls_build_app_filter (MctUserControls *self, /* App installation */ if (self->user_account_type != ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR) { - gboolean allow_system_installation; - gboolean allow_user_installation; + gboolean restrict_system_installation; + gboolean restrict_user_installation; - allow_system_installation = gtk_switch_get_active (self->allow_system_installation_switch); - allow_user_installation = gtk_switch_get_active (self->allow_user_installation_switch); + restrict_system_installation = gtk_switch_get_active (self->restrict_system_installation_switch); + restrict_user_installation = gtk_switch_get_active (self->restrict_user_installation_switch); - g_debug ("\t → %s system installation", allow_system_installation ? "Enabling" : "Disabling"); - g_debug ("\t → %s user installation", allow_user_installation ? "Enabling" : "Disabling"); + g_debug ("\t → %s system installation", restrict_system_installation ? "Restricting" : "Allowing"); + g_debug ("\t → %s user installation", restrict_user_installation ? "Restricting" : "Allowing"); - mct_app_filter_builder_set_allow_user_installation (builder, allow_user_installation); - mct_app_filter_builder_set_allow_system_installation (builder, allow_system_installation); + mct_app_filter_builder_set_allow_user_installation (builder, !restrict_user_installation); + mct_app_filter_builder_set_allow_system_installation (builder, !restrict_system_installation); } } diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index c135f3a..98b2129 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -250,7 +250,7 @@ False - + True False False @@ -266,18 +266,18 @@ 4 4 - + True False start True end 0 - Application _Installation + Restrict Application _Installation True - allow_user_installation_switch + restrict_user_installation_switch - + @@ -286,14 +286,14 @@ - + True False start True end 0 - Restricts the user from installing applications. + Prevents the user from installing applications. @@ -301,7 +301,7 @@ - + @@ -310,12 +310,15 @@ - + True True end center - + + 1 @@ -330,7 +333,7 @@ - + True False False @@ -346,18 +349,18 @@ 4 4 - + True False start True end 0 - Application Installation for _Others + Restrict Application Installation for _Others True - allow_system_installation_switch + restrict_system_installation_switch - + @@ -366,14 +369,14 @@ - + True False start True end 0 - Restricts the user from installing applications for all users. + Prevents the user’s application installations from being available to all users. @@ -381,7 +384,7 @@ - + @@ -390,12 +393,15 @@ - + True True end center - + + 1 @@ -522,8 +528,8 @@ - - + + From 8753109e8075df546f839bf5c25b343cdd15d3fa Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 24 Feb 2020 16:49:03 +0000 Subject: [PATCH 09/16] =?UTF-8?q?user-controls:=20Tweak=20the=20wording=20?= =?UTF-8?q?of=20the=20=E2=80=98application=20suitability=E2=80=99=20label?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/user-controls.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index 98b2129..a92f421 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -460,7 +460,7 @@ True end 0 - Restricts the applications the user can browse or install to those suitable for certain ages. + Restricts application installation to those suitable for certain ages or above. From dee4d92ea97c2ce4e919294ab9ae2cc1cb011c11 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 24 Feb 2020 17:04:04 +0000 Subject: [PATCH 10/16] restrict-applications-dialog: Invert controls to be restrictive Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/restrict-applications-dialog.c | 2 +- .../restrict-applications-dialog.ui | 2 +- .../restrict-applications-selector.c | 17 +++++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/libmalcontent-ui/restrict-applications-dialog.c b/libmalcontent-ui/restrict-applications-dialog.c index d231466..ed70c19 100644 --- a/libmalcontent-ui/restrict-applications-dialog.c +++ b/libmalcontent-ui/restrict-applications-dialog.c @@ -217,7 +217,7 @@ update_description (MctRestrictApplicationsDialog *self) } /* Translators: the placeholder is a user’s full name */ - description = g_strdup_printf (_("Allow %s to use the following installed applications."), + description = g_strdup_printf (_("Restrict %s from using the following installed applications."), self->user_display_name); gtk_label_set_text (self->description, description); gtk_widget_show (GTK_WIDGET (self->description)); diff --git a/libmalcontent-ui/restrict-applications-dialog.ui b/libmalcontent-ui/restrict-applications-dialog.ui index e95ff36..13996c0 100644 --- a/libmalcontent-ui/restrict-applications-dialog.ui +++ b/libmalcontent-ui/restrict-applications-dialog.ui @@ -22,7 +22,7 @@ - Allow {username} to use the following installed applications. + Restrict {username} from using the following installed applications. False diff --git a/libmalcontent-ui/restrict-applications-selector.c b/libmalcontent-ui/restrict-applications-selector.c index b203bee..a38d1ae 100644 --- a/libmalcontent-ui/restrict-applications-selector.c +++ b/libmalcontent-ui/restrict-applications-selector.c @@ -68,6 +68,8 @@ struct _MctRestrictApplicationsSelector FlatpakInstallation *system_installation; /* (owned) */ FlatpakInstallation *user_installation; /* (owned) */ + + GtkCssProvider *css_provider; /* (owned) */ }; G_DEFINE_TYPE (MctRestrictApplicationsSelector, mct_restrict_applications_selector, GTK_TYPE_BOX) @@ -157,6 +159,7 @@ mct_restrict_applications_selector_dispose (GObject *object) g_clear_pointer (&self->app_filter, mct_app_filter_unref); g_clear_object (&self->system_installation); g_clear_object (&self->user_installation); + g_clear_object (&self->css_provider); G_OBJECT_CLASS (mct_restrict_applications_selector_parent_class)->dispose (object); } @@ -239,6 +242,10 @@ mct_restrict_applications_selector_init (MctRestrictApplicationsSelector *self) self->system_installation = flatpak_installation_new_system (NULL, NULL); self->user_installation = flatpak_installation_new_user (NULL, NULL); + + self->css_provider = gtk_css_provider_new (); + gtk_css_provider_load_from_resource (self->css_provider, + "/org/freedesktop/MalcontentUi/ui/restricts-switch.css"); } static void @@ -251,7 +258,7 @@ on_switch_active_changed_cb (GtkSwitch *s, gboolean allowed; app = g_object_get_data (G_OBJECT (s), "GAppInfo"); - allowed = gtk_switch_get_active (s); + allowed = !gtk_switch_get_active (s); if (allowed) { @@ -286,6 +293,7 @@ create_row_for_app_cb (gpointer item, gboolean allowed; const gchar *app_name; gint size; + GtkStyleContext *context; app_name = g_app_info_get_name (app); @@ -319,6 +327,11 @@ create_row_for_app_cb (gpointer item, w = g_object_new (GTK_TYPE_SWITCH, "valign", GTK_ALIGN_CENTER, NULL); + context = gtk_widget_get_style_context (w); + gtk_style_context_add_class (context, "restricts"); + gtk_style_context_add_provider (context, + GTK_STYLE_PROVIDER (self->css_provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION - 1); gtk_container_add (GTK_CONTAINER (box), w); gtk_widget_show_all (box); @@ -326,7 +339,7 @@ create_row_for_app_cb (gpointer item, /* Fetch status from AccountService */ allowed = mct_app_filter_is_appinfo_allowed (self->app_filter, app); - gtk_switch_set_active (GTK_SWITCH (w), allowed); + gtk_switch_set_active (GTK_SWITCH (w), !allowed); g_object_set_data_full (G_OBJECT (w), "GAppInfo", g_object_ref (app), g_object_unref); if (allowed) From 5a1bfb842a42e399b17ddc029e2f35a2215a511b Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 24 Feb 2020 17:28:21 +0000 Subject: [PATCH 11/16] user-controls: Include user display name in the description labels This clarifies that the settings apply to that user. Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/user-controls.c | 35 +++++++++++++++++++++++++++++++ libmalcontent-ui/user-controls.ui | 12 +++++++---- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/libmalcontent-ui/user-controls.c b/libmalcontent-ui/user-controls.c index 352f4b2..7f60dff 100644 --- a/libmalcontent-ui/user-controls.c +++ b/libmalcontent-ui/user-controls.c @@ -76,11 +76,15 @@ struct _MctUserControls GMenu *age_menu; GtkSwitch *restrict_system_installation_switch; + GtkLabel *restrict_system_installation_description; GtkSwitch *restrict_user_installation_switch; + GtkLabel *restrict_user_installation_description; GtkSwitch *restrict_web_browsers_switch; + GtkLabel *restrict_web_browsers_description; GtkButton *restriction_button; GtkPopover *restriction_popover; MctRestrictApplicationsDialog *restrict_applications_dialog; + GtkLabel *restrict_applications_description; GtkListBox *application_usage_permissions_listbox; GtkListBox *software_installation_permissions_listbox; @@ -475,6 +479,32 @@ update_restrict_web_browsers (MctUserControls *self) self); } +static void +update_labels_from_name (MctUserControls *self) +{ + g_autofree gchar *l = NULL; + + /* Translators: The placeholder is a user’s display name. */ + l = g_strdup_printf (_("Prevents %s from running web browsers. Note that limited web content may still be available in other applications."), self->user_display_name); + gtk_label_set_label (self->restrict_web_browsers_description, l); + g_clear_pointer (&l, g_free); + + /* Translators: The placeholder is a user’s display name. */ + l = g_strdup_printf (_("Prevents specified applications from being used by %s."), self->user_display_name); + gtk_label_set_label (self->restrict_applications_description, l); + g_clear_pointer (&l, g_free); + + /* Translators: The placeholder is a user’s display name. */ + l = g_strdup_printf (_("Prevents %s from installing applications."), self->user_display_name); + gtk_label_set_label (self->restrict_user_installation_description, l); + g_clear_pointer (&l, g_free); + + /* Translators: The placeholder is a user’s display name. */ + l = g_strdup_printf (_("Prevents %s’s application installations from being available to all users."), self->user_display_name); + gtk_label_set_label (self->restrict_system_installation_description, l); + g_clear_pointer (&l, g_free); +} + static void setup_parental_control_settings (MctUserControls *self) { @@ -498,6 +528,7 @@ setup_parental_control_settings (MctUserControls *self) update_categories_from_language (self); update_allow_app_installation (self); update_restrict_web_browsers (self); + update_labels_from_name (self); } /* Callbacks */ @@ -929,11 +960,15 @@ mct_user_controls_class_init (MctUserControlsClass *klass) gtk_widget_class_bind_template_child (widget_class, MctUserControls, age_menu); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_system_installation_switch); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_system_installation_description); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_user_installation_switch); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_user_installation_description); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_web_browsers_switch); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_web_browsers_description); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restriction_button); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restriction_popover); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_dialog); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_description); gtk_widget_class_bind_template_child (widget_class, MctUserControls, application_usage_permissions_listbox); gtk_widget_class_bind_template_child (widget_class, MctUserControls, software_installation_permissions_listbox); diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index a92f421..fd93ed8 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -84,7 +84,8 @@ True end 0 - Prevents the user from running web browsers, but limited web content may still be available in other applications. + + Prevents {username} from running web browsers. Note that limited web content may still be available in other applications. @@ -166,7 +167,8 @@ True end 0 - Prevents specified applications from being used. + + Prevents specified applications from being used by {username}. @@ -293,7 +295,8 @@ True end 0 - Prevents the user from installing applications. + + Prevents {username} from installing applications. @@ -376,7 +379,8 @@ True end 0 - Prevents the user’s application installations from being available to all users. + + Prevents {username}’s application installations from being available to all users. From 7ad804835aa1897f8f38182c8e56a190b9d5936a Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 25 Feb 2020 10:41:30 +0000 Subject: [PATCH 12/16] user-controls: Rename OARS widget variables to be more descriptive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This doesn’t introduce any functional changes. Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/user-controls.c | 16 ++++++++-------- libmalcontent-ui/user-controls.ui | 26 +++++++++++++------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/libmalcontent-ui/user-controls.c b/libmalcontent-ui/user-controls.c index 7f60dff..c89b5cd 100644 --- a/libmalcontent-ui/user-controls.c +++ b/libmalcontent-ui/user-controls.c @@ -81,8 +81,8 @@ struct _MctUserControls GtkLabel *restrict_user_installation_description; GtkSwitch *restrict_web_browsers_switch; GtkLabel *restrict_web_browsers_description; - GtkButton *restriction_button; - GtkPopover *restriction_popover; + GtkButton *oars_button; + GtkPopover *oars_popover; MctRestrictApplicationsDialog *restrict_applications_dialog; GtkLabel *restrict_applications_description; @@ -399,7 +399,7 @@ update_oars_level (MctUserControls *self) if (rating_age_category == NULL || all_categories_unset) rating_age_category = _("All Ages"); - gtk_button_set_label (self->restriction_button, rating_age_category); + gtk_button_set_label (self->oars_button, rating_age_category); } static void @@ -670,13 +670,13 @@ on_set_age_action_activated (GSimpleAction *action, /* Update the button */ if (age == oars_disabled_age) - gtk_button_set_label (self->restriction_button, _("All Ages")); + gtk_button_set_label (self->oars_button, _("All Ages")); for (i = 0; age != oars_disabled_age && entries[i] != NULL; i++) { if (ages[i] == age) { - gtk_button_set_label (self->restriction_button, entries[i]); + gtk_button_set_label (self->oars_button, entries[i]); break; } } @@ -965,8 +965,8 @@ mct_user_controls_class_init (MctUserControlsClass *klass) gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_user_installation_description); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_web_browsers_switch); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_web_browsers_description); - gtk_widget_class_bind_template_child (widget_class, MctUserControls, restriction_button); - gtk_widget_class_bind_template_child (widget_class, MctUserControls, restriction_popover); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, oars_button); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, oars_popover); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_dialog); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_description); gtk_widget_class_bind_template_child (widget_class, MctUserControls, application_usage_permissions_listbox); @@ -1022,7 +1022,7 @@ mct_user_controls_init (MctUserControls *self) "permissions", G_ACTION_GROUP (self->action_group)); - gtk_popover_bind_model (self->restriction_popover, G_MENU_MODEL (self->age_menu), NULL); + gtk_popover_bind_model (self->oars_popover, G_MENU_MODEL (self->age_menu), NULL); g_object_bind_property (self->restrict_user_installation_switch, "active", self->restrict_system_installation_switch, "sensitive", diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index fd93ed8..6b89fa3 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -436,7 +436,7 @@ 4 4 - + True False start @@ -445,10 +445,10 @@ 0 Application _Suitability True - restriction_button + oars_button - - + + @@ -457,7 +457,7 @@ - + True False start @@ -472,7 +472,7 @@ - + @@ -481,12 +481,12 @@ - + True True end center - restriction_popover + oars_popover 1 @@ -508,9 +508,9 @@ - + - + @@ -519,8 +519,8 @@ horizontal - - + + @@ -531,7 +531,7 @@ - + From 008b75edd1c51ad3c5579ee84e1896b8bf03e130 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 14 Feb 2020 15:23:10 +0000 Subject: [PATCH 13/16] user-controls: Add a drop-down arrow next to the OARS age selector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To make it more obvious that it triggers a drop-down menu. Potentially, this should be a `GtkComboBox` rather than reinventing the wheel using a `GtkMenuButton` — but that’s a change for another day. Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/user-controls.c | 8 +++++--- libmalcontent-ui/user-controls.ui | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/libmalcontent-ui/user-controls.c b/libmalcontent-ui/user-controls.c index c89b5cd..a4ff30d 100644 --- a/libmalcontent-ui/user-controls.c +++ b/libmalcontent-ui/user-controls.c @@ -82,6 +82,7 @@ struct _MctUserControls GtkSwitch *restrict_web_browsers_switch; GtkLabel *restrict_web_browsers_description; GtkButton *oars_button; + GtkLabel *oars_button_label; GtkPopover *oars_popover; MctRestrictApplicationsDialog *restrict_applications_dialog; GtkLabel *restrict_applications_description; @@ -399,7 +400,7 @@ update_oars_level (MctUserControls *self) if (rating_age_category == NULL || all_categories_unset) rating_age_category = _("All Ages"); - gtk_button_set_label (self->oars_button, rating_age_category); + gtk_label_set_label (self->oars_button_label, rating_age_category); } static void @@ -670,13 +671,13 @@ on_set_age_action_activated (GSimpleAction *action, /* Update the button */ if (age == oars_disabled_age) - gtk_button_set_label (self->oars_button, _("All Ages")); + gtk_label_set_label (self->oars_button_label, _("All Ages")); for (i = 0; age != oars_disabled_age && entries[i] != NULL; i++) { if (ages[i] == age) { - gtk_button_set_label (self->oars_button, entries[i]); + gtk_label_set_label (self->oars_button_label, entries[i]); break; } } @@ -966,6 +967,7 @@ mct_user_controls_class_init (MctUserControlsClass *klass) gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_web_browsers_switch); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_web_browsers_description); gtk_widget_class_bind_template_child (widget_class, MctUserControls, oars_button); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, oars_button_label); gtk_widget_class_bind_template_child (widget_class, MctUserControls, oars_popover); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_dialog); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_description); diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index 6b89fa3..78d8214 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -487,6 +487,27 @@ end center oars_popover + + + True + horizontal + + + True + + True + center + + + + + True + pan-down-symbolic + 4 + + + + 1 From 3db3a42e8dbf31c31133f4769412fa7f1e4d8aee Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 25 Feb 2020 12:09:41 +0000 Subject: [PATCH 14/16] user-controls: Line wrap labels rather than ellipsising The labels are too long to fit on a single line, given the default width of the user controls widget, so allow them to wrap onto multiple lines rather than unhelpfully ellipsising. Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/user-controls.ui | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index 78d8214..703ab66 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -82,7 +82,8 @@ False start True - end + none + True 0 Prevents {username} from running web browsers. Note that limited web content may still be available in other applications. @@ -165,7 +166,8 @@ False start True - end + none + True 0 Prevents specified applications from being used by {username}. @@ -293,7 +295,8 @@ False start True - end + none + True 0 Prevents {username} from installing applications. @@ -377,7 +380,8 @@ False start True - end + none + True 0 Prevents {username}’s application installations from being available to all users. @@ -462,7 +466,8 @@ False start True - end + none + True 0 Restricts application installation to those suitable for certain ages or above. From 2d43ac38ec1f2a1788df6b090c98ddd18128892a Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 25 Feb 2020 12:49:29 +0000 Subject: [PATCH 15/16] =?UTF-8?q?libmalcontent-ui:=20Restyle=20=E2=80=98re?= =?UTF-8?q?stricts=E2=80=99=20switches=20in=20yellow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This has fewer ‘error’ connotations than red. See https://gitlab.freedesktop.org/pwithnall/malcontent/issues/11#note_419124. Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/restricts-switch.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmalcontent-ui/restricts-switch.css b/libmalcontent-ui/restricts-switch.css index c44debe..3bf85ae 100644 --- a/libmalcontent-ui/restricts-switch.css +++ b/libmalcontent-ui/restricts-switch.css @@ -1,11 +1,11 @@ /* FIXME: This ‘negative’ variant of a GtkSwitch should probably be * upstreamed to GTK. See https://gitlab.gnome.org/GNOME/gtk/issues/2470 */ switch:checked.restricts { - background-color: @error_color; + background-color: #fffd33; } switch:checked.restricts, switch:checked.restricts slider { - border-color: #8b0000; + border-color: #ffd52b; } switch:disabled.restricts { From 8c7815e33c617234e1a67d8f4360d5f38c1b640d Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 26 Feb 2020 09:15:19 +0000 Subject: [PATCH 16/16] restrict-applications-dialog: Allow introduction label to wrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rather than ellipsising, allow it to wrap. Also ensure it’s left-aligned. Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/restrict-applications-dialog.ui | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libmalcontent-ui/restrict-applications-dialog.ui b/libmalcontent-ui/restrict-applications-dialog.ui index 13996c0..b0ebf15 100644 --- a/libmalcontent-ui/restrict-applications-dialog.ui +++ b/libmalcontent-ui/restrict-applications-dialog.ui @@ -24,6 +24,11 @@ Restrict {username} from using the following installed applications. False + none + True + start + 0 + True static