Thunar fails to scan for template files in ~/Templates if ~/Templates is a symbolic link to another directory, resulting in Thunar's 'Create Document' menu displaying 'No templates installed'. The 'Create Document' command in the XFCE desktop's context menu permits ~/Templates to be a symbolic link to a directory, and documents can be created from template files contained in such a symlinked directory. This also works in PCManFM.
Created attachment 6350 git diff showing line to be replaced Fixes failure to detect file templates if ~/Templates is a symlink The XFCE desktop permits ~/Templates to be a symbolic link to a directory but Thunar's scan for template files fails if ~/Templates is a symbolic link. The problem is caused by _thunar_misc_jobs_load_templates() calling thunar_io_scan_directory() with the 'flags' parameter set to G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS. Changing the flags parameter to G_FILE_QUERY_INFO_NONE results in the eventual call to GIO function g_file_query_file_type() returning the GFileType value of the target of a symlink instead of the value of the symlink itself. This prevents thunar_io_scan_directory() from failing, and the scan for file templates proceeds as if ~/Templates was a directory.
Patched version available at https://github.com/Enpheebled/thunar/tree/Pheeble_20150630_171841
Is there a specific reason why you made ~/Template a symlink? Just asking in case you where searching for a configuration option to change it to a different directory. (In which case setting XDG_TEMPLATES_DIR in ~/.config/user-dirs.dirs would do the trick.)
(In reply to Mathias Brodala from comment #3) > Is there a specific reason why you made ~/Template a symlink? Just asking in > case you where searching for a configuration option to change it to a > different directory. (In which case setting XDG_TEMPLATES_DIR in > ~/.config/user-dirs.dirs would do the trick.) The reasons for using a symlink are outlined in my post to the XFCE forum at http://forum.xfce.org/viewtopic.php?id=9672, but basically a symlink is the easiest method, and it should work. (As I mentioned in the post, I have tried changing the XDG_TEMPLATES_DIR value as a workaround, but this exposes another minor bug in which Thunar fails to assign the correct icon to the folder. Changing the XDG_TEMPLATES_DIR value, however, shouldn't be necessary.)
Thanks for the patch. After a quick test, this seems to work fine and not cause any troubles, but I'll need to invest more time in testing. Unfortunately, I don't have much time available at the moment, so you will have to wait another month or two until I can get to it. I just wanted to report back to affirm I have not ignored this.
enpheebled.git@gmail.com referenced this bugreport in commit eeb012d81aec28bde0e25bc2d9fc2cfd03abc99d Thunar fails to scan for file templates if the Templates directory is a symbolic link ( bug #12032 ) https://git.xfce.org/xfce/thunar/commit?id=eeb012d81aec28bde0e25bc2d9fc2cfd03abc99d
Sorry for letting you wait that long ! Harald Judt went inactive and thunar was not maintained until now. Your patch just got submitted and will be released in thunar 1.8.0.