After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 639938 - Command for inserting titles.
Command for inserting titles.
Status: RESOLVED FIXED
Product: gnote
Classification: Applications
Component: main
git master
Other Linux
: Normal normal
: ---
Assigned To: gnote-maint
gnote-maint
Depends on:
Blocks:
 
 
Reported: 2011-01-19 12:12 UTC by Bill Case
Modified: 2011-07-29 20:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
replacetitle addin (1.90 KB, application/octet-stream)
2011-07-01 12:06 UTC, Pierre-Yves Luyten
  Details
Same attachment at git format (7.30 KB, patch)
2011-07-24 15:31 UTC, Pierre-Yves Luyten
needs-work Details | Review
Patch with set_note (6.67 KB, patch)
2011-07-27 15:45 UTC, Pierre-Yves Luyten
needs-work Details | Review
Replace Title with xml (6.80 KB, patch)
2011-07-29 09:43 UTC, Pierre-Yves Luyten
none Details | Review

Description Bill Case 2011-01-19 12:12:49 UTC
Give Gnote a command that can be bound to a shortcut key that allows me to
insert a short phrase of selected text, from within gnote or outside, and that replaces the
note title with that selected phrase.

Comment:  I first saw this feature in a notes program I had way back in Dos
Windows 3.1 days.  This notes program was TSR.  It is a feature I haven't seen
elsewhere since.  I found that sometimes the best note titles came from notes
that one was writing or pasting into the note keeper.  A phrase lifted from the
first or second paragraph of an article was very often more mnenomic than any
title contrived by me at the time of writtng.  I often still select a phrase
and insert it in the title -- but that is doubly annoying becasue the select
and paste with the mouse isn't working in gnote and the additional step of
deliting the old title is required.  Not terribley onerus, but still, gnote
should be quick and simple in my view.

How it works is simple.  No changes to the current title creation process need
be made.  One simply selects a phrase, pushes the short cut key combination,
the selected phrase is stored to the clip board or a varible or whatever.  The
current title for the note is removed by a script and the new selected phrase
is inserted in its place.  Probably no more than an exchange of the contents of
a variable.
Comment 1 Aurimas Černius 2011-01-19 19:50:11 UTC
Sounds interesting to me.
I think it could work like this: when a certain short cut is pressed (or a button in toolbar), the title is replaced by the text selected elsewhere (the one, that can be pasted via mouse middle click).
I think this should be implemented as addin.
Comment 2 Pierre-Yves Luyten 2011-07-01 12:06:38 UTC
Created attachment 191088 [details]
replacetitle addin

1. It's my first patch, you'll probably discover mistakes.
2. It uses Ctrl+R - standing for "replace" . And gtk stock FIND_AND_REPLACE for the button.
3. The addin cannot use the Note::set_title method , because it does not edit the content. And I could not find a cool way. So this patch uses the Gtk::TextBuffer methods.
4. I had crachs when testing with French characters like "é". One line does now convert old title to Glib::ustring to avoid these.

Apart from this, this seems to work here.
Comment 3 Pierre-Yves Luyten 2011-07-01 15:00:25 UTC
I built it using 0.7.4 , but i just tested using git (0.8.0) .

One line from replacetitlenoteaddin.cpp has to be changed, GDK_R becomes GDK_KEY_R  . Otherwise it seems ok.
Comment 4 Aurimas Černius 2011-07-13 19:58:51 UTC
Can you attach the patch, created using 'git format-patch'? Or set the proper mime-type, so that patch is viewable in bugzilla.

Is Ctrl+T not possible for this? It would stand for "title", a bit more intuitive IMO.

If you have changed anything in current Gnote code (excluding build system for your addin), I suggest to split it to a separate patch.

Thanks for contribution and keep going!
Comment 5 Hubert Figuiere (:hub) 2011-07-14 04:19:27 UTC
Comment on attachment 191088 [details]
replacetitle addin

fix mimetype
Comment 6 Pierre-Yves Luyten 2011-07-16 09:13:31 UTC
The addin does not need Gnote code to be amended, excuding build system. Sorry my internet is limited these days but I may post a better format later.

Unfortunately , Ctrl+T is currently used by Fixed Width Addin
Comment 7 Pierre-Yves Luyten 2011-07-24 15:31:08 UTC
Created attachment 192560 [details] [review]
Same attachment at git format

Hello, I played with git to attach the same thing with a better format. I hope it's the propper way.
Comment 8 Aurimas Černius 2011-07-26 19:05:01 UTC
Review of attachment 192560 [details] [review]:

Copyright year should be 2011 only.
Openning brace after `if' should be at the end of line, rather than on the new line.
Why the BUFFER() macro? I think it would be better to use pointer to NoteBuffer instead.
I'd suggest to try to replace title, like it's done when applying template (working with XML).
Comment 9 Pierre-Yves Luyten 2011-07-27 15:45:43 UTC
Created attachment 192763 [details] [review]
Patch with set_note

Thanks for your advices. I amended the copyright year, and discovered I was previously wrong, cause the set_title() method is working and checks title's uniqueness. Which I suppose to be cleaner.
Comment 10 Pierre-Yves Luyten 2011-07-28 07:11:02 UTC
Review of attachment 192763 [details] [review]:

My apologies for the noise, I posted some wrong patch that you should ignore. Sorry.
Comment 11 Aurimas Černius 2011-07-28 20:01:43 UTC
Review of attachment 192763 [details] [review]:

Few additional notes:
1. Fix copyright in header.
2. Use two spaces for indentation. I noticed one place in .cpp and one in .hpp, where tab is used.
3. I suggest to shrink title to "Replace title", leaving description as is (title() and description()).
Comment 12 Pierre-Yves Luyten 2011-07-29 09:43:59 UTC
Created attachment 192861 [details] [review]
Replace Title with xml

Hi, I fixed the copyright in header and made things simpler : get note content then replace the part of the string which is the title.
Comment 13 Aurimas Černius 2011-07-29 20:11:53 UTC
I have made some minot changes to the patch and improved it to not lose the cursor position when replacing. Nice work!
I've also filled a bug 655600 for documenting this new add-in.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.