Commit 414f232e authored by Adrien Plazas's avatar Adrien Plazas
Browse files

Replace GtkStackSwitcher by HdyViewSwitcher

This helps making the window adaptive.
parent d9d014bf
......@@ -25,7 +25,7 @@
</child>
<child type="title">
<object class="GtkStackSwitcher" id="stack_switcher">
<object class="HdyViewSwitcher" id="view_switcher">
<property name="visible">True</property>
</object>
</child>
......
......@@ -32,7 +32,7 @@ namespace Usage
public class HeaderBar : Hdy.HeaderBar
{
[GtkChild]
private Gtk.StackSwitcher stack_switcher;
private Hdy.ViewSwitcher view_switcher;
[GtkChild]
private Gtk.ToggleButton performance_search_button;
......@@ -66,7 +66,7 @@ namespace Usage
{
mode = HeaderBarMode.PERFORMANCE;
menu = new Usage.PrimaryMenu();
stack_switcher.set_stack(stack);
view_switcher.set_stack(stack);
this.primary_menu_button.set_popover(menu);
set_mode(HeaderBarMode.PERFORMANCE);
......@@ -90,12 +90,12 @@ namespace Usage
switch(mode)
{
case HeaderBarMode.PERFORMANCE:
show_stack_switcher();
show_view_switcher();
performance_search_button.show();
break;
case HeaderBarMode.STORAGE:
if(title_text == "")
show_stack_switcher();
show_view_switcher();
else
show_title();
......@@ -121,7 +121,7 @@ namespace Usage
[GtkCallback]
private void on_storage_rescan_button_clicked () {
stack_switcher.show ();
view_switcher.show ();
storage_select_button.hide ();
storage_rescan_button.hide ();
......@@ -168,9 +168,9 @@ namespace Usage
this.title_text = title;
}
public void show_stack_switcher()
public void show_view_switcher()
{
set_custom_title(stack_switcher);
set_custom_title(view_switcher);
}
public void show_storage_back_button(bool show)
......@@ -243,7 +243,7 @@ namespace Usage
storage_cancel_button.hide();
storage_selection_menu = null;
if(title_text == "")
show_stack_switcher();
show_view_switcher();
else
show_title();
((StorageView) (GLib.Application.get_default() as Application).get_window().get_views()[Views.STORAGE]).show_action_bar(false);
......
......@@ -90,7 +90,7 @@ namespace Usage
{
(GLib.Application.get_default() as Application).get_window().get_header_bar().show_storage_back_button(false);
(GLib.Application.get_default() as Application).get_window().get_header_bar().set_title_text("");
(GLib.Application.get_default() as Application).get_window().get_header_bar().show_stack_switcher();
(GLib.Application.get_default() as Application).get_window().get_header_bar().show_view_switcher();
}
else
{
......
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