user-controls: Use HdyPreferencesPage and HdyActionRow API

This allows us to get styling consistent with
HdyPreferencesWindow and similar content across GNOME.

Part of a consistency push for GNOME 40
This commit is contained in:
Christopher Davis 2021-02-08 05:27:49 -08:00 committed by Georges Basile Stavracas Neto
parent d80ed10592
commit 358cad3a24
6 changed files with 216 additions and 556 deletions

View File

@ -29,6 +29,7 @@ libmalcontent_ui_public_deps = [
dependency('glib-2.0', version: '>= 2.54.2'), dependency('glib-2.0', version: '>= 2.54.2'),
dependency('gobject-2.0', version: '>= 2.54'), dependency('gobject-2.0', version: '>= 2.54'),
dependency('gtk+-3.0', version: '>= 3.24'), dependency('gtk+-3.0', version: '>= 3.24'),
dependency('libhandy-1', version: '>= 1.1.0'),
libmalcontent_dep, libmalcontent_dep,
] ]
libmalcontent_ui_private_deps = [ libmalcontent_ui_private_deps = [

View File

@ -75,20 +75,18 @@ struct _MctUserControls
{ {
GtkGrid parent_instance; GtkGrid parent_instance;
GtkLabel *description_label;
GMenu *age_menu; GMenu *age_menu;
GtkSwitch *restrict_software_installation_switch; GtkSwitch *restrict_software_installation_switch;
GtkLabel *restrict_software_installation_description; HdyActionRow *restrict_software_installation_row;
GtkSwitch *restrict_web_browsers_switch; GtkSwitch *restrict_web_browsers_switch;
GtkLabel *restrict_web_browsers_description; HdyActionRow *restrict_web_browsers_row;
GtkButton *oars_button; GtkButton *oars_button;
GtkLabel *oars_button_label; GtkLabel *oars_button_label;
GtkPopover *oars_popover; GtkPopover *oars_popover;
MctRestrictApplicationsDialog *restrict_applications_dialog; MctRestrictApplicationsDialog *restrict_applications_dialog;
GtkLabel *restrict_applications_description; GtkLabel *restrict_applications_description;
GtkListBoxRow *restrict_applications_row; HdyActionRow *restrict_applications_row;
GtkListBox *application_usage_permissions_listbox;
GtkListBox *software_installation_permissions_listbox;
GSimpleActionGroup *action_group; /* (owned) */ GSimpleActionGroup *action_group; /* (owned) */
@ -111,6 +109,7 @@ struct _MctUserControls
ActUserAccountType user_account_type; ActUserAccountType user_account_type;
gchar *user_locale; /* (nullable) (owned) */ gchar *user_locale; /* (nullable) (owned) */
gchar *user_display_name; /* (nullable) (owned) */ gchar *user_display_name; /* (nullable) (owned) */
gchar *description; /* (nullable) (owned) */
}; };
static gboolean blocklist_apps_cb (gpointer data); static gboolean blocklist_apps_cb (gpointer data);
@ -123,7 +122,8 @@ static void on_restrict_web_browsers_switch_active_changed_cb (GtkSwitch
GParamSpec *pspec, GParamSpec *pspec,
MctUserControls *self); MctUserControls *self);
static void on_restrict_applications_button_clicked_cb (GtkButton *button, static void on_restrict_applications_action_activated (GSimpleAction *action,
GVariant *param,
gpointer user_data); gpointer user_data);
static gboolean on_restrict_applications_dialog_delete_event_cb (GtkWidget *widget, static gboolean on_restrict_applications_dialog_delete_event_cb (GtkWidget *widget,
@ -134,10 +134,6 @@ static void on_restrict_applications_dialog_response_cb (GtkDialog *dialog,
gint response_id, gint response_id,
gpointer user_data); gpointer user_data);
static void on_application_usage_permissions_listbox_activated_cb (GtkListBox *list_box,
GtkListBoxRow *row,
gpointer user_data);
static void on_set_age_action_activated (GSimpleAction *action, static void on_set_age_action_activated (GSimpleAction *action,
GVariant *param, GVariant *param,
gpointer user_data); gpointer user_data);
@ -146,7 +142,7 @@ static void on_permission_allowed_cb (GObject *obj,
GParamSpec *pspec, GParamSpec *pspec,
gpointer user_data); gpointer user_data);
G_DEFINE_TYPE (MctUserControls, mct_user_controls, GTK_TYPE_GRID) G_DEFINE_TYPE (MctUserControls, mct_user_controls, GTK_TYPE_BIN)
typedef enum typedef enum
{ {
@ -157,12 +153,14 @@ typedef enum
PROP_USER_LOCALE, PROP_USER_LOCALE,
PROP_USER_DISPLAY_NAME, PROP_USER_DISPLAY_NAME,
PROP_DBUS_CONNECTION, PROP_DBUS_CONNECTION,
PROP_DESCRIPTION,
} MctUserControlsProperty; } MctUserControlsProperty;
static GParamSpec *properties[PROP_DBUS_CONNECTION + 1]; static GParamSpec *properties[PROP_DESCRIPTION + 1];
static const GActionEntry actions[] = { static const GActionEntry actions[] = {
{ "set-age", on_set_age_action_activated, "u", NULL, NULL, { 0, }} { "set-age", on_set_age_action_activated, "u", NULL, NULL, { 0, }},
{ "restrict-applications", on_restrict_applications_action_activated, NULL, NULL, NULL, { 0, }}
}; };
/* Auxiliary methods */ /* Auxiliary methods */
@ -472,19 +470,21 @@ update_labels_from_name (MctUserControls *self)
{ {
g_autofree gchar *l = NULL; g_autofree gchar *l = NULL;
gtk_label_set_markup (self->description_label, self->description);
/* Translators: The placeholder is a users display name. */ /* Translators: The placeholder is a users display name. */
l = g_strdup_printf (_("Prevents %s from running web browsers. Limited web content may still be available in other applications."), self->user_display_name); l = g_strdup_printf (_("Prevents %s from running web browsers. Limited web content may still be available in other applications."), self->user_display_name);
gtk_label_set_label (self->restrict_web_browsers_description, l); hdy_action_row_set_subtitle (self->restrict_web_browsers_row, l);
g_clear_pointer (&l, g_free); g_clear_pointer (&l, g_free);
/* Translators: The placeholder is a users display name. */ /* Translators: The placeholder is a users display name. */
l = g_strdup_printf (_("Prevents specified applications from being used by %s."), self->user_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); hdy_action_row_set_subtitle (self->restrict_applications_row, l);
g_clear_pointer (&l, g_free); g_clear_pointer (&l, g_free);
/* Translators: The placeholder is a users display name. */ /* Translators: The placeholder is a users display name. */
l = g_strdup_printf (_("Prevents %s from installing applications."), self->user_display_name); l = g_strdup_printf (_("Prevents %s from installing applications."), self->user_display_name);
gtk_label_set_label (self->restrict_software_installation_description, l); hdy_action_row_set_subtitle (self->restrict_software_installation_row, l);
g_clear_pointer (&l, g_free); g_clear_pointer (&l, g_free);
} }
@ -585,7 +585,8 @@ on_restrict_web_browsers_switch_active_changed_cb (GtkSwitch *s,
} }
static void static void
on_restrict_applications_button_clicked_cb (GtkButton *button, on_restrict_applications_action_activated (GSimpleAction *action,
GVariant *param,
gpointer user_data) gpointer user_data)
{ {
MctUserControls *self = MCT_USER_CONTROLS (user_data); MctUserControls *self = MCT_USER_CONTROLS (user_data);
@ -632,17 +633,6 @@ on_restrict_applications_dialog_response_cb (GtkDialog *dialog,
on_restrict_applications_dialog_delete_event_cb (GTK_WIDGET (dialog), NULL, self); on_restrict_applications_dialog_delete_event_cb (GTK_WIDGET (dialog), NULL, self);
} }
static void
on_application_usage_permissions_listbox_activated_cb (GtkListBox *list_box,
GtkListBoxRow *row,
gpointer user_data)
{
MctUserControls *self = MCT_USER_CONTROLS (user_data);
if (row == self->restrict_applications_row)
on_restrict_applications_button_clicked_cb (NULL, self);
}
static void static void
on_set_age_action_activated (GSimpleAction *action, on_set_age_action_activated (GSimpleAction *action,
GVariant *param, GVariant *param,
@ -688,53 +678,6 @@ on_set_age_action_activated (GSimpleAction *action,
schedule_update_blocklisted_apps (self); schedule_update_blocklisted_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);
}
}
static gboolean
on_keynav_failed (GtkWidget *listbox,
GtkDirectionType direction,
gpointer user_data)
{
MctUserControls *self = MCT_USER_CONTROLS (user_data);
GtkWidget *new_widget = NULL;
/* There are currently two listboxes, so dont over-complicate this function. */
if (listbox == GTK_WIDGET (self->application_usage_permissions_listbox) &&
direction == GTK_DIR_DOWN)
new_widget = GTK_WIDGET (self->software_installation_permissions_listbox);
else if (listbox == GTK_WIDGET (self->software_installation_permissions_listbox) &&
direction == GTK_DIR_UP)
new_widget = GTK_WIDGET (self->application_usage_permissions_listbox);
if (new_widget != NULL)
{
gtk_widget_child_focus (new_widget, direction);
return TRUE;
}
return FALSE;
}
/* GObject overrides */ /* GObject overrides */
static void static void
@ -850,6 +793,10 @@ mct_user_controls_get_property (GObject *object,
g_value_set_object (value, self->dbus_connection); g_value_set_object (value, self->dbus_connection);
break; break;
case PROP_DESCRIPTION:
g_value_set_string (value, self->description);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
} }
@ -895,6 +842,10 @@ mct_user_controls_set_property (GObject *object,
self->dbus_connection = g_value_dup_object (value); self->dbus_connection = g_value_dup_object (value);
break; break;
case PROP_DESCRIPTION:
mct_user_controls_set_description (self, g_value_get_string (value));
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
} }
@ -1013,6 +964,25 @@ mct_user_controls_class_init (MctUserControlsClass *klass)
G_PARAM_STATIC_STRINGS | G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY); G_PARAM_EXPLICIT_NOTIFY);
/**
* MctUserControls:description: (nullable)
*
* The description for the currently selected user account, or %NULL if no
* user is selected.
*
* If set, it must be valid UTF-8 and non-empty.
*
* Since: 0.11.0
*/
properties[PROP_DESCRIPTION] =
g_param_spec_string ("description",
"Description",
"The description for the currently selected user account, or %NULL if no user is selected.",
NULL,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/** /**
* MctUserControls:dbus-connection: (not nullable) * MctUserControls:dbus-connection: (not nullable)
* *
@ -1036,26 +1006,21 @@ 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_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, age_menu);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, description_label);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_software_installation_switch); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_software_installation_switch);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_software_installation_description); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_software_installation_row);
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_switch);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_web_browsers_description); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_web_browsers_row);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, oars_button); 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_button_label);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, oars_popover); 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_dialog);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_description);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_row); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_row);
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_restrict_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_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_delete_event_cb);
gtk_widget_class_bind_template_callback (widget_class, on_restrict_applications_dialog_response_cb); gtk_widget_class_bind_template_callback (widget_class, on_restrict_applications_dialog_response_cb);
gtk_widget_class_bind_template_callback (widget_class, on_application_usage_permissions_listbox_activated_cb);
gtk_widget_class_bind_template_callback (widget_class, on_keynav_failed);
} }
static void static void
@ -1091,12 +1056,6 @@ mct_user_controls_init (MctUserControls *self)
G_ACTION_GROUP (self->action_group)); G_ACTION_GROUP (self->action_group));
gtk_popover_bind_model (self->oars_popover, G_MENU_MODEL (self->age_menu), NULL); gtk_popover_bind_model (self->oars_popover, G_MENU_MODEL (self->age_menu), NULL);
/* 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);
} }
/** /**
@ -1461,6 +1420,38 @@ mct_user_controls_set_user_display_name (MctUserControls *self,
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_USER_DISPLAY_NAME]); g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_USER_DISPLAY_NAME]);
} }
/**
* mct_user_controls_set_description:
* @self: an #MctUserControls
* @description: (nullable) (transfer none): the description shown
* above the controls, or %NULL if none.
*
* Set the value of #MctUserControls:description.
*
* Since: 0.11.0
*/
void
mct_user_controls_set_description (MctUserControls *self,
const gchar *description)
{
g_return_if_fail (MCT_IS_USER_CONTROLS (self));
g_return_if_fail (description != NULL);
/* If we have pending unsaved changes from the previous user, force them to be
* saved first. */
flush_update_blocklisted_apps (self);
if (g_strcmp0 (self->description, description) == 0)
return;
g_clear_pointer (&self->description, g_free);
self->description = g_strdup (description);
setup_parental_control_settings (self);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_DESCRIPTION]);
}
/** /**
* mct_user_controls_build_app_filter: * mct_user_controls_build_app_filter:
* @self: an #MctUserControls * @self: an #MctUserControls

View File

@ -27,13 +27,14 @@
#include <glib.h> #include <glib.h>
#include <glib-object.h> #include <glib-object.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <libhandy-1/handy.h>
#include <libmalcontent/malcontent.h> #include <libmalcontent/malcontent.h>
G_BEGIN_DECLS G_BEGIN_DECLS
#define MCT_TYPE_USER_CONTROLS (mct_user_controls_get_type()) #define MCT_TYPE_USER_CONTROLS (mct_user_controls_get_type())
G_DECLARE_FINAL_TYPE (MctUserControls, mct_user_controls, MCT, USER_CONTROLS, GtkGrid) G_DECLARE_FINAL_TYPE (MctUserControls, mct_user_controls, MCT, USER_CONTROLS, GtkBin)
ActUser *mct_user_controls_get_user (MctUserControls *self); ActUser *mct_user_controls_get_user (MctUserControls *self);
void mct_user_controls_set_user (MctUserControls *self, void mct_user_controls_set_user (MctUserControls *self,
@ -59,6 +60,9 @@ const gchar *mct_user_controls_get_user_display_name (MctUserControls *self);
void mct_user_controls_set_user_display_name (MctUserControls *self, void mct_user_controls_set_user_display_name (MctUserControls *self,
const gchar *user_display_name); const gchar *user_display_name);
void mct_user_controls_set_description (MctUserControls *self,
const gchar *description);
void mct_user_controls_build_app_filter (MctUserControls *self, void mct_user_controls_build_app_filter (MctUserControls *self,
MctAppFilterBuilder *builder); MctAppFilterBuilder *builder);

View File

@ -2,107 +2,43 @@
<!-- Copyright © 2018, 2019, 2020 Endless, Inc. --> <!-- Copyright © 2018, 2019, 2020 Endless, Inc. -->
<interface domain="malcontent"> <interface domain="malcontent">
<requires lib="gtk+" version="3.12"/> <requires lib="gtk+" version="3.12"/>
<template class="MctUserControls" parent="GtkGrid"> <template class="MctUserControls" parent="GtkBin">
<child>
<object class="HdyPreferencesPage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="row-spacing">6</property> <child>
<property name="column-spacing">12</property> <object class="HdyPreferencesGroup">
<property name="valign">start</property> <property name="visible">True</property>
<child>
<object class="GtkLabel" id="description_label">
<property name="visible">True</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
<property name="yalign">0.0</property>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
</object>
</child>
<!-- Application Usage Restrictions --> <!-- Application Usage Restrictions -->
<child> <child>
<object class="GtkLabel"> <object class="HdyPreferencesGroup">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0.0</property> <property name="title" translatable="yes">Application Usage Restrictions</property>
<property name="label" translatable="yes">Application Usage Restrictions</property>
<attributes>
<attribute name="weight" value="bold" />
</attributes>
</object>
<packing>
<property name="top-attach">0</property>
<property name="left-attach">0</property>
</packing>
</child>
<child> <child>
<object class="GtkFrame"> <object class="HdyActionRow" id="restrict_web_browsers_row">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="title" translatable="yes">Restrict _Web Browsers</property>
<property name="hexpand">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkListBox" id="application_usage_permissions_listbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="selection_mode">none</property>
<property name="activate-on-single-click">True</property>
<signal name="row-activated" handler="on_application_usage_permissions_listbox_activated_cb" object="MctUserControls" swapped="no" />
<signal name="keynav-failed" handler="on_keynav_failed" object="MctUserControls" swapped="no" />
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="margin-left">12</property>
<property name="margin-right">12</property>
<property name="margin-top">8</property>
<property name="margin-bottom">8</property>
<property name="row-spacing">4</property>
<property name="column-spacing">4</property>
<child>
<object class="GtkLabel" id="restrict_web_browsers_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="ellipsize">end</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Restrict _Web Browsers</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">restrict_web_browsers_switch</property> <property name="activatable_widget">restrict_web_browsers_switch</property>
<accessibility>
<relation target="restrict_web_browsers_switch" type="label-for"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="restrict_web_browsers_description">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="ellipsize">none</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<!-- Set dynamically from user-controls.c: --> <!-- Set dynamically from user-controls.c: -->
<property name="label">Prevents {username} from running web browsers. Limited web content may still be available in other applications.</property> <property name="subtitle">Prevents {username} from running web browsers. Limited web content may still be available in other applications.</property>
<attributes> <property name="subtitle_lines">0</property>
<attribute name="scale" value="0.88"/>
</attributes>
<style>
<class name="dim-label" />
</style>
<accessibility>
<relation target="restrict_web_browsers_switch" type="description-for"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child> <child>
<object class="GtkSwitch" id="restrict_web_browsers_switch"> <object class="GtkSwitch" id="restrict_web_browsers_switch">
<property name="visible">True</property> <property name="visible">True</property>
@ -114,209 +50,48 @@
<class name="restricts" /> <class name="restricts" />
</style> </style>
</object> </object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="height">2</property>
</packing>
</child>
</object>
</child> </child>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkListBoxRow" id="restrict_applications_row"> <object class="HdyActionRow" id="restrict_applications_row">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">True</property> <property name="activatable">True</property>
<property name="selectable">False</property> <property name="title" translatable="yes">_Restrict Applications</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="margin-left">12</property>
<property name="margin-right">12</property>
<property name="margin-top">8</property>
<property name="margin-bottom">8</property>
<property name="row-spacing">4</property>
<property name="column-spacing">4</property>
<child>
<object class="GtkLabel" id="restrict_applications_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="ellipsize">end</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Restrict Applications</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">restrict_applications_button</property>
<accessibility>
<relation target="restrict_applications_button" type="label-for"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="restrict_applications_description">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="ellipsize">none</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<!-- Set dynamically from user-controls.c: --> <!-- Set dynamically from user-controls.c: -->
<property name="label">Prevents specified applications from being used by {username}.</property> <property name="subtitle">Prevents specified applications from being used by {username}.</property>
<attributes> <property name="subtitle_lines">0</property>
<attribute name="scale" value="0.88"/> <property name="action-name">permissions.restrict-applications</property>
</attributes>
<style>
<class name="dim-label" />
</style>
<accessibility>
<relation target="restrict_applications_button" type="description-for"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="restrict_applications_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="relief">none</property>
<signal name="clicked" handler="on_restrict_applications_button_clicked_cb" object="MctUserControls" swapped="no" />
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="icon-name">go-next-symbolic</property> <property name="icon-name">go-next-symbolic</property>
<property name="icon-size">4</property><!-- GTK_ICON_SIZE_BUTTON -->
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="height">2</property>
</packing>
</child>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
<style>
<class name="content"/>
</style>
</object> </object>
</child> </child>
</object>
<packing>
<property name="top-attach">1</property>
<property name="left-attach">0</property>
</packing>
</child>
<!-- Software Installation Restrictions --> <!-- Software Installation Restrictions -->
<child> <child>
<object class="GtkLabel"> <object class="HdyPreferencesGroup">
<property name="visible">True</property> <property name="visible">True</property>
<property name="margin-top">12</property> <property name="title" translatable="yes">Software Installation Restrictions</property>
<property name="xalign">0.0</property>
<property name="label" translatable="yes">Software Installation Restrictions</property>
<attributes>
<attribute name="weight" value="bold" />
</attributes>
</object>
<packing>
<property name="top-attach">2</property>
<property name="left-attach">0</property>
</packing>
</child>
<child> <child>
<object class="GtkFrame"> <object class="HdyActionRow" id="restrict_software_installation_row">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkListBox" id="software_installation_permissions_listbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="selection_mode">none</property>
<property name="activate_on_single_click">False</property>
<signal name="keynav-failed" handler="on_keynav_failed" object="MctUserControls" swapped="no" />
<child>
<object class="GtkListBoxRow">
<property name="visible" bind-source="restrict_software_installation_switch" bind-property="visible" bind-flags="default|sync-create" /> <property name="visible" bind-source="restrict_software_installation_switch" bind-property="visible" bind-flags="default|sync-create" />
<property name="can_focus">True</property> <property name="title" translatable="yes">Restrict Application _Installation</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="margin-left">12</property>
<property name="margin-right">12</property>
<property name="margin-top">8</property>
<property name="margin-bottom">8</property>
<property name="row-spacing">4</property>
<property name="column-spacing">4</property>
<child>
<object class="GtkLabel" id="restrict_software_installation_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="ellipsize">end</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Restrict Application _Installation</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">restrict_software_installation_switch</property> <property name="activatable_widget">restrict_software_installation_switch</property>
<accessibility>
<relation target="restrict_software_installation_switch" type="label-for"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="restrict_software_installation_description">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="ellipsize">none</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<!-- Set dynamically from user-controls.c: --> <!-- Set dynamically from user-controls.c: -->
<property name="label">Prevents {username} from installing applications.</property> <property name="subtitle">Prevents {username} from installing applications.</property>
<attributes> <property name="subtitle_lines">0</property>
<attribute name="scale" value="0.88"/>
</attributes>
<style>
<class name="dim-label" />
</style>
<accessibility>
<relation target="restrict_software_installation_switch" type="description-for"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child> <child>
<object class="GtkSwitch" id="restrict_software_installation_switch"> <object class="GtkSwitch" id="restrict_software_installation_switch">
<property name="visible">True</property> <property name="visible">True</property>
@ -328,80 +103,18 @@
<class name="restricts" /> <class name="restricts" />
</style> </style>
</object> </object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="height">2</property>
</packing>
</child>
</object>
</child> </child>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkListBoxRow"> <object class="HdyActionRow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="title" translatable="yes">Application _Suitability</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="margin-left">12</property>
<property name="margin-right">12</property>
<property name="margin-top">8</property>
<property name="margin-bottom">8</property>
<property name="row-spacing">4</property>
<property name="column-spacing">4</property>
<child>
<object class="GtkLabel" id="oars_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="ellipsize">end</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Application _Suitability</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">oars_button</property> <property name="activatable_widget">oars_button</property>
<accessibility> <property name="subtitle" translatable="yes">Restricts browsing or installation of applications to applications suitable for certain ages or above.</property>
<relation target="oars_button" type="label-for"/> <property name="subtitle_lines">0</property>
<relation target="oars_button" type="flows-to"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="oars_description">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="ellipsize">none</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Restricts browsing or installation of applications to applications suitable for certain ages or above.</property>
<attributes>
<attribute name="scale" value="0.88"/>
</attributes>
<style>
<class name="dim-label" />
</style>
<accessibility>
<relation target="oars_button" type="description-for"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child> <child>
<object class="GtkMenuButton" id="oars_button"> <object class="GtkMenuButton" id="oars_button">
<property name="visible">True</property> <property name="visible">True</property>
@ -433,24 +146,16 @@
</object> </object>
</child> </child>
</object> </object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="height">2</property>
</packing>
</child> </child>
</object> </object>
</child> </child>
<style>
<class name="content"/>
</style>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
</object>
<packing>
<property name="top-attach">3</property>
<property name="left-attach">0</property>
</packing>
</child>
</template> </template>
<object class="GtkPopoverMenu" id="oars_popover"> <object class="GtkPopoverMenu" id="oars_popover">
@ -469,18 +174,6 @@
</widgets> </widgets>
</object> </object>
<object class="GtkSizeGroup">
<property name="mode">horizontal</property>
<widgets>
<widget name="restrict_web_browsers_label" />
<widget name="restrict_web_browsers_description" />
<widget name="restrict_applications_label" />
<widget name="restrict_applications_description" />
<widget name="oars_label" />
<widget name="restrict_software_installation_label" />
</widgets>
</object>
<object class="MctRestrictApplicationsDialog" id="restrict_applications_dialog"> <object class="MctRestrictApplicationsDialog" id="restrict_applications_dialog">
<property name="visible">False</property> <property name="visible">False</property>
<property name="modal">True</property> <property name="modal">True</property>

View File

@ -214,7 +214,6 @@ mct_application_activate (GApplication *application)
self->error_message = GTK_LABEL (gtk_builder_get_object (builder, "error_message")); self->error_message = GTK_LABEL (gtk_builder_get_object (builder, "error_message"));
self->lock_button = GTK_LOCK_BUTTON (gtk_builder_get_object (builder, "lock_button")); self->lock_button = GTK_LOCK_BUTTON (gtk_builder_get_object (builder, "lock_button"));
self->user_accounts_panel_button = GTK_BUTTON (gtk_builder_get_object (builder, "user_accounts_panel_button")); self->user_accounts_panel_button = GTK_BUTTON (gtk_builder_get_object (builder, "user_accounts_panel_button"));
self->help_label = GTK_LABEL (gtk_builder_get_object (builder, "help_label"));
/* Connect signals. */ /* Connect signals. */
g_signal_connect_object (self->user_selector, "notify::user", g_signal_connect_object (self->user_selector, "notify::user",
@ -413,7 +412,7 @@ update_main_stack (MctApplication *self)
"with %s. <a href='https://www.commonsensemedia.org/privacy-and-internet-safety'>" "with %s. <a href='https://www.commonsensemedia.org/privacy-and-internet-safety'>"
"Read guidance</a> on what to consider."), "Read guidance</a> on what to consider."),
act_user_get_real_name (selected_user)); act_user_get_real_name (selected_user));
gtk_label_set_markup (self->help_label, help_label); mct_user_controls_set_description (self->user_controls, help_label);
mct_user_controls_set_user (self->user_controls, selected_user); mct_user_controls_set_user (self->user_controls, selected_user);

View File

@ -55,42 +55,14 @@
<property name="expand">False</property> <property name="expand">False</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-height">370</property>
<child>
<object class="GtkBox">
<property name="margin">18</property>
<property name="orientation">vertical</property>
<property name="spacing">18</property>
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="help_label">
<!-- Content is set in code; this string is just a placeholder -->
<property name="label">Its recommended that restrictions are set as part of an ongoing conversation with $name. Read guidance on what to consider.</property>
<property name="visible">True</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
<property name="yalign">0.0</property>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-role">static</property>
</object>
</child>
</object>
</child>
<child> <child>
<object class="MctUserControls" id="user_controls"> <object class="MctUserControls" id="user_controls">
<property name="halign">center</property>
<property name="visible">True</property> <property name="visible">True</property>
<!-- Content is set in code; this string is just a placeholder -->
<property name="description">Its recommended that restrictions are set as part of an ongoing conversation with $name. Read guidance on what to consider.</property>
<property name="height-request">270</property>
<property name="dbus-connection">dbus_connection</property> <property name="dbus-connection">dbus_connection</property>
</object> </object>
</child>
</object>
</child>
</object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
</packing> </packing>