mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
apprt/gtk: about window
This commit is contained in:
@ -206,7 +206,11 @@ pub fn build(b: *std.Build) !void {
|
||||
|
||||
const exe_options = b.addOptions();
|
||||
exe_options.addOption(std.SemanticVersion, "app_version", version);
|
||||
exe_options.addOption([]const u8, "app_version_string", b.fmt("{}", .{version}));
|
||||
exe_options.addOption([:0]const u8, "app_version_string", try std.fmt.allocPrintZ(
|
||||
b.allocator,
|
||||
"{}",
|
||||
.{version},
|
||||
));
|
||||
exe_options.addOption(bool, "tracy_enabled", tracy);
|
||||
exe_options.addOption(bool, "flatpak", flatpak);
|
||||
exe_options.addOption(apprt.Runtime, "app_runtime", app_runtime);
|
||||
|
@ -448,7 +448,13 @@ fn initMenu(self: *App) void {
|
||||
defer c.g_object_unref(section);
|
||||
c.g_menu_append_section(menu, null, @ptrCast(@alignCast(section)));
|
||||
c.g_menu_append(section, "Close Window", "win.close");
|
||||
c.g_menu_append(section, "Quit Ghostty", "app.quit");
|
||||
}
|
||||
|
||||
{
|
||||
const section = c.g_menu_new();
|
||||
defer c.g_object_unref(section);
|
||||
c.g_menu_append_section(menu, null, @ptrCast(@alignCast(section)));
|
||||
c.g_menu_append(section, "About Ghostty", "win.about");
|
||||
}
|
||||
|
||||
// {
|
||||
|
@ -3,6 +3,7 @@ const Window = @This();
|
||||
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const build_config = @import("../../build_config.zig");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const assert = std.debug.assert;
|
||||
const configpkg = @import("../../config.zig");
|
||||
@ -162,6 +163,7 @@ pub fn init(self: *Window, app: *App) !void {
|
||||
/// here. The string name binds them.
|
||||
fn initActions(self: *Window) void {
|
||||
const actions = .{
|
||||
.{ "about", >kActionAbout },
|
||||
.{ "close", >kActionClose },
|
||||
.{ "new_window", >kActionNewWindow },
|
||||
.{ "new_tab", >kActionNewTab },
|
||||
@ -486,6 +488,29 @@ fn getNotebookPageIndex(page: *c.GtkNotebookPage) c_int {
|
||||
return c.g_value_get_int(&value);
|
||||
}
|
||||
|
||||
fn gtkActionAbout(
|
||||
_: *c.GSimpleAction,
|
||||
_: *c.GVariant,
|
||||
ud: ?*anyopaque,
|
||||
) callconv(.C) void {
|
||||
const self: *Window = @ptrCast(@alignCast(ud orelse return));
|
||||
|
||||
c.gtk_show_about_dialog(
|
||||
self.window,
|
||||
"program-name",
|
||||
"Ghostty",
|
||||
"logo-icon-name",
|
||||
"com.mitchellh.ghostty",
|
||||
"title",
|
||||
"About Ghostty",
|
||||
"version",
|
||||
build_config.version_string.ptr,
|
||||
"website",
|
||||
"https://github.com/mitchellh/ghostty",
|
||||
@as(?*anyopaque, null),
|
||||
);
|
||||
}
|
||||
|
||||
fn gtkActionClose(
|
||||
_: *c.GSimpleAction,
|
||||
_: *c.GVariant,
|
||||
|
Reference in New Issue
Block a user