Xfce Forum

Sub domains
 

You are not logged in.

#1 2015-06-22 23:36:21

Pheeble
Member
Registered: 2015-06-22
Posts: 27

[Solved] Thunar templates problem with home folders on network server

Apologies in advance for the lengthy question, but I thought I'd chuck in lots of detail rather than wait until someone has to ask for it.

I'm using Thunar 1.6.3 on Linux Mint 17.1 XFCE x64 on several computers on my home network. To avoid duplication I've got some of my home folders (Documents, Downloads, Music, Pictures, Videos and Templates) on a network server that is mounted by each computer at boot time via a cifs-filetype entry in /etc/fstab as /mnt/srvr. I have a symlink in my home folder on each computer that links to the relevant folder on the server, so ~/Documents is a symlink to /mnt/srvr/documents, etc. That way if, for example, I create a new file template in one computer's Templates folder it is immediately accessible by any other computer in its own Templates folder.

I've been doing this for quite a while and it works very well except for one Thunar-related niggle. I have several file templates in the server's templates folder, and they show up without problem in the ~/Templates folder on each computer, but Thunar's 'Create Document' menu indicates 'No templates installed'. If I right-click on the XFCE desktop, however, the 'Create From Template' menu lists the templates correctly, so it seems to be a Thunar-specific problem.

I have found a workaround to get the templates to show up in the Thunar templates menu, by running a script at login that modifies the file ~/.config/user-dirs.dirs by changing the line

    XDG_TEMPLATES_DIR="$HOME/Templates"
to

    XDG_TEMPLATES_DIR="/mnt/srvr/templates"

and this works... except...

...when I do that Thunar fails to display the Templates folder with the usual folder-specific icon (it has specific icons for Documents, Downloads, etc) instead just using a generic folder icon. Yes, I know this is hardly a disaster, but over time it has increasingly irked me that I can't find a complete solution to this. Ideally I want Thunar to recognise the templates without having to do any workaround login script.

Is this just a Thunar bug? My first guess is that Thunar's code for finding templates does not support symlinks. Or is there some Thunar templates configuration issue I'm overlooking?

And how does Thunar decide which folders get a folder-specific icon instead of the generic folder icon anyway? Presumably that breaks if the folder is non-local.

