apprt/gtk-ng: tab tooltips match our pwd

pull/8218/head
Mitchell Hashimoto 2025-08-12 15:02:07 -07:00
parent aa4cbf444b
commit 502040c86a
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
3 changed files with 26 additions and 0 deletions

View File

@ -88,6 +88,19 @@ pub const Tab = extern struct {
);
};
pub const tooltip = struct {
pub const name = "tooltip";
const impl = gobject.ext.defineProperty(
name,
Self,
?[:0]const u8,
.{
.default = null,
.accessor = C.privateStringFieldAccessor("tooltip"),
},
);
};
pub const title = struct {
pub const name = "title";
pub const get = impl.get;
@ -125,6 +138,7 @@ pub const Tab = extern struct {
/// The title to show for this tab. This is usually set to a binding
/// with the active surface but can be manually set to anything.
title: ?[:0]const u8 = null,
tooltip: ?[:0]const u8 = null,
/// The binding groups for the current active surface.
surface_bindings: *gobject.BindingGroup,
@ -228,6 +242,10 @@ pub const Tab = extern struct {
fn finalize(self: *Self) callconv(.c) void {
const priv = self.private();
if (priv.tooltip) |v| {
glib.free(@constCast(@ptrCast(v)));
priv.tooltip = null;
}
if (priv.title) |v| {
glib.free(@constCast(@ptrCast(v)));
priv.title = null;
@ -305,6 +323,7 @@ pub const Tab = extern struct {
properties.config.impl,
properties.@"surface-tree".impl,
properties.title.impl,
properties.tooltip.impl,
});
// Bindings

View File

@ -416,6 +416,12 @@ pub const Window = extern struct {
"title",
.{ .sync_create = true },
);
_ = tab.as(gobject.Object).bindProperty(
"tooltip",
page.as(gobject.Object),
"tooltip",
.{ .sync_create = true },
);
// Bind signals
const split_tree = tab.getSplitTree();

View File

@ -8,6 +8,7 @@ template $GhosttyTab: Box {
orientation: vertical;
hexpand: true;
vexpand: true;
tooltip: bind split_tree.active-surface as <$GhosttySurface>.pwd as <string>;
$GhosttySplitTree split_tree {
notify::active-surface => $notify_active_surface();