[gnome-control-center/gnome-42] user-accounts: Show the back button when window leaflet folds



commit 51fc40a60e1490521cc9d25396ec1adb9bfbb0d1
Author: Mpho Jele <mphokjele gmail com>
Date:   Sun Jun 19 16:45:45 2022 +0200

    user-accounts: Show the back button when window leaflet folds
    
    Currently the back button is only shown when viewing a user from the
    "other users" list.
    These changes show the back button when the window AdwLeaflet is
    folded or when the selected is from the "other users" list but never
    when the window is not folded and the selected user is the current
    user.
    
    Fixes: #1719

 panels/user-accounts/cc-user-panel.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/panels/user-accounts/cc-user-panel.c b/panels/user-accounts/cc-user-panel.c
index d2481a48f..244ce71e9 100644
--- a/panels/user-accounts/cc-user-panel.c
+++ b/panels/user-accounts/cc-user-panel.c
@@ -789,6 +789,19 @@ update_fingerprint_row_state (CcUserPanel *self, GParamSpec *spec, CcFingerprint
                 gtk_label_set_text (self->fingerprint_state_label, _("Disabled"));
 }
 
+static void
+show_or_hide_back_button (CcUserPanel *self)
+{
+        gboolean show;
+        gboolean folded;
+
+        g_object_get(self, "folded", &folded, NULL);
+
+        show = folded || act_user_get_uid (self->selected_user) != getuid();
+
+        gtk_widget_set_visible (GTK_WIDGET (self->back_button), show);
+}
+
 static void
 show_user (ActUser *user, CcUserPanel *self)
 {
@@ -888,6 +901,7 @@ show_user (ActUser *user, CcUserPanel *self)
         gtk_widget_set_visible (GTK_WIDGET (self->account_settings_box), !show);
         gtk_widget_set_visible (GTK_WIDGET (self->remove_user_button), !show);
         gtk_widget_set_visible (GTK_WIDGET (self->back_button), !show);
+        show_or_hide_back_button(self);
         gtk_widget_set_visible (GTK_WIDGET (self->other_users), show);
 
         /* Last login: show when administrator or current user */
@@ -1447,6 +1461,11 @@ cc_user_panel_init (CcUserPanel *self)
         self->login_screen_settings = settings_or_null ("org.gnome.login-screen");
 
         setup_main_window (self);
+
+        g_signal_connect_swapped (self,
+                          "notify::folded",
+                          G_CALLBACK (show_or_hide_back_button),
+                          self);
 }
 
 static void


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