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
This commit is contained in:
parent
311268c4f7
commit
272b73795d
2 changed files with 17 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue