Skip to content

Commit c664f5b

Browse files
committed
chore: update listen & add ellipsis
1 parent edaf53f commit c664f5b

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/util.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,14 @@ export class Note extends GObject.Object {
223223
GObject.BindingFlags.SYNC_CREATE,
224224
(_, content) => {
225225
if (!content) return [false, ""];
226-
return [true, content.substring(0, 24)]
226+
227+
const title = content.split("\n")[0];
228+
return [true, title.length > 20 ? title.slice(0, 20) + "..." : title];
227229
},
228230
null
229231
);
230232

231-
this.connect("notify::title", () => {
232-
this.emit('title-changed');
233-
});
233+
234234
}
235235

236236
static generate() {
@@ -307,9 +307,6 @@ export class Note extends GObject.Object {
307307
// deno-fmt-ignore
308308
open: GObject.ParamSpec.boolean("open", "Open", "Whether the note was open when the application was closed", GObject.ParamFlags.READWRITE, false),
309309
},
310-
Signals: {
311-
'title-changed': {},
312-
},
313310
}, this);
314311
}
315312
}

src/window.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export class Window extends Adw.ApplicationWindow {
100100

101101
this.update_title();
102102

103-
this.note.connect("title-changed", () => {
103+
this.note.connect("notify::title", () => {
104104
this.update_title();
105105
});
106106

0 commit comments

Comments
 (0)