From 22b2344f50d6a5a1b66fc52ee012f73a140b841d Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Sat, 19 Jul 2025 09:58:37 -0500 Subject: [PATCH] gtk: update zig-gobject to get improved gobject accessors --- build.zig.zon | 4 ++-- build.zig.zon.json | 6 +++--- build.zig.zon.nix | 6 +++--- build.zig.zon.txt | 2 +- flatpak/zig-packages.json | 6 +++--- src/apprt/gtk-ng/class/application.zig | 11 ++++++---- src/apprt/gtk-ng/class/config.zig | 21 ++++++++++++------- .../gtk-ng/class/config_errors_dialog.zig | 13 +++++++----- src/apprt/gtk-ng/class/surface.zig | 1 - src/apprt/gtk/CommandPalette.zig | 8 ++++++- 10 files changed, 48 insertions(+), 30 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index a014195e9..188af450a 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -55,8 +55,8 @@ .gobject = .{ // https://github.com/jcollie/ghostty-gobject based on zig_gobject // Temporary until we generate them at build time automatically. - .url = "https://github.com/jcollie/ghostty-gobject/releases/download/0.14.0-2025-03-18-21-1/ghostty-gobject-0.14.0-2025-03-18-21-1.tar.zst", - .hash = "gobject-0.2.0-Skun7IWDlQAOKu4BV7LapIxL9Imbq1JRmzvcIkazvAxR", + .url = "https://github.com/jcollie/ghostty-gobject/releases/download/0.14.1-2025-07-19-27-1/ghostty-gobject-0.14.1-2025-07-19-27-1.tar.zst", + .hash = "gobject-0.3.0-Skun7KzYnAAsvbz0JzKA4LBdXbLqj0eNXHoKAIE0HkOl", .lazy = true, }, diff --git a/build.zig.zon.json b/build.zig.zon.json index 5d5fb07b4..863dcadf8 100644 --- a/build.zig.zon.json +++ b/build.zig.zon.json @@ -24,10 +24,10 @@ "url": "https://deps.files.ghostty.org/glslang-12201278a1a05c0ce0b6eb6026c65cd3e9247aa041b1c260324bf29cee559dd23ba1.tar.gz", "hash": "sha256-FKLtu1Ccs+UamlPj9eQ12/WXFgS0uDPmPmB26MCpl7U=" }, - "gobject-0.2.0-Skun7IWDlQAOKu4BV7LapIxL9Imbq1JRmzvcIkazvAxR": { + "gobject-0.3.0-Skun7KzYnAAsvbz0JzKA4LBdXbLqj0eNXHoKAIE0HkOl": { "name": "gobject", - "url": "https://github.com/jcollie/ghostty-gobject/releases/download/0.14.0-2025-03-18-21-1/ghostty-gobject-0.14.0-2025-03-18-21-1.tar.zst", - "hash": "sha256-hWcpl0Wd3XydT+RY7+VIoxXPhCzele1Ip76YSh+KmLI=" + "url": "https://github.com/jcollie/ghostty-gobject/releases/download/0.14.1-2025-07-19-27-1/ghostty-gobject-0.14.1-2025-07-19-27-1.tar.zst", + "hash": "sha256-c4szPFC+L2H8ZQ3g7aoVi+lPmF4I6STxN9+fBhxaap8=" }, "N-V-__8AALiNBAA-_0gprYr92CjrMj1I5bqNu0TSJOnjFNSr": { "name": "gtk4_layer_shell", diff --git a/build.zig.zon.nix b/build.zig.zon.nix index f70e43b70..c2114adfc 100644 --- a/build.zig.zon.nix +++ b/build.zig.zon.nix @@ -122,11 +122,11 @@ in }; } { - name = "gobject-0.2.0-Skun7IWDlQAOKu4BV7LapIxL9Imbq1JRmzvcIkazvAxR"; + name = "gobject-0.3.0-Skun7KzYnAAsvbz0JzKA4LBdXbLqj0eNXHoKAIE0HkOl"; path = fetchZigArtifact { name = "gobject"; - url = "https://github.com/jcollie/ghostty-gobject/releases/download/0.14.0-2025-03-18-21-1/ghostty-gobject-0.14.0-2025-03-18-21-1.tar.zst"; - hash = "sha256-hWcpl0Wd3XydT+RY7+VIoxXPhCzele1Ip76YSh+KmLI="; + url = "https://github.com/jcollie/ghostty-gobject/releases/download/0.14.1-2025-07-19-27-1/ghostty-gobject-0.14.1-2025-07-19-27-1.tar.zst"; + hash = "sha256-c4szPFC+L2H8ZQ3g7aoVi+lPmF4I6STxN9+fBhxaap8="; }; } { diff --git a/build.zig.zon.txt b/build.zig.zon.txt index e6580a088..8082390b1 100644 --- a/build.zig.zon.txt +++ b/build.zig.zon.txt @@ -27,7 +27,7 @@ https://deps.files.ghostty.org/wuffs-122037b39d577ec2db3fd7b2130e7b69ef6cc1807d6 https://deps.files.ghostty.org/zig_js-12205a66d423259567764fa0fc60c82be35365c21aeb76c5a7dc99698401f4f6fefc.tar.gz https://deps.files.ghostty.org/ziglyph-b89d43d1e3fb01b6074bc1f7fc980324b04d26a5.tar.gz https://deps.files.ghostty.org/zlib-1220fed0c74e1019b3ee29edae2051788b080cd96e90d56836eea857b0b966742efb.tar.gz -https://github.com/jcollie/ghostty-gobject/releases/download/0.14.0-2025-03-18-21-1/ghostty-gobject-0.14.0-2025-03-18-21-1.tar.zst +https://github.com/jcollie/ghostty-gobject/releases/download/0.14.1-2025-07-19-27-1/ghostty-gobject-0.14.1-2025-07-19-27-1.tar.zst https://github.com/mbadolato/iTerm2-Color-Schemes/archive/92f20650771384b82f981fb0f249e5fbdcb69e9f.tar.gz https://github.com/mitchellh/libxev/archive/7f803181b158a10fec8619f793e3b4df515566cb.tar.gz https://github.com/mitchellh/zig-objc/archive/c9e917a4e15a983b672ca779c7985d738a2d517c.tar.gz diff --git a/flatpak/zig-packages.json b/flatpak/zig-packages.json index 515a7f0fd..9e64be3a1 100644 --- a/flatpak/zig-packages.json +++ b/flatpak/zig-packages.json @@ -31,9 +31,9 @@ }, { "type": "archive", - "url": "https://github.com/jcollie/ghostty-gobject/releases/download/0.14.0-2025-03-18-21-1/ghostty-gobject-0.14.0-2025-03-18-21-1.tar.zst", - "dest": "vendor/p/gobject-0.2.0-Skun7IWDlQAOKu4BV7LapIxL9Imbq1JRmzvcIkazvAxR", - "sha256": "85672997459ddd7c9d4fe458efe548a315cf842cde95ed48a7be984a1f8a98b2" + "url": "https://github.com/jcollie/ghostty-gobject/releases/download/0.14.1-2025-07-19-27-1/ghostty-gobject-0.14.1-2025-07-19-27-1.tar.zst", + "dest": "vendor/p/gobject-0.3.0-Skun7KzYnAAsvbz0JzKA4LBdXbLqj0eNXHoKAIE0HkOl", + "sha256": "738b333c50be2f61fc650de0edaa158be94f985e08e924f137df9f061c5a6a9f" }, { "type": "archive", diff --git a/src/apprt/gtk-ng/class/application.zig b/src/apprt/gtk-ng/class/application.zig index 21557d6e8..130aebb1f 100644 --- a/src/apprt/gtk-ng/class/application.zig +++ b/src/apprt/gtk-ng/class/application.zig @@ -71,10 +71,13 @@ pub const Application = extern struct { .{ .nick = "Config", .blurb = "The current active configuration for the application.", - .default = null, - .accessor = .{ - .getter = Self.getPropConfig, - }, + .accessor = gobject.ext.typedAccessor( + Self, + ?*Config, + .{ + .getter = Self.getPropConfig, + }, + ), }, ); }; diff --git a/src/apprt/gtk-ng/class/config.zig b/src/apprt/gtk-ng/class/config.zig index 363a2e72e..d9beb318f 100644 --- a/src/apprt/gtk-ng/class/config.zig +++ b/src/apprt/gtk-ng/class/config.zig @@ -42,10 +42,13 @@ pub const Config = extern struct { .{ .nick = "Diagnostics Buffer", .blurb = "A TextBuffer that contains the diagnostics.", - .default = null, - .accessor = .{ - .getter = Self.diagnosticsBuffer, - }, + .accessor = gobject.ext.typedAccessor( + Self, + ?*gtk.TextBuffer, + .{ + .getter = Self.diagnosticsBuffer, + }, + ), }, ); @@ -57,9 +60,13 @@ pub const Config = extern struct { .nick = "has-diagnostics", .blurb = "Whether the configuration has diagnostics.", .default = false, - .accessor = .{ - .getter = Self.hasDiagnostics, - }, + .accessor = gobject.ext.typedAccessor( + Self, + bool, + .{ + .getter = Self.hasDiagnostics, + }, + ), }, ); }; diff --git a/src/apprt/gtk-ng/class/config_errors_dialog.zig b/src/apprt/gtk-ng/class/config_errors_dialog.zig index 765f4050f..fad27db9d 100644 --- a/src/apprt/gtk-ng/class/config_errors_dialog.zig +++ b/src/apprt/gtk-ng/class/config_errors_dialog.zig @@ -35,11 +35,14 @@ pub const ConfigErrorsDialog = extern struct { .{ .nick = "config", .blurb = "The configuration that this dialog is showing errors for.", - .default = null, - .accessor = .{ - .getter = Self.getConfig, - .setter = Self.setConfig, - }, + .accessor = gobject.ext.typedAccessor( + Self, + ?*Config, + .{ + .getter = Self.getConfig, + .setter = Self.setConfig, + }, + ), }, ); }; diff --git a/src/apprt/gtk-ng/class/surface.zig b/src/apprt/gtk-ng/class/surface.zig index f37e0b583..447bd59f4 100644 --- a/src/apprt/gtk-ng/class/surface.zig +++ b/src/apprt/gtk-ng/class/surface.zig @@ -43,7 +43,6 @@ pub const Surface = extern struct { .{ .nick = "Config", .blurb = "The configuration that this surface is using.", - .default = null, .accessor = gobject.ext.privateFieldAccessor( Self, Private, diff --git a/src/apprt/gtk/CommandPalette.zig b/src/apprt/gtk/CommandPalette.zig index d05f195b3..076459dbd 100644 --- a/src/apprt/gtk/CommandPalette.zig +++ b/src/apprt/gtk/CommandPalette.zig @@ -238,7 +238,13 @@ const Command = extern struct { ?[:0]const u8, .{ .default = null, - .accessor = .{ .getter = &accessor.getter }, + .accessor = gobject.ext.typedAccessor( + Command, + ?[:0]const u8, + .{ + .getter = &accessor.getter, + }, + ), }, ); }