Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update title on note content change #143

Merged
merged 5 commits into from
Oct 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: Untitled Note for empty
anig1scur committed Oct 24, 2024
commit d3fc6f07bb87fca2d0655ca1dc74961d769bd31c
11 changes: 9 additions & 2 deletions src/window.ts
Original file line number Diff line number Diff line change
@@ -98,11 +98,18 @@ export class Window extends Adw.ApplicationWindow {
this.default_width = note.width;
this.default_height = note.height;

this.note.bind_property(
this.note.bind_property_full(
"title",
this,
"title",
GObject.BindingFlags.SYNC_CREATE
GObject.BindingFlags.SYNC_CREATE,
(_, title) => {
if (!title) {
return [true, "Untitled Note"];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like "Sticky Note" may be better here.

Also, wrap the string in a _("string") so that it may get picked up by gettext (the translation infrastructure).

Suggested change
return [true, "Untitled Note"];
return [true, _("Sticky Note")];

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done !

}
return [true, title];
},
null
);

this.connect("close-request", () => {