-
Notifications
You must be signed in to change notification settings - Fork 31
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better approach would be to add another property named title
to the Note
(it's in util.ts).
Then you can easily bind the note's title to the note's content, by doing something similar to this in the constructor of the Note:
this.bind_property_full("title", this, "content", flags, (_, content) => {
// return the first n-chars of the content, or the first line
}, null);
Then you can create yet another binding from the note's title to the note window's title
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!!
src/window.ts
Outdated
GObject.BindingFlags.SYNC_CREATE, | ||
(_, title) => { | ||
if (!title) { | ||
return [true, "Untitled Note"]; |
There was a problem hiding this comment.
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).
return [true, "Untitled Note"]; | |
return [true, _("Sticky Note")]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done !
Thank you! I still need to test this locally, but looks good |
So that you could get one note from dock by title directly