mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-20 02:36:22 +03:00
apprt/gtk-ng: hook up adw < 1.5 support
This commit is contained in:
@ -30,6 +30,7 @@ pub const icon_sizes: []const comptime_int = &.{ 16, 32, 128, 256, 512, 1024 };
|
|||||||
///
|
///
|
||||||
/// These will be asserted to exist at runtime.
|
/// These will be asserted to exist at runtime.
|
||||||
pub const blueprints: []const Blueprint = &.{
|
pub const blueprints: []const Blueprint = &.{
|
||||||
|
.{ .major = 1, .minor = 2, .name = "config-errors-dialog" },
|
||||||
.{ .major = 1, .minor = 5, .name = "config-errors-dialog" },
|
.{ .major = 1, .minor = 5, .name = "config-errors-dialog" },
|
||||||
.{ .major = 1, .minor = 5, .name = "window" },
|
.{ .major = 1, .minor = 5, .name = "window" },
|
||||||
};
|
};
|
||||||
|
@ -74,14 +74,16 @@ pub const ConfigErrorsDialog = extern struct {
|
|||||||
pub fn present(self: *Self, parent: ?*gtk.Widget) void {
|
pub fn present(self: *Self, parent: ?*gtk.Widget) void {
|
||||||
switch (Parent) {
|
switch (Parent) {
|
||||||
adw.AlertDialog => self.as(adw.Dialog).present(parent),
|
adw.AlertDialog => self.as(adw.Dialog).present(parent),
|
||||||
else => unreachable,
|
adw.MessageDialog => self.as(gtk.Window).present(),
|
||||||
|
else => comptime unreachable,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn close(self: *Self) void {
|
pub fn close(self: *Self) void {
|
||||||
switch (Parent) {
|
switch (Parent) {
|
||||||
adw.AlertDialog => self.as(adw.Dialog).forceClose(),
|
adw.AlertDialog => self.as(adw.Dialog).forceClose(),
|
||||||
else => unreachable,
|
adw.MessageDialog => self.as(gtk.Window).close(),
|
||||||
|
else => comptime unreachable,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +162,13 @@ pub const ConfigErrorsDialog = extern struct {
|
|||||||
.name = "config-errors-dialog",
|
.name = "config-errors-dialog",
|
||||||
}),
|
}),
|
||||||
|
|
||||||
else => unreachable,
|
adw.MessageDialog => comptime gresource.blueprint(.{
|
||||||
|
.major = 1,
|
||||||
|
.minor = 2,
|
||||||
|
.name = "config-errors-dialog",
|
||||||
|
}),
|
||||||
|
|
||||||
|
else => comptime unreachable,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
27
src/apprt/gtk-ng/ui/1.2/config-errors-dialog.blp
Normal file
27
src/apprt/gtk-ng/ui/1.2/config-errors-dialog.blp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using Gtk 4.0;
|
||||||
|
using Adw 1;
|
||||||
|
|
||||||
|
template $GhosttyConfigErrorsDialog: Adw.MessageDialog {
|
||||||
|
heading: _("Configuration Errors");
|
||||||
|
body: _("One or more configuration errors were found. Please review the errors below, and either reload your configuration or ignore these errors.");
|
||||||
|
|
||||||
|
responses [
|
||||||
|
ignore: _("Ignore"),
|
||||||
|
reload: _("Reload Configuration") suggested,
|
||||||
|
]
|
||||||
|
|
||||||
|
extra-child: ScrolledWindow {
|
||||||
|
min-content-width: 500;
|
||||||
|
min-content-height: 100;
|
||||||
|
|
||||||
|
TextView {
|
||||||
|
editable: false;
|
||||||
|
cursor-visible: false;
|
||||||
|
top-margin: 8;
|
||||||
|
bottom-margin: 8;
|
||||||
|
left-margin: 8;
|
||||||
|
right-margin: 8;
|
||||||
|
buffer: bind (template.config as <$GhosttyConfig>).diagnostics-buffer;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user