Commit 2a870dcb authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko

display-box: Show savestates list as an overlay on small sizes

parent c1b1a146
Pipeline #103477 passed with stages
in 25 minutes and 35 seconds
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkBox" id="display_box"> <object class="GtkOverlay" id="display_overlay">
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<object class="GtkEventBox" id="display_bin"> <object class="GtkEventBox" id="display_bin">
...@@ -33,9 +33,11 @@ ...@@ -33,9 +33,11 @@
<property name="hexpand">True</property> <property name="hexpand">True</property>
</object> </object>
</child> </child>
<child> <child type="overlay">
<object class="GamesSavestatesList" id="savestates_list"> <object class="GamesSavestatesList" id="savestates_list">
<property name="visible">True</property> <property name="visible">True</property>
<property name="halign">end</property>
<signal name="size-allocate" handler="on_savestates_list_size_allocate"/>
</object> </object>
</child> </child>
</object> </object>
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<style>
<class name="solid-background"/>
</style>
<child> <child>
<object class="GtkSeparator"> <object class="GtkSeparator">
<property name="visible">True</property> <property name="visible">True</property>
......
...@@ -34,7 +34,7 @@ private class Games.DisplayBox : Gtk.Bin { ...@@ -34,7 +34,7 @@ private class Games.DisplayBox : Gtk.Bin {
public Runner runner { public Runner runner {
get { return _runner; } get { return _runner; }
set { set {
stack.visible_child = display_box; stack.visible_child = display_overlay;
_runner = value; _runner = value;
remove_display (); remove_display ();
...@@ -57,7 +57,7 @@ private class Games.DisplayBox : Gtk.Bin { ...@@ -57,7 +57,7 @@ private class Games.DisplayBox : Gtk.Bin {
[GtkChild] [GtkChild]
private ErrorDisplay error_display; private ErrorDisplay error_display;
[GtkChild] [GtkChild]
private Gtk.Box display_box; private Gtk.Overlay display_overlay;
[GtkChild] [GtkChild]
private Gtk.EventBox display_bin; private Gtk.EventBox display_bin;
[GtkChild] [GtkChild]
...@@ -135,4 +135,22 @@ private class Games.DisplayBox : Gtk.Bin { ...@@ -135,4 +135,22 @@ private class Games.DisplayBox : Gtk.Bin {
private void on_fullscreen_header_bar_size_allocated (Gtk.Allocation allocation) { private void on_fullscreen_header_bar_size_allocated (Gtk.Allocation allocation) {
fullscreen_header_bar_height = allocation.height; fullscreen_header_bar_height = allocation.height;
} }
[GtkCallback]
private void on_savestates_list_size_allocate (Gtk.Allocation allocation) {
update_margin ();
}
public override void size_allocate (Gtk.Allocation allocation) {
base.size_allocate (allocation);
update_margin ();
}
private void update_margin () {
var width = get_allocated_width ();
if (width > 900)
display_bin.margin_right = savestates_list.get_allocated_width ();
else
display_bin.margin_right = 0;
}
} }
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