Fedora Linux Support Community & Resources Center

Sections ›› Home | Forums | Guidelines | Forum Help | Fedora FAQ | Fedora News 

Go Back   FedoraForum.org > Fedora Support > Guides & Solutions (No Questions)

Guides & Solutions (No Questions) Post your guides here. You can also add your comments to a guide, but don't start a thread to ask a question. Use another forum for that.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 2004-11-14, 03:46 AM CST
Pegasus Offline
Registered User
 
Join Date: Apr 2004
Posts: 206
How-To: Mime Types and file associations with FC3 - Gnome 2.8

Related to: Fedora Core 3 (Heidelberg) with Gnome 2.8
Problem: After fresh install, "File types and programs" (gnome-file-types-properties) is not available any more. The given solution by gnome - right-click -> open with other application -> ... - is not acceptable. Goal is to define a default application and double-click the file!

Since GNOME 2.8, MIME types are stored in the new FreeDesktop shared-mime-info database. However, gnome-control-center has not been updated to allow one to easily add MIME types to this database. Therefore, if applications such as Nautilus complain that there is no MIME type associated with a particular file, using the Associate Application interface will not work.

New MIME types can be added in one of two places. They can either be added system-wide for all users, or added locally on a per-user basis. System-wide MIME types must be added to either ${LOCALBASE}/share/mime or ${X11BASE}/share/mime, where as local MIME types must be added to ~/.local/share/mime.
This text is taken from website http://www.freebsd.org/gnome/docs/faq2.html#q22


This essay will describe the system-wide procedure, because the local one caused errors! Also the shown procedure of local define caused trouble in FC3.
At the end of this essay, you'll find some helpers to fix such created file associations...


MIME type handling in Gnome 2.8
Related Files:
This section will give you a small introduction which files need to be modified in order to change the system for your needs. Each of the shown files needs to be changed with root access.

-> /usr/share/applications/defaults.list
This file contains the applications which cause a double-click success. All Mime types will point to a desktop file.

-> /usr/share/applications/[application_name].desktop
This is the file where "defaults.list" will point to. One of the most important things inside this file is the entry "MimeType=".

-> /usr/share/applications/mimeinfo.cache
Contains information in similar form shown for file "defaults.list" in same directory. This file contains ALL associations given to a mime type. There is no need for a specified order of desktop files (see XMMS example lateron)

-> /usr/share/mime (Directory)
This directory contains several information. The sub-directories - excluding packages - contain information about given mime types. You'll see that many mime types already exist.
The packages directory contains the DATABASE calles freedesktop.org.xml!

-> /usr/share/mime/globs
This file contains the file extensions, associated to the mime-types.


Example: MPlayer should start WMV by Double-Click
I've uninstalled Xine and Totem, cause i only use MPlayer. After uninstalling them, i've seen the desaster: previously, Totem was the default player. And now there was ... nothing!
After two days of internet research, this essay was created ... so you havn't waste time as i have to do

Creating the desktop file
If it is not already existing, create the file "/usr/share/applications/mplayer.desktop" like this:
Code:
[Desktop Entry]
Name=Movie Player
Comment=Play multimedia files and media
Icon=mplayer.xpm
Exec=gmplayer %f
Terminal=false
MimeType=video/mpeg;video/x-msvideo;video/quicktime;video/x-ms-asf;video/x-ms-wmv
Type=Application
Categories=Application;AudioVideo;
Encoding=UTF-8
The mime types for asf and wmv already exist and are stored in the mime type database (/usr/share/mime/packages/freedesktop.org.xml)

Modify defaults.list
This file will init our DEFAULT application. It ONLY contains ONE desktop file for EACH mime type:
Code:
video/x-ms-asf=mplayer.desktop
video/x-ms-wmv=mplayer.desktop
Modify mimeinfo.cache
To take effect as default application and init the double-click feature, we need to modify the mimeinfo.cache also:
Code:
video/x-ms-asf=mplayer.desktop
video/x-ms-wmv=mplayer.desktop
This file can use MORE then ONE desktop file. If you want to be able to handle - for example - WMV files with different players, a line like this is also acceptable:
Code:
video/x-ms-wmv=mplayer.desktop;realplay.desktop
This will change the right-click-menu and insert Helix-Player, while mplayer is still default (with double-click)

After modification, log out from gnome and log in again...


Example: XMMS should start MP3 by Double-Click
I've seen this question inside this forum, so it might be a little helper to toggle existing file associations to a needed row...
By default, the Helix player will open if we double-click a MP3-file. In defaults.list file we'll see:
Code:
...
audio/x-mp3=realplay.desktop
audio/x-mp3-playlist=realplay.desktop
...
... and in mimeinfo.cache we'll see entries like this:
Code:
...
audio/x-mp3=rythmbox.desktop;rythmbox.desktop;redhat-audio-player.desktop;realplay.desktop
...
audio/mp3=realplay.desktop
...
Now, what the heck is the correct player? It's "redhat-audio-player.desktop" (if you open this file, you'll see the line "Exec=xmms -e %F"

If we want XMMS to start MP3 files with a double-click, we need to change the defaults.list file:
Code:
...
audio/x-mp3=redhat-audio-player.desktop
audio/x-mp3-playlist=redhat-audio-player.desktop
...
... and this MP3 association in mimeinfo.cache:
Code:
...
audio/mp3=redhat-audio-player.desktop
...
Logout from Gnome and log in again ... the changes are ready to use


Bug-Fixes and trouble shooter
As told in the beginning, local changes may cause trouble to install default applications. Here is an introduction on how to fix them. There is no need for root access, all files are stored in /home/[username]/.local. In case of that, the problems has to be fixed by each user itself, because root will not see directory ~/.local directory for other user ...

