user-accounts: Make dim-label behaviour better for parental controls row

This makes it behave a bit more like other rows.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: https://gitlab.freedesktop.org/pwithnall/malcontent/-/issues/26
This commit is contained in:
Philip Withnall 2020-10-19 15:43:52 +01:00 committed by Robert Ancell
parent dc09e0633c
commit 77df081fec
2 changed files with 6 additions and 3 deletions

View file

@ -921,10 +921,15 @@ show_user (ActUser *user, CcUserPanel *self)
#ifdef HAVE_MALCONTENT
/* Parental Controls: Unavailable if user is admin */
if (act_user_get_account_type (user) == ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR) {
GtkStyleContext *context = gtk_widget_get_style_context (self->parental_controls_button_label);
gtk_widget_hide (GTK_WIDGET (self->parental_control_go_next));
/* TRANSLATORS: Status of Parental Controls setup */
gtk_label_set_text (self->parental_controls_button_label, _("Unavailable"));
gtk_style_context_add_class (context, "dim-label");
} else {
GtkStyleContext *context = gtk_widget_get_style_context (self->parental_controls_button_label);
if (is_parental_controls_enabled_for_user (user))
/* TRANSLATORS: Status of Parental Controls setup */
gtk_label_set_text (self->parental_controls_button_label, _("Enabled"));
@ -932,6 +937,7 @@ show_user (ActUser *user, CcUserPanel *self)
/* TRANSLATORS: Status of Parental Controls setup */
gtk_label_set_text (self->parental_controls_button_label, _("Disabled"));
gtk_style_context_remove_class (context, "dim-label");
gtk_widget_show (GTK_WIDGET (self->parental_control_go_next));
}
#endif

View file

@ -356,9 +356,6 @@
<object class="GtkLabel" id="parental_controls_button_label">
<property name="visible">True</property>
<property name="valign">0.5</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="pack_type">end</property>