mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-22 19:56:08 +03:00
apprt/gtk: style tweaks
This commit is contained in:
@ -281,9 +281,15 @@ pub fn init(self: *Window, app: *App) !void {
|
||||
.top,
|
||||
.left,
|
||||
.right,
|
||||
=> c.gtk_box_prepend(@ptrCast(box), @ptrCast(@alignCast(tab_bar))),
|
||||
=> c.gtk_box_prepend(
|
||||
@ptrCast(box),
|
||||
@ptrCast(@alignCast(tab_bar)),
|
||||
),
|
||||
|
||||
.bottom => c.gtk_box_append(@ptrCast(box), @ptrCast(@alignCast(tab_bar))),
|
||||
.bottom => c.gtk_box_append(
|
||||
@ptrCast(box),
|
||||
@ptrCast(@alignCast(tab_bar)),
|
||||
),
|
||||
}
|
||||
c.adw_tab_bar_set_view(tab_bar, tab_view);
|
||||
|
||||
@ -291,7 +297,8 @@ pub fn init(self: *Window, app: *App) !void {
|
||||
c.adw_tab_bar_set_expand_tabs(tab_bar, 0);
|
||||
}
|
||||
},
|
||||
else => {},
|
||||
|
||||
.gtk_notebook => {},
|
||||
}
|
||||
|
||||
// The box is our main child
|
||||
|
@ -16,7 +16,7 @@ pub const Notebook = union(enum) {
|
||||
adw_tab_view: *AdwTabView,
|
||||
gtk_notebook: *c.GtkNotebook,
|
||||
|
||||
pub fn create(window: *Window) @This() {
|
||||
pub fn create(window: *Window) Notebook {
|
||||
const app = window.app;
|
||||
if (adwaita.enabled(&app.config)) return initAdw(window);
|
||||
return initGtk(window);
|
||||
@ -60,13 +60,6 @@ pub const Notebook = union(enum) {
|
||||
return .{ .gtk_notebook = notebook };
|
||||
}
|
||||
|
||||
pub fn asWidget(self: Notebook) *c.GtkWidget {
|
||||
return switch (self) {
|
||||
.adw_tab_view => |tab_view| @ptrCast(@alignCast(tab_view)),
|
||||
.gtk_notebook => |notebook| @ptrCast(@alignCast(notebook)),
|
||||
};
|
||||
}
|
||||
|
||||
fn initAdw(window: *Window) Notebook {
|
||||
const app = window.app;
|
||||
assert(adwaita.enabled(&app.config));
|
||||
@ -80,6 +73,13 @@ pub const Notebook = union(enum) {
|
||||
return .{ .adw_tab_view = tab_view };
|
||||
}
|
||||
|
||||
pub fn asWidget(self: Notebook) *c.GtkWidget {
|
||||
return switch (self) {
|
||||
.adw_tab_view => |tab_view| @ptrCast(@alignCast(tab_view)),
|
||||
.gtk_notebook => |notebook| @ptrCast(@alignCast(notebook)),
|
||||
};
|
||||
}
|
||||
|
||||
pub fn nPages(self: Notebook) c_int {
|
||||
return switch (self) {
|
||||
.gtk_notebook => |notebook| c.gtk_notebook_get_n_pages(notebook),
|
||||
|
Reference in New Issue
Block a user