[gnome-control-center/gnome-42] 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/gnome-42] user-accounts: Make back button switch to current user or panels list
- Date: Thu, 4 Aug 2022 09:31:15 +0000 (UTC)
commit f794b14bc9a0f7397598bb35b1b0d8ed0f68c249
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 | 5 ++++-
2 files changed, 20 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 ff2488df1..8f804b49b 100644
--- a/panels/user-accounts/cc-user-panel.ui
+++ b/panels/user-accounts/cc-user-panel.ui
@@ -27,7 +27,10 @@
<object class="GtkButton" id="back_button">
<property name="visible">False</property>
<property name="icon-name">go-previous-symbolic</property>
- <signal name="clicked" handler="show_current_user" object="CcUserPanel" swapped="yes"/>
+ <accessibility>
+ <property name="label" translatable="yes">Back</property>
+ </accessibility>
+ <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]