mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
apprt/gtk-ng: toolbar style config
This commit is contained in:
@ -170,7 +170,7 @@ pub const Window = extern struct {
|
|||||||
Self,
|
Self,
|
||||||
bool,
|
bool,
|
||||||
.{
|
.{
|
||||||
.nick = "Tab Bar Visiblity",
|
.nick = "Tab Bar Visibility",
|
||||||
.blurb = "If true, tab bar should be visible.",
|
.blurb = "If true, tab bar should be visible.",
|
||||||
.default = true,
|
.default = true,
|
||||||
.accessor = gobject.ext.typedAccessor(Self, bool, .{
|
.accessor = gobject.ext.typedAccessor(Self, bool, .{
|
||||||
@ -179,6 +179,27 @@ pub const Window = extern struct {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub const @"toolbar-style" = struct {
|
||||||
|
pub const name = "toolbar-style";
|
||||||
|
const impl = gobject.ext.defineProperty(
|
||||||
|
name,
|
||||||
|
Self,
|
||||||
|
adw.ToolbarStyle,
|
||||||
|
.{
|
||||||
|
.nick = "Toolbar Style",
|
||||||
|
.blurb = "The style for the toolbar top/bottom bars.",
|
||||||
|
.default = .raised,
|
||||||
|
.accessor = gobject.ext.typedAccessor(
|
||||||
|
Self,
|
||||||
|
adw.ToolbarStyle,
|
||||||
|
.{
|
||||||
|
.getter = Self.getToolbarStyle,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const Private = struct {
|
const Private = struct {
|
||||||
@ -284,6 +305,7 @@ pub const Window = extern struct {
|
|||||||
"tabs-autohide",
|
"tabs-autohide",
|
||||||
"tabs-visible",
|
"tabs-visible",
|
||||||
"tabs-wide",
|
"tabs-wide",
|
||||||
|
"toolbar-style",
|
||||||
}) |key| {
|
}) |key| {
|
||||||
self.as(gobject.Object).notifyByPspec(
|
self.as(gobject.Object).notifyByPspec(
|
||||||
@field(properties, key).impl.param_spec,
|
@field(properties, key).impl.param_spec,
|
||||||
@ -404,6 +426,16 @@ pub const Window = extern struct {
|
|||||||
return config.@"gtk-wide-tabs";
|
return config.@"gtk-wide-tabs";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn getToolbarStyle(self: *Self) adw.ToolbarStyle {
|
||||||
|
const priv = self.private();
|
||||||
|
const config = if (priv.config) |v| v.get() else return .raised;
|
||||||
|
return switch (config.@"gtk-toolbar-style") {
|
||||||
|
.flat => .flat,
|
||||||
|
.raised => .raised,
|
||||||
|
.@"raised-border" => .raised_border,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
fn propConfig(
|
fn propConfig(
|
||||||
_: *adw.ApplicationWindow,
|
_: *adw.ApplicationWindow,
|
||||||
_: *gobject.ParamSpec,
|
_: *gobject.ParamSpec,
|
||||||
@ -721,6 +753,7 @@ pub const Window = extern struct {
|
|||||||
properties.@"tabs-autohide".impl,
|
properties.@"tabs-autohide".impl,
|
||||||
properties.@"tabs-visible".impl,
|
properties.@"tabs-visible".impl,
|
||||||
properties.@"tabs-wide".impl,
|
properties.@"tabs-wide".impl,
|
||||||
|
properties.@"toolbar-style".impl,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Bindings
|
// Bindings
|
||||||
|
@ -24,8 +24,8 @@ template $GhosttyWindow: Adw.ApplicationWindow {
|
|||||||
view: tab_view;
|
view: tab_view;
|
||||||
|
|
||||||
Adw.ToolbarView toolbar {
|
Adw.ToolbarView toolbar {
|
||||||
top-bar-style: raised;
|
top-bar-style: bind template.toolbar-style;
|
||||||
bottom-bar-style: raised;
|
bottom-bar-style: bind template.toolbar-style;
|
||||||
|
|
||||||
[top]
|
[top]
|
||||||
Adw.HeaderBar {
|
Adw.HeaderBar {
|
||||||
|
Reference in New Issue
Block a user