GNOME Bugzilla – Bug 138359
can't create new mime types with freedesktop.org mime database
Last modified: 2005-05-08 20:41:42 UTC
Description of Problem: Steps to reproduce the problem: 1. open nautilus 2. click on foo.mp3 3. nautilus dialogue says : "No action associated" 4. click on associate application button 5. Add file type for "application/x-mp3", program to run /usr/bin/xmms, hit ok 6. click on foo.mp3 again 7. nautilus dialogue says : "No action associated" 8. click on associate application button 5. add file type...default action is already "X multimedia System Actual Results: [ as above ] Expected Results: should start xmms How often does this happen? always Additional Information: under gnome-2.6
This is because gnome-vfs adds an old-style new mimetype for the new mimetype (and, its using the wrong name for the new mimetype, it should be application/x-ext-mp3), and mimetypes are read with the new mimetype system in 2.6. I'm pretty sure this is a dup, but i can't find the other bug :/
(Of course, the reporters problem is likely a missinstalled shared-mime-info or something like that, because the mp3 should already have been detected.)
I can't find the other bug, so lets consider this one the primary one. This is a pretty bad bug that needs to be fixed, but i'm not sure how to do it. Does the freedesktop.org system allow you to add per-user mimetypes, and does our implementation read it? If so, where do we put such files, and how do we launch update-mime-database to update the user part of the database only?
I think there's something in the mime spec saying the user isn't really meant to edit the mime db. It's possible to add new mime types in a user home dir still if you want to install programs using the mime db or installing new mimetypes on a system where you don't have root Those mime types go to ~/.local/share/mime/ To install a new mime type there, one puts an appropriate xml file in ~/.local/share/mime/packages/ and run update-mime-db ~/.local/share/mime/ xdgmime.c returns two occurrences of ".local", so I guess there's some code in there which tries to read those, I'm not sure it has been tested though.
Well, if we want to associate a file of unknown type to an app, the idea is to create a new mimetype application/x-ext-<extension> so that we can add the appropriate mapping in the mime -> application database. This means we need to be able to add new mimetypes in the user dir. Sounds like its possible...
This is similar to bug #71094 (see especially bug #71094 comment 6), which was recently closed. I think gnome-vfs should use the new XDG stuff and drop gnome-mime-data. There is currently a lot of redundancies in the databases that make up the MIME system of a GNOME desktop. Here are some notes that I have taken that may help sort things out: TRADITIONAL GNOME ================= /etc/gnome-vfs-mime-magic, a magic to MIME mapping -------------------------------------------------- - no longer used by gnome-vfs? - provided by gnome-mime-data anyway /usr/share/mime-info/*.mime, a glob to MIME mapping --------------------------------------------------- /usr/share/mime-info/*.keys --------------------------- - provides a list of applications available to open when a file is right clicked - defines how to open, view and edit /usr/share/application-registry/*.applications - can specify MIME types an app. can open (Open with Application...) - human description of application - supported URI types - declares whether an application requires a terminal FREEDESKTOP.ORG =============== /usr/share/mime/magic, a magic to MIME mapping ---------------------------------------------- /usr/share/mime/globs, a glob to MIME mapping --------------------------------------------- /usr/share/applications ----------------------- /usr/share/mime/audio/x-mpeg.xml -------------------------------- - human description of MIME type - can specify applications that can open the MIME type FILE/COMMAND LINE ================= /usr/share/file/magic (and magic.mime), a magic to MIME mapping ---------------------------------------------------------------
Yes, MIME is a mess at the moment! See some of my experiences, comments and solutions (if you like): http://forums.gentoo.org/viewtopic.php?p=1397590 http://bugs.gentoo.org/show_bug.cgi?id=45173 http://bugzilla.mozilla.org/show_bug.cgi?id=249153 Somebody should update the Gnome-Desktop Documentation or - even better - write a Gentoo-Gnome-Mime-HOWTO... ... and a Gentoo-X.org-Xft-fontconfig-pango-HOWTO. :-) Making mime-types and fonts work the way they should, took my many, many hours and I am still not sure, whether I have fully understood this "kind of magic". I would be happy to contribute my experiences to those HOWTOs or even write it by myself, if supported by the Gentoo- and/or Gnome-Team. Axel -- Nothing is particularly hard if devided into small pieces. : Henry Ford
Is this bug fixed by the new MIME system?
According to [1], recent XMMS versions ship with a sane amount of MimeType values in its .desktop file and therefore should be fired up flawlessly when double-clicking MP3 files. [1] http://cvs.xmms.org/cvsweb.cgi/xmms/xmms/xmms.desktop