diff options
author | Mpho Jele <mphokjele@gmail.com> | 2022-06-19 16:55:02 +0200 |
---|---|---|
committer | Felipe Borges <felipeborges@gnome.org> | 2022-07-24 15:29:46 +0000 |
commit | 272b73795dfdc6a7777b3c410e5568aca30265b3 (patch) | |
tree | ebbe49b3e0a90d59bf485c2ab766bcca26f79523 /panels | |
parent | 311268c4f74135eed7ae832fe6d99acf800e5e93 (diff) | |
download | gnome-control-center-272b73795dfdc6a7777b3c410e5568aca30265b3.tar.gz |
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
Diffstat (limited to 'panels')
-rw-r--r-- | panels/user-accounts/cc-user-panel.c | 17 | ||||
-rw-r--r-- | 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> |