[Thunar-dev] [PATCH] Fix Thunar's failure to scan for templates in symlink directory

Pheeble enpheebled.git at gmail.com
Tue Jun 30 11:21:40 CEST 2015


Thunar fails to find file templates if ~/Templates is a symlink to a
directory, and Thunar's 'Create document' menu displays 'No templates
installed'.

The XFCE desktop's context menu displays the templates correctly, as
does PCManFM.

The failure is caused by the function _thunar_misc_jobs_load_templates()
calling thunar_io_scan_directory() with the 'flags' parameter set to
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS. The function
thunar_io_scan_directory() fails if the file type of the object at
~/Templates is not a directory.

Changing the value of the flags parameter to G_FILE_QUERY_INFO_NONE
allows the eventual call to the GIO function g_file_query_file_type()
to return the file type of the symlink's target instead of the file type
 of the symlink itself. If ~/Templates is a symbolic link to a directory
 then thunar_io_scan_directory() proceeds as if ~/Templates is a
 directory, the template files are found and Thunar's 'Create document'
 menu displays the template files correctly.

 Fixes bug 12032 (https://bugzilla.xfce.org/show_bug.cgi?id=12032).

 Diff output:

 diff --git a/thunar/thunar-misc-jobs.c b/thunar/thunar-misc-jobs.c
index 373e2f5..8e3a237 100644
--- a/thunar/thunar-misc-jobs.c
+++ b/thunar/thunar-misc-jobs.c
@@ -61,7 +61,7 @@ _thunar_misc_jobs_load_templates (ThunarJob  *job,
     {
       /* load the ThunarFiles */
       files = thunar_io_scan_directory (job, templates_dir,
-                                        G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                        G_FILE_QUERY_INFO_NONE, /* symlink ok */
                                         TRUE, FALSE, TRUE, NULL);
     }
---
 thunar/thunar-misc-jobs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/thunar/thunar-misc-jobs.c b/thunar/thunar-misc-jobs.c
index 373e2f5..8e3a237 100644
--- a/thunar/thunar-misc-jobs.c
+++ b/thunar/thunar-misc-jobs.c
@@ -61,7 +61,7 @@ _thunar_misc_jobs_load_templates (ThunarJob  *job,
     {
       /* load the ThunarFiles */
       files = thunar_io_scan_directory (job, templates_dir,
-                                        G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                        G_FILE_QUERY_INFO_NONE, /* symlink ok */  
                                         TRUE, FALSE, TRUE, NULL);
     }
 
-- 
1.9.1



More information about the Thunar-dev mailing list