user-controls: Include user display name in the description labels

This clarifies that the settings apply to that user.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #11
This commit is contained in:
Philip Withnall 2020-02-24 17:28:21 +00:00
parent dee4d92ea9
commit 5a1bfb842a
2 changed files with 43 additions and 4 deletions

View File

@ -76,11 +76,15 @@ struct _MctUserControls
GMenu *age_menu; GMenu *age_menu;
GtkSwitch *restrict_system_installation_switch; GtkSwitch *restrict_system_installation_switch;
GtkLabel *restrict_system_installation_description;
GtkSwitch *restrict_user_installation_switch; GtkSwitch *restrict_user_installation_switch;
GtkLabel *restrict_user_installation_description;
GtkSwitch *restrict_web_browsers_switch; GtkSwitch *restrict_web_browsers_switch;
GtkLabel *restrict_web_browsers_description;
GtkButton *restriction_button; GtkButton *restriction_button;
GtkPopover *restriction_popover; GtkPopover *restriction_popover;
MctRestrictApplicationsDialog *restrict_applications_dialog; MctRestrictApplicationsDialog *restrict_applications_dialog;
GtkLabel *restrict_applications_description;
GtkListBox *application_usage_permissions_listbox; GtkListBox *application_usage_permissions_listbox;
GtkListBox *software_installation_permissions_listbox; GtkListBox *software_installation_permissions_listbox;
@ -475,6 +479,32 @@ update_restrict_web_browsers (MctUserControls *self)
self); self);
} }
static void
update_labels_from_name (MctUserControls *self)
{
g_autofree gchar *l = NULL;
/* Translators: The placeholder is a users 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 users 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 users 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 users display name. */
l = g_strdup_printf (_("Prevents %ss 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 static void
setup_parental_control_settings (MctUserControls *self) setup_parental_control_settings (MctUserControls *self)
{ {
@ -498,6 +528,7 @@ setup_parental_control_settings (MctUserControls *self)
update_categories_from_language (self); update_categories_from_language (self);
update_allow_app_installation (self); update_allow_app_installation (self);
update_restrict_web_browsers (self); update_restrict_web_browsers (self);
update_labels_from_name (self);
} }
/* Callbacks */ /* 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, 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_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_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_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_button);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, restriction_popover); 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_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, application_usage_permissions_listbox);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, software_installation_permissions_listbox); gtk_widget_class_bind_template_child (widget_class, MctUserControls, software_installation_permissions_listbox);

View File

@ -84,7 +84,8 @@
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="ellipsize">end</property> <property name="ellipsize">end</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Prevents the user from running web browsers, but limited web content may still be available in other applications.</property> <!-- Set dynamically from user-controls.c: -->
<property name="label">Prevents {username} from running web browsers. Note that limited web content may still be available in other applications.</property>
<attributes> <attributes>
<attribute name="scale" value="0.88"/> <attribute name="scale" value="0.88"/>
</attributes> </attributes>
@ -166,7 +167,8 @@
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="ellipsize">end</property> <property name="ellipsize">end</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Prevents specified applications from being used.</property> <!-- Set dynamically from user-controls.c: -->
<property name="label">Prevents specified applications from being used by {username}.</property>
<attributes> <attributes>
<attribute name="scale" value="0.88"/> <attribute name="scale" value="0.88"/>
</attributes> </attributes>
@ -293,7 +295,8 @@
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="ellipsize">end</property> <property name="ellipsize">end</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Prevents the user from installing applications.</property> <!-- Set dynamically from user-controls.c: -->
<property name="label">Prevents {username} from installing applications.</property>
<attributes> <attributes>
<attribute name="scale" value="0.88"/> <attribute name="scale" value="0.88"/>
</attributes> </attributes>
@ -376,7 +379,8 @@
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="ellipsize">end</property> <property name="ellipsize">end</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Prevents the users application installations from being available to all users.</property> <!-- Set dynamically from user-controls.c: -->
<property name="label">Prevents {username}s application installations from being available to all users.</property>
<attributes> <attributes>
<attribute name="scale" value="0.88"/> <attribute name="scale" value="0.88"/>
</attributes> </attributes>