apprt/gtk: add ability to put tabs in the headerbar

Signed-off-by: Tristan Partin <tristan@partin.io>
This commit is contained in:
Tristan Partin
2024-11-15 22:43:29 -06:00
parent 77ab6448f5
commit b7c0d4c41a
3 changed files with 7 additions and 1 deletions

View File

@ -289,6 +289,10 @@ pub fn init(self: *Window, app: *App) !void {
// left and right is not supported in libadwaita.
.top, .left, .right => c.adw_toolbar_view_add_top_bar(toolbar_view, tab_bar_widget),
.bottom => c.adw_toolbar_view_add_bottom_bar(toolbar_view, tab_bar_widget),
.headerbar => {
c.adw_tab_bar_set_autohide(tab_bar, 0);
c.adw_header_bar_set_title_widget(@ptrCast(@alignCast(self.header.?)), tab_bar_widget);
},
}
c.adw_toolbar_view_set_content(toolbar_view, box);
@ -334,6 +338,7 @@ pub fn init(self: *Window, app: *App) !void {
.top,
.left,
.right,
.headerbar,
=> c.gtk_box_prepend(
@ptrCast(box),
@ptrCast(@alignCast(tab_bar)),

View File

@ -29,7 +29,7 @@ pub const Notebook = union(enum) {
const notebook_widget: *c.GtkWidget = c.gtk_notebook_new();
const notebook: *c.GtkNotebook = @ptrCast(notebook_widget);
const notebook_tab_pos: c_uint = switch (app.config.@"gtk-tabs-location") {
.top => c.GTK_POS_TOP,
.top, .headerbar => c.GTK_POS_TOP,
.bottom => c.GTK_POS_BOTTOM,
.left => c.GTK_POS_LEFT,
.right => c.GTK_POS_RIGHT,

View File

@ -4511,6 +4511,7 @@ pub const GtkTabsLocation = enum {
bottom,
left,
right,
headerbar,
};
/// See adw-toolbar-style