Fedora Linux Support Community & Resources Center

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

Forgot Password? Join Us!

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 14th November 2004, 10:46 AM
Pegasus Offline
Registered User
 
Join Date: Apr 2004
Posts: 208
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 12th April 2005, 09:28 PM
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 13th April 2005, 04:01 PM
BandC's Avatar
BandC Offline
Registered User
 
Join Date: Nov 2004
Posts: 1,105
Just curious... Did they fix this in Gnome 2.10 so we don't have to do all this?
__________________
IMHO GNOME FTW! BTW KDE WAD? FWIW. HTH. AFAIK YMMV. OMG WTF BBQ! :rolleyes:

Do you like surfing forums but wish people would stop using obscure abbreviations and acronyms?
Then my Firefox/Chrome extension ABBREX is for you!
It automatically adds hover tooltips to abbreviations displaying their meanings on any web page you visit!

Check it out at: http://abbrex.com
Reply With Quote
  #4  
Old 25th April 2005, 12:49 AM
Schika's Avatar
Schika Offline
Registered User
 
Join Date: Mar 2005
Location: Heidelberg, Germany
Age: 36
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 14th July 2005, 02:43 PM
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 14th July 2005, 04:40 PM
BandC's Avatar
BandC Offline
Registered User
 
Join Date: Nov 2004
Posts: 1,105
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.
__________________
IMHO GNOME FTW! BTW KDE WAD? FWIW. HTH. AFAIK YMMV. OMG WTF BBQ! :rolleyes:

Do you like surfing forums but wish people would stop using obscure abbreviations and acronyms?
Then my Firefox/Chrome extension ABBREX is for you!
It automatically adds hover tooltips to abbreviations displaying their meanings on any web page you visit!

Check it out at: http://abbrex.com
Reply With Quote
  #7  
Old 13th August 2006, 07:50 AM
marinaccio's Avatar
marinaccio Offline
Registered User
 
Join Date: Oct 2005
Location: U.S.A.
Age: 34
Posts: 66
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
  #8  
Old 11th September 2010, 04:07 PM
salgur Offline
Registered User
 
Join Date: Sep 2010
Posts: 1
linuxfedorafirefox
Re: How-To: Mime Types and file associations with FC3 - Gnome 2.8

Thank you very much. You're one more nice person who makes my life easier. Thanks again.
Sal
Reply With Quote
Reply

Tags
associations, fc3, file, gnome, howto, mime, types

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 & Packaging 1 5th July 2006 10:34 PM
ms office file associations broken by shared-mime-info-0.17-1.fc5.2 foresto Using Fedora 0 28th June 2006 01:59 AM
FC3 Changing file-types associations cscheng Using Fedora 2 14th November 2004 01:11 PM


Current GMT-time: 04:18 (Sunday, 26-05-2013)

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 Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat