Commit 9de7739e authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui
Browse files

Switch between the HdySqueezer and HdyViewSwitcherBar on small size

parent 9ff92bae
......@@ -95,12 +95,41 @@
</object>
</child>
<child>
<object class="GtkStack" id="stack">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="HdyViewSwitcherBar" id="switcher_bar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stack">stack</property>
<property name="reveal">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</template>
</interface>
......@@ -37,7 +37,16 @@ public class Window : Gtk.ApplicationWindow {
[GtkChild]
private Gtk.Stack stack;
[GtkChild]
private Hdy.ViewSwitcherBar switcher_bar;
[GtkChild]
private Hdy.Squeezer squeezer;
[GtkChild]
private Hdy.ViewSwitcher title_wide_switcher;
[GtkChild]
private Hdy.ViewSwitcher title_narrow_switcher;
[GtkChild]
private Gtk.Box title_text;
[GtkChild]
private Gtk.MenuButton menu_button;
private GLib.Settings settings;
......@@ -89,6 +98,13 @@ public class Window : Gtk.ApplicationWindow {
update_header_bar ();
});
this.size_allocate.connect((widget, allocation) => {
switcher_bar.set_reveal(allocation.width < 500);
squeezer.set_child_enabled(title_wide_switcher, allocation.width > 800);
squeezer.set_child_enabled(title_narrow_switcher, allocation.width > 500);
squeezer.set_child_enabled(title_text, allocation.width <= 500);
});
var header_bar_id = header_bar.notify["mode"].connect (() => {
update_header_bar ();
});
......
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