Posts Tagged ‘Nautilus’

Nautilus: where do you want to go today?

Monday, August 23rd, 2004

Nautilus error messageThe new spatial nautilus is generally nice, but sometimes the mime type detection messes up.

This time I had an sftp: location open, where I have a symlink to another folder on the remote server. First the symlink is shown as a file of an unknown type, but when I double click on it to open the folder, I get an error message that, to say the least, is not very helpful.

What is exactly the correct extension for “Folder” and if I open the “Open with” menu, there nothing there.

What am I supposed to do?

Is there really no way I open the remote folder?

UPDATE: the bug report is here, so I’m not alone.

Tex font metricsUPDATE 2: I have another file, a Gnumeric file, which is regularly, but not always, recognised as a “TeX font metrics” file. I have no idea why, but it must be some pattern of bytes in its content that triggers this faulty identification. At least in this case I can open it via the “Open with” menu.

Nautilus 2.6 and mime types

Thursday, July 1st, 2004

Since I installed Gnome 2.6 in my Debian testing laptop, nautilus has refused to work with certain file types. They are classified as application/octet-stream and not application choices are offered.

Even if I go to Applications | Desktop Preferences | Advanced | File types and programs and set up the mime types, extensions and applications, nautilus couldn’t care less. These settings are almost ignored.

I’m not an expert on these matters, but it has something to do with the content-sniffing nautilus does to determine the file type.

It took a while to figure out, but I have found the way to add file types to the system. It is described at www.freedesktop.org.

First one has to create an XML file for the type or types to be added. The format is quite simple, and here is one for the Glabels application for printing address labels:

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
    <mime-type type="application/x-glabels">
        <comment xml:lang="en">Glabels document</comment>
        <glob pattern="*.glabels" />
  </mime-type>
</mime-info>

Notice the mime-type, the description and the glob-pattern. There’s also a way of specifying magic patterns for content sniffing.
It is possible to have several “mime-type” sections in the same file.

The XML file is placed in /usr/share/mime/packages/, in this case I called it glabels.xml.

When this file is in place, all that remains is to run the command

update-mime-database /usr/share/mime

which will populate /usr/share/mime with separate files for each mime type, including the new types.

All that remains is to restart nautilus by running nautilus --quit from a shell prompt, and the new mime-type should be recognised.

UPDATE 2004-07-17: It appears you can have your private mime-files in ~/.local/share/mime. Create, e.g., ~/.local/share/mime/packages/local.xml in the format described above, with one or more ‘mime-type’ entries, and run the command

update-mime-database ~/.local/share/mime/

as yourself. It will then populate ~/.local/share/mime/ with all the necessary files for nautilus to recognise your new mime-types, after a restart, that is.