Commit d184b242 authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko

preferences-window: Add back button for mobile

Since there's no close button on mobile, it needs an alternative way to
close the dialog.
parent 8d440179
Pipeline #104821 passed with stages
in 14 minutes and 7 seconds
......@@ -25,6 +25,30 @@
<property name="visible">True</property>
<property name="title" translatable="yes">Preferences</property>
<property name="show-close-button">True</property>
<child>
<object class="GtkButton" id="window_back_button">
<property name="visible">False</property>
<signal name="clicked" handler="on_back_clicked"/>
<style>
<class name="image-button"/>
</style>
<child internal-child="accessible">
<object class="AtkObject">
<property name="accessible-name" translatable="yes">Back</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">go-previous-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack-type">start</property>
</packing>
</child>
</object>
</child>
<child>
......@@ -43,19 +67,19 @@
<property name="hexpand">True</property>
<property name="show-close-button">True</property>
<child>
<object class="GtkButton" id="back_button">
<object class="GtkButton" id="page_back_button">
<property name="visible">False</property>
<signal name="clicked" handler="on_back_clicked"/>
<style>
<class name="image-button"/>
</style>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-back">
<object class="AtkObject">
<property name="accessible-name" translatable="yes">Back</property>
</object>
</child>
<child>
<object class="GtkImage" id="back_image">
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">go-previous-symbolic</property>
<property name="icon-size">1</property>
......
......@@ -22,9 +22,10 @@ private class Games.PreferencesWindow : Gtk.Window {
private Gtk.Stack stack;
[GtkChild]
private Hdy.HeaderGroup header_group;
[GtkChild]
private Gtk.Button back_button;
private Gtk.Button page_back_button;
[GtkChild]
private Gtk.Button window_back_button;
private PreferencesSubpage _subpage;
public PreferencesSubpage subpage {
......@@ -107,6 +108,11 @@ private class Games.PreferencesWindow : Gtk.Window {
[GtkCallback]
private void on_back_clicked () {
if (content_box.visible_child == sidebar) {
close ();
return;
}
content_box.visible_child = sidebar;
titlebar_box.visible_child = left_header_bar;
update_header_group ();
......@@ -117,7 +123,8 @@ private class Games.PreferencesWindow : Gtk.Window {
var folded = content_box.folded;
update_header_group ();
back_button.visible = folded;
page_back_button.visible = folded;
window_back_button.visible = folded;
sidebar.show_selection = !folded;
if (folded)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment