Skip to content

Commit

Permalink
Add header to sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Wootten authored and Jeremy Wootten committed Oct 19, 2024
1 parent 3bf4ef0 commit 45cfbbd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/View/Sidebar/SidebarWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


public class Sidebar.SidebarWindow : Gtk.Box, Files.SidebarInterface {
public Hdy.HeaderBar headerbar;
private Gtk.ScrolledWindow scrolled_window;
private BookmarkListBox bookmark_listbox;
private DeviceListBox device_listbox;
Expand All @@ -23,6 +24,15 @@ public class Sidebar.SidebarWindow : Gtk.Box, Files.SidebarInterface {
}

construct {
orientation = Gtk.Orientation.VERTICAL;
get_style_context ().add_class (Gtk.STYLE_CLASS_SIDEBAR);

headerbar = new Hdy.HeaderBar () {
show_close_button = true
};
headerbar.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
add (headerbar);

bookmark_listbox = new BookmarkListBox (this);
device_listbox = new DeviceListBox (this);
network_listbox = new NetworkListBox (this);
Expand Down
8 changes: 6 additions & 2 deletions src/View/Window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class Files.View.Window : Hdy.ApplicationWindow {
public Hdy.TabView tab_view;
public Hdy.TabBar tab_bar;
private Gtk.Paned lside_pane;
public SidebarInterface sidebar;
public Sidebar.SidebarWindow sidebar;
private Chrome.ButtonWithMenu button_forward;
private Chrome.ButtonWithMenu button_back;
private Chrome.LocationBar? location_bar;
Expand Down Expand Up @@ -217,7 +217,7 @@ public class Files.View.Window : Hdy.ApplicationWindow {
};

headerbar = new Hdy.HeaderBar () {
show_close_button = false,
show_close_button = true,
custom_title = new Gtk.Label (null)
};
headerbar.pack_start (button_back);
Expand Down Expand Up @@ -274,6 +274,10 @@ public class Files.View.Window : Hdy.ApplicationWindow {
lside_pane.show_all ();
add (lside_pane);

var header_group = new Hdy.HeaderGroup ();
header_group.add_header_bar (sidebar.headerbar);
header_group.add_header_bar (headerbar);

/** Apply preferences */
var prefs = Files.Preferences.get_default (); // Bound to settings schema by Application
get_action ("show-hidden").set_state (prefs.show_hidden_files);
Expand Down

0 comments on commit 45cfbbd

Please sign in to comment.