apprt/gtk: remove Window.hasAdwToolbar

this is the same as isAdwWindow
This commit is contained in:
Paul Berg
2024-09-24 11:08:55 +02:00
committed by Mitchell Hashimoto
parent fe4f4fdc72
commit 6ef87d298c

View File

@ -258,7 +258,7 @@ pub fn init(self: *Window, app: *App) !void {
// Our actions for the menu // Our actions for the menu
initActions(self); initActions(self);
if (self.hasAdwToolbar()) { if (self.isAdwWindow()) {
if (comptime !adwaita.versionAtLeast(1, 4, 0)) unreachable; if (comptime !adwaita.versionAtLeast(1, 4, 0)) unreachable;
const toolbar_view: *c.AdwToolbarView = @ptrCast(c.adw_toolbar_view_new()); const toolbar_view: *c.AdwToolbarView = @ptrCast(c.adw_toolbar_view_new());
@ -394,18 +394,9 @@ pub fn deinit(self: *Window) void {
/// paths that are not enabled. /// paths that are not enabled.
inline fn isAdwWindow(self: *Window) bool { inline fn isAdwWindow(self: *Window) bool {
return (comptime adwaita.versionAtLeast(1, 4, 0)) and return (comptime adwaita.versionAtLeast(1, 4, 0)) and
adwaita.enabled(&self.app.config) and
self.app.config.@"gtk-titlebar" and
adwaita.versionAtLeast(1, 4, 0);
}
/// This must be `inline` so that the comptime check noops conditional
/// paths that are not enabled.
inline fn hasAdwToolbar(self: *Window) bool {
return ((comptime adwaita.versionAtLeast(1, 4, 0)) and
adwaita.enabled(&self.app.config) and adwaita.enabled(&self.app.config) and
adwaita.versionAtLeast(1, 4, 0) and adwaita.versionAtLeast(1, 4, 0) and
self.app.config.@"gtk-titlebar"); self.app.config.@"gtk-titlebar";
} }
/// Add a new tab to this window. /// Add a new tab to this window.