[gnome-control-center] user-accounts: Make dim-label behaviour better for parental controls row



commit 77df081fecdfe8386fea00d0d4b9de298cbd8a03
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Oct 19 15:43:52 2020 +0100

    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

 panels/user-accounts/cc-user-panel.c  | 6 ++++++
 panels/user-accounts/cc-user-panel.ui | 3 ---
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/panels/user-accounts/cc-user-panel.c b/panels/user-accounts/cc-user-panel.c
index 1d5772345..ee9a8290f 100644
--- a/panels/user-accounts/cc-user-panel.c
+++ b/panels/user-accounts/cc-user-panel.c
@@ -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
diff --git a/panels/user-accounts/cc-user-panel.ui b/panels/user-accounts/cc-user-panel.ui
index 3725d08ef..814c02efd 100644
--- a/panels/user-accounts/cc-user-panel.ui
+++ b/panels/user-accounts/cc-user-panel.ui
@@ -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>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]