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

Conversation

anig1scur
Copy link
Contributor

So that you could get one note from dock by title directly

image

Copy link
Owner

@vixalien vixalien left a 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

meson.build Outdated Show resolved Hide resolved
Copy link
Owner

@vixalien vixalien left a comment

Choose a reason for hiding this comment

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

Thank you!!

src/util.ts Outdated Show resolved Hide resolved
src/util.ts Outdated Show resolved Hide resolved
src/window.ts Outdated Show resolved Hide resolved
src/util.ts Outdated Show resolved Hide resolved
src/window.ts Outdated Show resolved Hide resolved
src/window.ts Outdated
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 !

@vixalien
Copy link
Owner

Thank you!

I still need to test this locally, but looks good

@vixalien vixalien merged commit 6c40104 into vixalien:main Oct 30, 2024
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants