mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
gtk-ng: move debug property to window
This commit is contained in:
@ -21,29 +21,6 @@ pub const DebugWarning = extern struct {
|
||||
.parent_class = &Class.parent,
|
||||
});
|
||||
|
||||
pub const properties = struct {
|
||||
pub const debug = struct {
|
||||
pub const name = "debug";
|
||||
const impl = gobject.ext.defineProperty(
|
||||
name,
|
||||
Self,
|
||||
bool,
|
||||
.{
|
||||
.nick = "Debug",
|
||||
.blurb = "True if runtime safety checks are enabled.",
|
||||
.default = build_config.is_debug,
|
||||
.accessor = gobject.ext.typedAccessor(Self, bool, .{
|
||||
.getter = struct {
|
||||
pub fn getter(_: *DebugWarning) bool {
|
||||
return build_config.is_debug;
|
||||
}
|
||||
}.getter,
|
||||
}),
|
||||
},
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
fn init(self: *Self, _: *Class) callconv(.c) void {
|
||||
gtk.Widget.initTemplate(self.as(gtk.Widget));
|
||||
}
|
||||
@ -68,11 +45,6 @@ pub const DebugWarning = extern struct {
|
||||
.name = "debug-warning",
|
||||
}),
|
||||
);
|
||||
|
||||
// Properties
|
||||
gobject.ext.registerProperties(class, &.{
|
||||
properties.debug.impl,
|
||||
});
|
||||
}
|
||||
|
||||
pub const as = C.Class.as;
|
||||
|
@ -26,6 +26,29 @@ pub const Window = extern struct {
|
||||
.private = .{ .Type = Private, .offset = &Private.offset },
|
||||
});
|
||||
|
||||
pub const properties = struct {
|
||||
pub const debug = struct {
|
||||
pub const name = "debug";
|
||||
const impl = gobject.ext.defineProperty(
|
||||
name,
|
||||
Self,
|
||||
bool,
|
||||
.{
|
||||
.nick = "Debug",
|
||||
.blurb = "True if runtime safety checks are enabled.",
|
||||
.default = build_config.is_debug,
|
||||
.accessor = gobject.ext.typedAccessor(Self, bool, .{
|
||||
.getter = struct {
|
||||
pub fn getter(_: *Window) bool {
|
||||
return build_config.is_debug;
|
||||
}
|
||||
}.getter,
|
||||
}),
|
||||
},
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
const Private = struct {
|
||||
/// The surface in the view.
|
||||
surface: *Surface = undefined,
|
||||
@ -106,6 +129,11 @@ pub const Window = extern struct {
|
||||
}),
|
||||
);
|
||||
|
||||
// Properties
|
||||
gobject.ext.registerProperties(class, &.{
|
||||
properties.debug.impl,
|
||||
});
|
||||
|
||||
// Bindings
|
||||
class.bindTemplateChildPrivate("surface", .{});
|
||||
|
||||
|
@ -5,7 +5,6 @@ template $GhosttyDebugWarning: Gtk.Box {
|
||||
|
||||
Gtk.Label {
|
||||
label: _("⚠️ You're running a debug build of Ghostty! Performance will be degraded.");
|
||||
visible: bind template.debug;
|
||||
margin-top: 10;
|
||||
margin-bottom: 10;
|
||||
}
|
||||
|
@ -4,6 +4,6 @@ using Adw 1;
|
||||
template $GhosttyDebugWarning: Adw.Bin {
|
||||
Adw.Banner {
|
||||
title: _("⚠️ You're running a debug build of Ghostty! Performance will be degraded.");
|
||||
revealed: bind template.debug;
|
||||
revealed: true;
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,9 @@ template $GhosttyWindow: Adw.ApplicationWindow {
|
||||
orientation: vertical;
|
||||
spacing: 0;
|
||||
|
||||
$GhosttyDebugWarning {}
|
||||
$GhosttyDebugWarning {
|
||||
visible: bind template.debug;
|
||||
}
|
||||
|
||||
$GhosttySurface surface {
|
||||
close-request => $surface_close_request();
|
||||
|
Reference in New Issue
Block a user