(I tried hunting down the source code for Thunar, and I found a couple of functions that seem to be relevant, but it's a bit beyond the simple programming I've done previously and it referred to gio functions that apparently are in an external library somewhere, at which point I decided to leave that for another day - at least until I've had a chance to learn a bit more about how the whole git thing works.)

Offline

#2 2015-06-23 00:39:45

MountainDewManiac
Member
From: Where Mr. Bankruptcy is Prez
Registered: 2013-03-24
Posts: 1,115

Re: [Solved] Thunar templates problem with home folders on network server

Pheeble wrote:

Is this just a Thunar bug?

Have you tried adding the Xfce 4.12 PPA to your sources list in order to get the current version of Thunar? I believe, for distros based on Ubuntu 14.04 (such as Mint 17.x), Thunar would be upgraded to version 1.6.10-1~14.04. If it is a bug in Thunar, perhaps it has been fixed.

If you learn that it hasn't been fixed in the current version of Thunar (assuming that 1.6.10-1~14.04 is actually the current one) - or if you have issues with and/or just don't like the improvements in Xfce 4.12 - you should be able to revert the changes via PPA-purge; but I'm guessing there because I've seen no reason to revert the Xfce 4.12 I have on the other partition back to 4.10, therefore, I haven't tried doing so.

Regards,
MDM


Mountain Dew Maniac

How to Ask for Help <=== Click on this link

Offline

#3 2015-06-23 07:20:57

Pheeble
Member
Registered: 2015-06-22
Posts: 27

Re: [Solved] Thunar templates problem with home folders on network server

MountainDewManiac wrote:

Have you tried adding the Xfce 4.12 PPA to your sources list in order to get the current version of Thunar?

Thanks for the quick response.

No difference unfortunately.

Just to make sure I created a new partition and did a completely new installation of Linux Mint 17.1 XFCE, added the XFCE 4.12 PPA and did a dist-upgrade to get Thunar 1.6.10-1~14.04. Still exactly the same situation re templates, so it's probably a bug. I can live with it, but it would be nice to fix it.

I'm willing to have a go at fixing the bug, but I've got a few things to figure out before then, like how to use git., so it could take a while.

Offline

#4 2015-06-23 09:17:23

Pheeble
Member
Registered: 2015-06-22
Posts: 27

Re: [Solved] Thunar templates problem with home folders on network server

I've done a bit more digging through the Thunar code, and I think I've found where the problem occurs.

The file thunar-misc-jobs.c contains the function _thunar_misc_jobs_load_templates(), which calls the function thunar_io_scan_directory(). That function in turn calls the GIO function g_file_query_file_type() to test the file type of the object found at the location ~/Templates, which returns a value 'type' indicating whether the filetype is a file, directory or symlink.

The crucial part seems to be in thunar_io_scan_directory() where the found filetype value is checked:

  /* ignore non-directory nodes */
  if (type != G_FILE_TYPE_DIRECTORY)
    return NULL;

Anything other than a directory results in the directory scan failing, so if ~/Templates is a symlink no further scanning will occur and no templates contained in a symlinked-folder will be found.

I don't know enough (yet) to determine whether there would be a problem in expanding the filetype check to allow symlinks to directories in addition to ordinary directories. Of course, this is all assuming I have understood the code in an admittedly very brief search. I may have got it completely wrong.

Should I file a bug report about this issue?

Offline

#5 2015-06-23 12:49:24

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,481

Re: [Solved] Thunar templates problem with home folders on network server

Pheeble wrote:

Should I file a bug report about this issue?

At first, I wasn't sure if this was a bug in thunar or a limitation of the xdg-user-dirs spec. However, I installed pcmanfm and replicated your setup, and in pcmanfm, the folder icon appears.

So yes, you should file a bug report.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#6 2015-06-23 17:59:44

hjudt
Member
Registered: 2014-11-27
Posts: 21

Re: [Solved] Thunar templates problem with home folders on network server

One would need to check if the symlink target is a directory. Possibly recursively, because the symlink target can also be a symlink which can point to a directory, though the recursive checking might have already been implemented somehow. I haven't looked at it in detail. Pheeble, if you can provide a properly formatted patch (attached to a new bug in the xfce bug tracker) I will consider applying it.

Offline

#7 2015-06-24 05:20:32

Pheeble
Member
Registered: 2015-06-22
Posts: 27

Re: [Solved] Thunar templates problem with home folders on network server

I'm going to mark this post as 'solved' as it seems the cause of the problem has been found.

I will also investigate the code in more detail and attempt to fix the problem (or, more likely, problems plural, as the folder icon issue is probably unrelated).

Fair warning: I am completely self-taught at programming, although I have been doing it for many years, and I am familiar with standard coding practices, styles, etc. I have never programmed in a team situation or used a distributed VCS, so one of the first things I need to do is familiarise myself with git. I have mostly written small C and C++ utility programs for my own use, so I don't yet know how desktop-integrated applications like Thunar are usually tested and debugged. Obviously I need to install a debug version of Thunar, and my intention is to create a dedicated development environment in a virtual machine, but apart from that I'll have to learn as I go.

Any pointers to relevant tutorials - or advice on how the experienced programmers here have their development systems set up - will be appreciated.

Offline

#8 2015-06-24 06:30:41

hjudt
Member
Registered: 2014-11-27
Posts: 21

Re: [Solved] Thunar templates problem with home folders on network server

You can ask devs in #xfce-dev IRC channel. thunar can be installed into and run from a different prefix, side-by-side to your current installation. For that use e.g. "DESTDIR=/my/home/some/directory make install". No need to setup a vm in most cases.

Also see general wiki pages and specific ones like https://wiki.xfce.org/howto and http://docs.xfce.org/xfce/building.

Offline

#9 2015-06-25 01:18:28

Pheeble
Member
Registered: 2015-06-22
Posts: 27

Re: [Solved] Thunar templates problem with home folders on network server

hjudt wrote:

You can ask devs in #xfce-dev IRC channel. thunar can be installed into and run from a different prefix, side-by-side to your current installation. For that use e.g. "DESTDIR=/my/home/some/directory make install". No need to setup a vm in most cases.

Also see general wiki pages and specific ones like https://wiki.xfce.org/howto and http://docs.xfce.org/xfce/building.

Thanks for the response. Unfortunately I'm really not a fan of chat, so if there is no detailed documentation available I'll just try to make do with whatever documentation I can find in related areas. If I hit a brick wall there, I'll just work on something else. No disrespect intended, it's just not my way of working.

Offline

#10 2015-06-25 02:19:54

MountainDewManiac
Member
From: Where Mr. Bankruptcy is Prez
Registered: 2013-03-24
Posts: 1,115

Re: [Solved] Thunar templates problem with home folders on network server

Lots of people in the world aren't comfortable interacting with others in anything approaching a live/real-time manner, whether it is because of something as extreme as having anxiety/panic attacks when having to be around other people or - in the case of an IRC-type chat - something as simple as not being able to type very fast, lol. Whatever your reason - and that's your own affair - it shouldn't have to prevent you from your work.

In addition to the aforementioned IRC channel, there are also several Xfce-related email lists where you can interact "at your leisure," so to speak, including one that is called Thunar-dev that might be useful.

See:
https://mail.xfce.org/mailman/listinfo/

Regards,
MDM


Mountain Dew Maniac

How to Ask for Help <=== Click on this link

Offline

#11 2015-06-30 06:57:46

Pheeble
Member
Registered: 2015-06-22
Posts: 27

Re: [Solved] Thunar templates problem with home folders on network server

I filed a bug about this at https://bugzilla.xfce.org/show_bug.cgi?id=12032 and followed it up with a patch attachment.

The fix turned out to be trivial, as detailed in the patch submission.

Apoiogies if I didn't do either the bug report or the patch in the desired format, but I spent a couple of hours trying to work out how to create a bug report and patch in the 'correct format' without finding anything other than generalities or statements that skipped over details and seemed to assume a lot of prior knowledge.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.011 seconds, 7 queries executed - Memory usage: 591.53 KiB (Peak: 608.38 KiB) ]