If you create an association by using "open with" or "open with other application", files are created in directory ~/.local/share/applications. DELETE THEM for applications modified for system-wide usage.

If you manualy create mime types inside the ~/.local folder (as shown in the quoted website in the beginning), please store them system-wide. I've tried this procedure (local) and was not able to double-click a file after rebooting, regardless of using the application "update-mime-database" or not.

If you get in trouble by using "update-mime-database" application by creating NEW mime-types and errors occur: -> there is a bug in the shown website!
WRONG: <xml version="1.0" encoding="UTF-8"?>
CORRECT:<?xml version="1.0" encoding="UTF-8"?>
__________________
Distro Killer Test System:
Intel Pentium II 400 Mhz - 256 MB Ram, MS6151 Mainboard with ESS 1371 Onboard Sound, Ati Radeon 9200se AGP, Adaptec 2940 PCI SCSI Controller, SCSI Zip Drive 100 internal, HP Scanjet 4C SCSI, RealTek PCI Ethernet Card (for DSL connection), PM = 10GB HDD, PS = LG GSA4081B, SM = 4 GB HDD (vfat), SS = LiteOn 40x CD-Rom
------------
RH9 -> Success, Suse 8.2/9/9.1 -> Failed, MDK9 -> Failed, FC2 -> Failed, MDK10 -> Success, FC3 -> Success
Reply With Quote
  #2  
Old 2005-04-12, 02:28 PM CDT
ominae Offline
Registered User
 
Join Date: Apr 2005
Posts: 1
How would you make .m3u automatically load to xmms when you double click on the file. Mine aways default to xine. thanks
Reply With Quote
  #3  
Old 2005-04-13, 09:01 AM CDT
BandC's Avatar
BandC Offline
Registered User
 
Join Date: Nov 2004
Posts: 1,081
Just curious... Did they fix this in Gnome 2.10 so we don't have to do all this?
Reply With Quote
  #4  
Old 2005-04-24, 05:49 PM CDT
Schika's Avatar
Schika Offline
Registered User
 
Join Date: Mar 2005
Location: Heidelberg, Germany
Age: 33
Posts: 8
How can I add/edit instead of MIME-TYPE the protocols? For example I would like to add the protocol callto:// and assign it to Skype. Thanks in advance.
__________________
.: Schika :.

.: SchikArts :.
Reply With Quote
  #5  
Old 2005-07-14, 07:43 AM CDT
TheCat Offline
Registered User
 
Join Date: Jun 2005
Posts: 16
No, it hasn't been fixed in Gnome 2.10. I'm guessing this is a conscious decision on the part of the Gnome developers, but it sure seems weird to me. At any rate, there's a very helpful tutorial I found for Gnome 2.1 on FC4.

Gnome
http://www.ces.clemson.edu/linux/fc4...op.shtml#gmime

KDE
http://www.ces.clemson.edu/linux/fc4...op.shtml#kmime
Reply With Quote
  #6  
Old 2005-07-14, 09:40 AM CDT
BandC's Avatar
BandC Offline
Registered User
 
Join Date: Nov 2004
Posts: 1,081
Quote:
Originally Posted by TheCat
No, it hasn't been fixed in Gnome 2.10. I'm guessing this is a conscious decision on the part of the Gnome developers, but it sure seems weird to me. At any rate, there's a very helpful tutorial I found for Gnome 2.1 on FC4.

Gnome
http://www.ces.clemson.edu/linux/fc4...op.shtml#gmime

KDE
http://www.ces.clemson.edu/linux/fc4...op.shtml#kmime
These tutorials look really nice. Thanks for the links.
Reply With Quote
  #7  
Old 2006-08-13, 12:50 AM CDT
marinaccio's Avatar
marinaccio Offline
Registered User
 
Join Date: Oct 2005
Location: U.S.A.
Age: 30
Posts: 68
Pegasus,

Thanks for the info, pointed me in the right direction.

marinaccio
__________________
Registered linux user #418499
Family Site www.MarinaccioFamily.com
Web Dev Site www.MarinaccioFamily.biz
Resume www.JosephMarinaccio.com

FC9 T5500 4Gig
IPCop 2.6Ghz 1Gig R/G/O/B
CentOS 5 Dual P3 1Gig - Dev Server
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to register file extension (MIME types) miro Programming 1 2006-07-05 03:34 PM CDT
ms office file associations broken by shared-mime-info-0.17-1.fc5.2 foresto Software 0 2006-06-27 06:59 PM CDT
File Types and Associations ??? Alistair Mackay gmane.linux.redhat.fedora.general 13 2005-08-05 02:12 AM CDT
mime types in gnome soraberri gmane.linux.redhat.fedora.general 0 2005-02-02 04:14 PM CST
FC3 Changing file-types associations cscheng General Support 2 2004-11-14 06:11 AM CST

Automatic Translations (Powered by Powered by Google):
Afrikaans Albanian Arabic Belarusian Bulgarian Catalan Chinese Croatian Czech Danish Dutch English Estonian Filipino Finnish French Galician German Greek Hebrew Hindi Hungarian Icelandic Indonesian Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Taiwanese Thai Turkish Ukrainian Vietnamese Yiddish

All times are GMT -7. The time now is 12:53 PM CST.

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo



All trademarks, and forum posts in this site are property of their respective owner(s).

FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact | Founding Members
Designed By Ewdison Then | Powered by vBulletin ©2000-2009, Jelsoft Enterprises Ltd.
FedoraForum is Powered by Open Source Projects and Products
vB Enterprise Translator (vBET 2.3.8) coded by NLP-er