mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
code review:
- remove unnecessary @ptrCast - set the default focus to the text entry field
This commit is contained in:

committed by
Jeffrey C. Ollie

parent
cd287b4161
commit
1ee8dfc99c
@ -7,6 +7,7 @@ const std = @import("std");
|
||||
const adw = @import("adw");
|
||||
const gtk = @import("gtk");
|
||||
const gio = @import("gio");
|
||||
const gobject = @import("gobject");
|
||||
const glib = @import("glib");
|
||||
const Allocator = std.mem.Allocator;
|
||||
const build_config = @import("../../build_config.zig");
|
||||
@ -1028,10 +1029,12 @@ pub fn promptTitle(self: *Surface) !void {
|
||||
const dialog: *adw.AlertDialog = @ptrCast(builder.getObject("prompt_title_dialog"));
|
||||
dialog.addResponse("cancel", "Cancel");
|
||||
dialog.addResponse("ok", "OK");
|
||||
dialog.setResponseAppearance("ok", adw.ResponseAppearance.suggested);
|
||||
|
||||
const entry: *gtk.Entry = @ptrCast(builder.getObject("title_entry"));
|
||||
entry.getBuffer().setText(self.getTitle() orelse "", -1);
|
||||
|
||||
dialog.choose(@ptrCast(window.window), null, @ptrCast(>kPromptTitleResponse), self);
|
||||
dialog.choose(@ptrCast(window.window), null, >kPromptTitleResponse, self);
|
||||
}
|
||||
|
||||
/// Set the current working directory of the surface.
|
||||
@ -2321,7 +2324,8 @@ fn g_value_holds(value_: ?*c.GValue, g_type: c.GType) bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
fn gtkPromptTitleResponse(dialog: *adw.AlertDialog, result: *gio.AsyncResult, ud: ?*anyopaque) callconv(.C) void {
|
||||
fn gtkPromptTitleResponse(source_object: ?*gobject.Object, result: *gio.AsyncResult, ud: ?*anyopaque) callconv(.C) void {
|
||||
const dialog: *adw.AlertDialog = @ptrCast(source_object.?);
|
||||
const self = userdataSelf(ud.?);
|
||||
|
||||
const response = dialog.chooseFinish(result);
|
||||
|
@ -2,8 +2,9 @@ using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
Adw.AlertDialog prompt_title_dialog {
|
||||
heading: "Change Terminal Title";
|
||||
body: "Leave blank to restore the default title.";
|
||||
heading: "Change Terminal Title";
|
||||
body: "Leave blank to restore the default title.";
|
||||
focus-widget: title_entry;
|
||||
|
||||
extra-child: Entry title_entry {};
|
||||
}
|
||||
extra-child: Entry title_entry {};
|
||||
}
|
||||
|
Reference in New Issue
Block a user