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 601506 - A new note created via notebook's list doesn't use the custom note template
A new note created via notebook's list doesn't use the custom note template
Status: RESOLVED NOTGNOME
Product: tomboy
Classification: Applications
Component: General
1.0.x
Other All
: Normal enhancement
: 1.4.0
Assigned To: Aaron D Borden
Tomboy Maintainers
gnome[moved-to-github]
Depends on:
Blocks:
 
 
Reported: 2009-11-11 10:35 UTC by johannes.fritz
Modified: 2017-07-31 12:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A new note created via notebook's list doesn't use the custom note template. (4.58 KB, image/png)
2009-11-11 10:35 UTC, johannes.fritz
  Details
Use default note template content for notebook templates (1.81 KB, patch)
2010-01-07 05:37 UTC, Greg Poirier
needs-work Details | Review
New patch to fetch default note template content. (1.53 KB, patch)
2010-01-12 15:02 UTC, Greg Poirier
none Details | Review
Address the issue in NoteManager (4.26 KB, patch)
2010-01-13 04:50 UTC, Greg Poirier
none Details | Review

Description johannes.fritz 2009-11-11 10:35:14 UTC
Created attachment 147458 [details]
A new note created via notebook's list doesn't use the custom note template.

OS: WinXP SP3
Gtk#: 2.12.9-2
Tomboy: 1.0.0, all standard add-ins activated

Usecase:
Creating a new note with custom template

Problem:
If creating a new note with right-click on a notebook (see screenshot), the
custom defined template is going to be always ignored.
Comment 1 Sandy Armstrong 2009-11-11 14:03:55 UTC
Notebooks have their own templates (see the Open Template Note) option.

Are you suggesting that if a notebook does not have a template set, that it should use the main template?  That could make sense.
Comment 2 johannes.fritz 2009-11-11 14:11:32 UTC
> Are you suggesting that if a notebook does not have a template set, that it
> should use the main template?  That could make sense.

That's what I meant: There's currently no fallback option. For 90% of my notebooks I am using my standard template (some kind of todo, fixme, etc.)

Sorry for my rough description.
Comment 3 Greg Poirier 2010-01-07 05:14:23 UTC
Right now, we're creating a new template note for the notebook.  We could make it use the content of the main template--keeping a separate template for each notebook.

This is a little annoying if you only want to update it in one place, but it allows you to give a notebook its own template down the line.  I think I'm going to keep this behavior, because I don't want to refer directly to the main template.  I know, it's cumbersome if you update your template, but here's to hoping you aren't doing that often.

In the future, I think we need to retool the way template notes are done.  Rather than associating a notebook with its template notes, we should have multiple template notes and be able to associate them with notebooks (by default).  Or just choose _which_ template we want to use in any given notebook.
Comment 4 Greg Poirier 2010-01-07 05:37:45 UTC
Created attachment 150950 [details] [review]
Use default note template content for notebook templates

If no notebook template exists, then we grab the content from the default template.  However, if a template exists (even the default template), you're stuck copying and pasting from the default template.  

Anything more than this, and we'd really need to talk about what desirable behavior is.  There's not much in the way of controlling how template notes are currently associated with notebooks.  I think this is the nicest/safest way to do it.  Though, I will freely agree, it isn't ideal--and not exactly what you wanted.
Comment 5 Sandy Armstrong 2010-01-11 15:31:39 UTC
Review of attachment 150950 [details] [review]:

::: Tomboy/Notebooks/Notebook.cs
@@ +112,3 @@
 			Note note = noteManager.Find (templateNoteTitle);
 			if (note == null) {
+				Note default_note = 

Need to protect against a null return value here. The default template note is deletable.  Maybe GetDefaultNoteTemplate should create it if it doesn't exist.

@@ +116,3 @@
 				note =
 					noteManager.Create (templateNoteTitle,
+							default_note.XmlContent);

This doesn't work quite right, because the XmlContent includes the title, which isn't getting replaced properly by the Create method.  This means the notebook template is getting the same title as the default template.  This might best be fixed by fixing the Create method.
Comment 6 Greg Poirier 2010-01-12 15:02:10 UTC
Created attachment 151255 [details] [review]
New patch to fetch default note template content.

I opted out of tinkering with NoteManager at all, actually.  I killed GetDefaultNoteTemplate() in favor of using the pre-existing GetOrCreateNoteTemplate.  I noticed the XmlContent.Raplace () trick that was happening in CreateNewNote(string title, string uid), and used that in Notebooks.cs instead.  Now we shouldn't be getting a null object when getting the default note template, and the title is consistent within the XML.
Comment 7 Greg Poirier 2010-01-13 04:50:41 UTC
Created attachment 151310 [details] [review]
Address the issue in NoteManager

Okay... So this time, I opted for addressing the issue in NoteManager.  It's a much bigger change, but I think that it might be a step in the right direction.  What do you think about teasing apart GetOrCreateNoteTemplate into retrieval and creation?  There's repeated code peppered throughout all of this, and I tried to avoid adding more.
Comment 8 Sandy Armstrong 2010-07-25 17:03:20 UTC
This fix will be trivial when bug #509147 is fixed.  See patch attached to that bug.
Comment 9 Aaron D Borden 2011-08-22 22:08:17 UTC
This is mostly working in master now (1.7.4). The missing piece is the title of the notebook template. Currently it will use the default template.
Comment 10 André Klapper 2017-07-31 12:41:40 UTC
The Tomboy team has moved from GNOME Bugzilla to GitHub for bug reports and feature requests: 
      https://github.com/tomboy-notes/tomboy/issues/
Closing this report as NOTGNOME as part of Bugzilla Housekeeping (bug 781054) to keep tasks in one place. Please feel free to transfer this task to GitHub if this task is still valid in a recent Tomboy version. 
We are sorry for the inconvenience.