[gnome-control-center] user-accounts: Make back button switch to current user or panels list
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] user-accounts: Make back button switch to current user or panels list
- Date: Sun, 24 Jul 2022 15:32:09 +0000 (UTC)
commit 272b73795dfdc6a7777b3c410e5568aca30265b3
Author: Mpho Jele <mphokjele gmail com>
Date: Sun Jun 19 16:55:02 2022 +0200
user-accounts: Make back button switch to current user or panels list
When the window AdwLeaflet is folded the back button should either
switch to the panels list if the selected user is the current user
or switch to the current user if the selected user is from the
"other users" list
panels/user-accounts/cc-user-panel.c | 17 ++++++++++++++++-
panels/user-accounts/cc-user-panel.ui | 2 +-
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/panels/user-accounts/cc-user-panel.c b/panels/user-accounts/cc-user-panel.c
index 244ce71e9..6b750d926 100644
--- a/panels/user-accounts/cc-user-panel.c
+++ b/panels/user-accounts/cc-user-panel.c
@@ -185,6 +185,21 @@ show_current_user (CcUserPanel *self)
show_user (user, self);
}
+
+static void
+on_back_button_clicked_cb (CcUserPanel *self)
+{
+
+ if (act_user_get_uid (self->selected_user) == getuid ()) {
+ gtk_widget_activate_action (GTK_WIDGET (self),
+ "window.navigate",
+ "i",
+ ADW_NAVIGATION_DIRECTION_BACK);
+ } else {
+ show_current_user (self);
+ }
+}
+
static const gchar *
get_real_or_user_name (ActUser *user)
{
@@ -1549,6 +1564,6 @@ cc_user_panel_class_init (CcUserPanelClass *klass)
gtk_widget_class_bind_template_callback (widget_class, dismiss_notification);
gtk_widget_class_bind_template_callback (widget_class, restart_now);
gtk_widget_class_bind_template_callback (widget_class, set_selected_user);
- gtk_widget_class_bind_template_callback (widget_class, show_current_user);
+ gtk_widget_class_bind_template_callback (widget_class, on_back_button_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, show_history);
}
diff --git a/panels/user-accounts/cc-user-panel.ui b/panels/user-accounts/cc-user-panel.ui
index 4e317da9b..3f0362bea 100644
--- a/panels/user-accounts/cc-user-panel.ui
+++ b/panels/user-accounts/cc-user-panel.ui
@@ -30,7 +30,7 @@
<accessibility>
<property name="label" translatable="yes">Back</property>
</accessibility>
- <signal name="clicked" handler="show_current_user" object="CcUserPanel" swapped="yes"/>
+ <signal name="clicked" handler="on_back_button_clicked_cb" object="CcUserPanel" swapped="yes"/>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]