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:
parent
d80ed10592
commit
358cad3a24
|
@ -29,6 +29,7 @@ libmalcontent_ui_public_deps = [
|
|||
dependency('glib-2.0', version: '>= 2.54.2'),
|
||||
dependency('gobject-2.0', version: '>= 2.54'),
|
||||
dependency('gtk+-3.0', version: '>= 3.24'),
|
||||
dependency('libhandy-1', version: '>= 1.1.0'),
|
||||
libmalcontent_dep,
|
||||
]
|
||||
libmalcontent_ui_private_deps = [
|
||||
|
|
|
@ -75,20 +75,18 @@ struct _MctUserControls
|
|||
{
|
||||
GtkGrid parent_instance;
|
||||
|
||||
GtkLabel *description_label;
|
||||
GMenu *age_menu;
|
||||
GtkSwitch *restrict_software_installation_switch;
|
||||
GtkLabel *restrict_software_installation_description;
|
||||
HdyActionRow *restrict_software_installation_row;
|
||||
GtkSwitch *restrict_web_browsers_switch;
|
||||
GtkLabel *restrict_web_browsers_description;
|
||||
HdyActionRow *restrict_web_browsers_row;
|
||||
GtkButton *oars_button;
|
||||
GtkLabel *oars_button_label;
|
||||
GtkPopover *oars_popover;
|
||||
MctRestrictApplicationsDialog *restrict_applications_dialog;
|
||||
GtkLabel *restrict_applications_description;
|
||||
GtkListBoxRow *restrict_applications_row;
|
||||
|
||||
GtkListBox *application_usage_permissions_listbox;
|
||||
GtkListBox *software_installation_permissions_listbox;
|
||||
HdyActionRow *restrict_applications_row;
|
||||
|
||||
GSimpleActionGroup *action_group; /* (owned) */
|
||||
|
||||
|
@ -111,6 +109,7 @@ struct _MctUserControls
|
|||
ActUserAccountType user_account_type;
|
||||
gchar *user_locale; /* (nullable) (owned) */
|
||||
gchar *user_display_name; /* (nullable) (owned) */
|
||||
gchar *description; /* (nullable) (owned) */
|
||||
};
|
||||
|
||||
static gboolean blocklist_apps_cb (gpointer data);
|
||||
|
@ -123,7 +122,8 @@ static void on_restrict_web_browsers_switch_active_changed_cb (GtkSwitch
|
|||
GParamSpec *pspec,
|
||||
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);
|
||||
|
||||
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,
|
||||
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,
|
||||
GVariant *param,
|
||||
gpointer user_data);
|
||||
|
@ -146,7 +142,7 @@ static void on_permission_allowed_cb (GObject *obj,
|
|||
GParamSpec *pspec,
|
||||
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
|
||||
{
|
||||
|
@ -157,12 +153,14 @@ typedef enum
|
|||
PROP_USER_LOCALE,
|
||||
PROP_USER_DISPLAY_NAME,
|
||||
PROP_DBUS_CONNECTION,
|
||||
PROP_DESCRIPTION,
|
||||
} MctUserControlsProperty;
|
||||
|
||||
static GParamSpec *properties[PROP_DBUS_CONNECTION + 1];
|
||||
static GParamSpec *properties[PROP_DESCRIPTION + 1];
|
||||
|
||||
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 */
|
||||
|
@ -472,19 +470,21 @@ update_labels_from_name (MctUserControls *self)
|
|||
{
|
||||
g_autofree gchar *l = NULL;
|
||||
|
||||
gtk_label_set_markup (self->description_label, self->description);
|
||||
|
||||
/* Translators: The placeholder is a user’s 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);
|
||||
|
||||
/* 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);
|
||||
hdy_action_row_set_subtitle (self->restrict_applications_row, 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_software_installation_description, l);
|
||||
hdy_action_row_set_subtitle (self->restrict_software_installation_row, l);
|
||||
g_clear_pointer (&l, g_free);
|
||||
}
|
||||
|
||||
|
@ -585,7 +585,8 @@ on_restrict_web_browsers_switch_active_changed_cb (GtkSwitch *s,
|
|||
}
|
||||
|
||||
static void
|
||||
on_restrict_applications_button_clicked_cb (GtkButton *button,
|
||||
on_restrict_applications_action_activated (GSimpleAction *action,
|
||||
GVariant *param,
|
||||
gpointer 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);
|
||||
}
|
||||
|
||||
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
|
||||
on_set_age_action_activated (GSimpleAction *action,
|
||||
GVariant *param,
|
||||
|
@ -688,53 +678,6 @@ on_set_age_action_activated (GSimpleAction *action,
|
|||
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 don’t 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 */
|
||||
|
||||
static void
|
||||
|
@ -850,6 +793,10 @@ mct_user_controls_get_property (GObject *object,
|
|||
g_value_set_object (value, self->dbus_connection);
|
||||
break;
|
||||
|
||||
case PROP_DESCRIPTION:
|
||||
g_value_set_string (value, self->description);
|
||||
break;
|
||||
|
||||
default:
|
||||
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);
|
||||
break;
|
||||
|
||||
case PROP_DESCRIPTION:
|
||||
mct_user_controls_set_description (self, g_value_get_string (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
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_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)
|
||||
*
|
||||
|
@ -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_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_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_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_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);
|
||||
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_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);
|
||||
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
|
||||
|
@ -1091,12 +1056,6 @@ mct_user_controls_init (MctUserControls *self)
|
|||
G_ACTION_GROUP (self->action_group));
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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:
|
||||
* @self: an #MctUserControls
|
||||
|
|
|
@ -27,13 +27,14 @@
|
|||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libhandy-1/handy.h>
|
||||
#include <libmalcontent/malcontent.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#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);
|
||||
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,
|
||||
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,
|
||||
MctAppFilterBuilder *builder);
|
||||
|
||||
|
|
|
@ -2,107 +2,43 @@
|
|||
<!-- Copyright © 2018, 2019, 2020 Endless, Inc. -->
|
||||
<interface domain="malcontent">
|
||||
<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="row-spacing">6</property>
|
||||
<property name="column-spacing">12</property>
|
||||
<property name="valign">start</property>
|
||||
<child>
|
||||
<object class="HdyPreferencesGroup">
|
||||
<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 -->
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<object class="HdyPreferencesGroup">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.0</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>
|
||||
|
||||
<property name="title" translatable="yes">Application Usage Restrictions</property>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<object class="HdyActionRow" id="restrict_web_browsers_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="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="title" translatable="yes">Restrict _Web Browsers</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_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>
|
||||
<property name="activatable_widget">restrict_web_browsers_switch</property>
|
||||
<!-- 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>
|
||||
<attributes>
|
||||
<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>
|
||||
<property name="subtitle">Prevents {username} from running web browsers. Limited web content may still be available in other applications.</property>
|
||||
<property name="subtitle_lines">0</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="restrict_web_browsers_switch">
|
||||
<property name="visible">True</property>
|
||||
|
@ -114,209 +50,48 @@
|
|||
<class name="restricts" />
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="restrict_applications_row">
|
||||
<object class="HdyActionRow" id="restrict_applications_row">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="activatable">True</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_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="title" translatable="yes">_Restrict Applications</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: -->
|
||||
<property name="label">Prevents specified applications from being used by {username}.</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="0.88"/>
|
||||
</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" />
|
||||
<property name="subtitle">Prevents specified applications from being used by {username}.</property>
|
||||
<property name="subtitle_lines">0</property>
|
||||
<property name="action-name">permissions.restrict-applications</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</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>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="content"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="left-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<!-- Software Installation Restrictions -->
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<object class="HdyPreferencesGroup">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin-top">12</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>
|
||||
|
||||
<property name="title" translatable="yes">Software Installation Restrictions</property>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<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">
|
||||
<object class="HdyActionRow" id="restrict_software_installation_row">
|
||||
<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="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="title" translatable="yes">Restrict Application _Installation</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_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>
|
||||
<property name="activatable_widget">restrict_software_installation_switch</property>
|
||||
<!-- Set dynamically from user-controls.c: -->
|
||||
<property name="label">Prevents {username} from installing applications.</property>
|
||||
<attributes>
|
||||
<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>
|
||||
<property name="subtitle">Prevents {username} from installing applications.</property>
|
||||
<property name="subtitle_lines">0</property>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="restrict_software_installation_switch">
|
||||
<property name="visible">True</property>
|
||||
|
@ -328,80 +103,18 @@
|
|||
<class name="restricts" />
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<object class="HdyActionRow">
|
||||
<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="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="title" translatable="yes">Application _Suitability</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">oars_button</property>
|
||||
<accessibility>
|
||||
<relation target="oars_button" type="label-for"/>
|
||||
<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>
|
||||
<property name="activatable_widget">oars_button</property>
|
||||
<property name="subtitle" translatable="yes">Restricts browsing or installation of applications to applications suitable for certain ages or above.</property>
|
||||
<property name="subtitle_lines">0</property>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="oars_button">
|
||||
<property name="visible">True</property>
|
||||
|
@ -433,24 +146,16 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="content"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="left-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</template>
|
||||
|
||||
<object class="GtkPopoverMenu" id="oars_popover">
|
||||
|
@ -469,18 +174,6 @@
|
|||
</widgets>
|
||||
</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">
|
||||
<property name="visible">False</property>
|
||||
<property name="modal">True</property>
|
||||
|
|
|
@ -214,7 +214,6 @@ mct_application_activate (GApplication *application)
|
|||
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->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. */
|
||||
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'>"
|
||||
"Read guidance</a> on what to consider."),
|
||||
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);
|
||||
|
||||
|
|
|
@ -55,42 +55,14 @@
|
|||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</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">It’s 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>
|
||||
<object class="MctUserControls" id="user_controls">
|
||||
<property name="halign">center</property>
|
||||
<property name="visible">True</property>
|
||||
<!-- Content is set in code; this string is just a placeholder -->
|
||||
<property name="description">It’s 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>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
|
|
Loading…
Reference in New Issue