Skip to content

Commit 0abe6f2

Browse files
committed
port: Font Dialog
1 parent 598d6ac commit 0abe6f2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Font Dialog/main.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import Gio from "gi://Gio";
22
import Gtk from "gi://Gtk?version=4.0";
3+
import Pango from "gi://Pango";
34

45
Gio._promisify(
56
Gtk.FontDialog.prototype,
67
"choose_family",
78
"choose_family_finish",
89
);
910

10-
const font_dialog_button = workbench.builder.get_object("font_dialog_button");
11+
const font_dialog_button = workbench.builder.get_object<Gtk.FontDialogButton>("font_dialog_button");
1112
const custom_button = workbench.builder.get_object("custom_button");
1213

1314
const dialog_standard = new Gtk.FontDialog({
@@ -29,10 +30,11 @@ const dialog_custom = new Gtk.FontDialog({
2930
custom_button.connect("clicked", () => onClicked().catch(console.error));
3031

3132
async function onClicked() {
33+
// @ts-expect-error undetected async function
3234
const family = await dialog_custom.choose_family(
3335
workbench.window,
3436
null,
3537
null,
36-
);
38+
) as Pango.FontFamily;
3739
console.log(`Font Family: ${family.get_name()}`);
3840
}

0 commit comments

Comments
 (0)