Re: Need help with mime types & file associations: SOLVED!



Am Montag, den 11.09.2006, 09:48 -0400 schrieb Joshua Smith:
> I'm not sure what the version numbers are, but by following a bunch of  
> 2002-era mail threads, I did manage to get file associations working in  
> JDS v3.  The secret recipe:
> 
> 1) The association between extension and mime type happens by adding an  
> XML file to /usr/share/mime/packages and running update-mime-database.

freedesktop.org shared MIME info database (recent)

> 2) The association between mime type and application name happens in a  
> .keys file in /usr/share/mime-info/.
> 3) The associations between application name and the actual application  
> (didn't see that level of abstraction coming, did you?!), happens with  
> a .applications file in /usr/share/application-registry/.

Both obsolete (should be used for GNOME <= 2.4 only AFAIR).

For one of my projects, I collected some links, that might be of
interest for you:
http://sourceforge.net/docman/?group_id=159685

> Oh, and you have to run nautilus --quit in order to see any of these  
> changes take effect.
> 
> I haven't figured out how to get my icon to show for the mime type yet,  
> but I think it will be easy.

Call it "gnome-mime-mediatype-subtype.extension" (recent GNOME systems)
and install it into /usr/share/pixmaps or into the hicolor icon theme.
Or associate an icon with your MIME type in the .keys file with an
'icon_filename=...' line.

> New question: If I did these things in a Linux installer, would file  
> associations work (using some backward-compatibility rules), or do I  
> need to create a .desktop file and do the update-desktop-database stuff  
> for machines running up-to-date versions of gnome and nautilus?

You can install the files for old and recent systems, so you can fully
support old (.keys and .mime file + .applications) and recent (shared
MIME info database XML snippet & update-mime-database + .desktop &
update-desktop-database) GNOME systems. The only problem: The old
gnome-vfs database cannot be extended with patterns to sniff files
(AFAIK).

> Also: Is /usr/share standard?

http://www.pathname.com/fhs/
http://standards.freedesktop.org/basedir-spec/latest/

> It seems to serve the function I recall  
> /usr/local/ served in the old days.  (Which is kind of ironic, if you  
> think about it ;)  The machine they provided me doesn't have a  
> /usr/local at all.

Most systems using autotools would define the standard installation path
as $datadir/mime/packages, $datadir/applications,
$datadir/mime-info, ... And $datadir is $prefix/share. See also the
mentioned spec.

Regards, Daniel




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]