Here are some short comments regarding to the overall designs after code review.
I'm not at home now and will test the code in 1 - 2 days after I get home.

About API degisn:
The programming interface looks good.
It's simple enough for use in other programs and I like it.
It'll be better if there is _get_name() which returns a const char* rather than duplicating the string.

About the specs supported:
I agree with others that it should be as simple as possible.
The KDE way is too complicated and not intuitive.
The pros of there way is applications can install template files with localized names.
The cons of course is its complexity.
However I'm not completely against the idea.
The Gnome and Thunar ways are more friendly for the users to add customized templates.
The KDE way, in the contrary, seems to be designed for applications to install built-in templates.
They are good at different things so it's not bad to support both.

For applications which requires more complicated stuff, there is another way to install popup menu items.
They can use the DES-EMA spec to install popup menu actions.
So even if we don't support the KDE way, applications can still install custom items to the popup menu.
We just need to extend that DES-EMA support a little to enable creating items in "Create New" submenu.

Since adding this does not create much overhead, it's OK to keep KDE support, though.
For the gnome support, the menu items can simply show the file names assigned by the users.

Many thanks to Andriy for the hard work.
I'll compile the code and do some real tests as soon as possible.

BTW, I noticed some significant slow down of startup of pcmanfm in Lubuntu 12.10.
Maybe it's time to do some profiling again to see what's wrong.

On Sun, Nov 18, 2012 at 6:58 PM, Sergio <> wrote:

--- Em dom, 18/11/12, Sergio <> escreveu:

> De: Sergio <>
> Assunto: Re: [Pcmanfm-develop] Templates support in libfm.
> Para:, "Stephan Sokolow" <>
> Data: Domingo, 18 de Novembro de 2012, 8:48
> I'll be honest here. I don't have
> much experience with template files but regardless of
> whatever convoluted hacks GNOME and KDE use for that, which
> libfm can support or not depending on the developer's
> wishes, pcmanfm should have a simple system just like
> Thunar.
> I place a file called 'Foo' in ~/Templates with content
> 'bar'. AFAICS pcmanfm should simply display 'Create
> New...'>'Foo', open a rename dialogue and create the new
> file with 'bar' contents.
> If libfm tries itself to discover the kind of file (like by
> extension) the drawbacks are:
> - impossible to have more than one different template with
> the same extension.
> - impossible to choose the most descriptive name for the
> user.
> - need specific hacks for the likes of .desktop, .directory
> etc. files to display their names (a .desktop file in
> XDG_TEMPLATES_DIR should not look for the 'Name' key).

*In short*: keep it simple!
Don't incur on the mistake of trying to know better than the user.
I have no idea whatever hack is there to discover the templates (I have no knowledge to read the code) but display the name the user defined for the file regardless of the extension in the 'Create New...' context menu and if libfm can't recognize the file as any known 'template', display it all the same (don't hide anything).

That's my modest opinion and I admit I know very little about the possibilities in this subject.

Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
Pcmanfm-develop mailing list