gtk: clean up title renaming and fix a small leak

This commit is contained in:
Jeffrey C. Ollie
2026-02-24 10:28:33 -06:00
parent d0e308f32b
commit 57d570525b
5 changed files with 17 additions and 7 deletions

View File

@@ -330,6 +330,10 @@ pub const Tab = extern struct {
glib.free(@ptrCast(@constCast(v)));
priv.title = null;
}
if (priv.title_override) |v| {
glib.free(@ptrCast(@constCast(v)));
priv.title_override = null;
}
gobject.Object.virtual_methods.finalize.call(
Class.parent,

View File

@@ -339,6 +339,7 @@ pub const Window = extern struct {
.init("close-tab", actionCloseTab, s_variant_type),
.init("new-tab", actionNewTab, null),
.init("new-window", actionNewWindow, null),
.init("prompt-surface-title", actionPromptSurfaceTitle, null),
.init("prompt-tab-title", actionPromptTabTitle, null),
.init("prompt-context-tab-title", actionPromptContextTabTitle, null),
.init("ring-bell", actionRingBell, null),
@@ -1803,6 +1804,14 @@ pub const Window = extern struct {
tab.promptTabTitle();
}
fn actionPromptSurfaceTitle(
_: *gio.SimpleAction,
_: ?*glib.Variant,
self: *Window,
) callconv(.c) void {
self.performBindingAction(.prompt_surface_title);
}
fn actionPromptTabTitle(
_: *gio.SimpleAction,
_: ?*glib.Variant,

View File

@@ -243,7 +243,7 @@ menu main_menu {
item {
label: _("Change Title…");
action: "win.prompt-title";
action: "win.prompt-surface-title";
}
item {