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,
|
.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 {
|
fn init(self: *Self, _: *Class) callconv(.c) void {
|
||||||
gtk.Widget.initTemplate(self.as(gtk.Widget));
|
gtk.Widget.initTemplate(self.as(gtk.Widget));
|
||||||
}
|
}
|
||||||
@ -68,11 +45,6 @@ pub const DebugWarning = extern struct {
|
|||||||
.name = "debug-warning",
|
.name = "debug-warning",
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Properties
|
|
||||||
gobject.ext.registerProperties(class, &.{
|
|
||||||
properties.debug.impl,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const as = C.Class.as;
|
pub const as = C.Class.as;
|
||||||
|
@ -26,6 +26,29 @@ pub const Window = extern struct {
|
|||||||
.private = .{ .Type = Private, .offset = &Private.offset },
|
.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 {
|
const Private = struct {
|
||||||
/// The surface in the view.
|
/// The surface in the view.
|
||||||
surface: *Surface = undefined,
|
surface: *Surface = undefined,
|
||||||
@ -106,6 +129,11 @@ pub const Window = extern struct {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Properties
|
||||||
|
gobject.ext.registerProperties(class, &.{
|
||||||
|
properties.debug.impl,
|
||||||
|
});
|
||||||
|
|
||||||
// Bindings
|
// Bindings
|
||||||
class.bindTemplateChildPrivate("surface", .{});
|
class.bindTemplateChildPrivate("surface", .{});
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ template $GhosttyDebugWarning: Gtk.Box {
|
|||||||
|
|
||||||
Gtk.Label {
|
Gtk.Label {
|
||||||
label: _("⚠️ You're running a debug build of Ghostty! Performance will be degraded.");
|
label: _("⚠️ You're running a debug build of Ghostty! Performance will be degraded.");
|
||||||
visible: bind template.debug;
|
|
||||||
margin-top: 10;
|
margin-top: 10;
|
||||||
margin-bottom: 10;
|
margin-bottom: 10;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,6 @@ using Adw 1;
|
|||||||
template $GhosttyDebugWarning: Adw.Bin {
|
template $GhosttyDebugWarning: Adw.Bin {
|
||||||
Adw.Banner {
|
Adw.Banner {
|
||||||
title: _("⚠️ You're running a debug build of Ghostty! Performance will be degraded.");
|
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;
|
orientation: vertical;
|
||||||
spacing: 0;
|
spacing: 0;
|
||||||
|
|
||||||
$GhosttyDebugWarning {}
|
$GhosttyDebugWarning {
|
||||||
|
visible: bind template.debug;
|
||||||
|
}
|
||||||
|
|
||||||
$GhosttySurface surface {
|
$GhosttySurface surface {
|
||||||
close-request => $surface_close_request();
|
close-request => $surface_close_request();
|
||||||
|
Reference in New Issue
Block a user