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
This commit is contained in:
Mpho Jele 2022-06-19 16:45:45 +02:00 committed by Felipe Borges
parent cf99eb4529
commit 311268c4f7

View file

@ -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