Editing Documentation/Maemo 5 Developer Guide/Application Development/MIME type mapping
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
- | MIME types mapping specifies for the platform which application should handle a given MIME type. A mapping has to be defined in the desktop file of the application by adding to it the MimeType field. | + | MIME types mapping specifies for the platform which application should handle a given MIME type. A mapping has to be defined in the desktop file of the application by adding to it the MimeType field. Desktop files are found in <code>$prefix/share/applications</code>. Each application has a desktop file, that specifies how it is started, what name it has, etc. It also specifies which MIME types the application can handle, if any. |
An [https://vcs.maemo.org/svn/maemoexamples/tags/maemo_5.0/maemo-examples/example_libosso.desktop example_libosso.desktop] file for the application looks like the following: | An [https://vcs.maemo.org/svn/maemoexamples/tags/maemo_5.0/maemo-examples/example_libosso.desktop example_libosso.desktop] file for the application looks like the following: | ||
Line 64: | Line 64: | ||
To introduce the newly defined MIME type(s) to the platform, do the following: | To introduce the newly defined MIME type(s) to the platform, do the following: | ||
- | + | # Copy the mime-information XML under /usr/share/mime/packages: | |
- | + | ||
- | Copy the mime-information XML under | + | [sbox-FREMANTLE_X86: ~] > cp example-mime.xml /usr/share/mime/packages |
- | + | ||
- | [sbox-FREMANTLE_X86: ~] | + | # Update the MIME and desktop database: |
- | + | ||
- | + | [sbox-FREMANTLE_X86: ~] > update-mime-database /usr/share/mime | |
- | + | [sbox-FREMANTLE_X86: ~] > update-desktop-database /usr/share/applications | |
- | Update the MIME and desktop database: | + | |
- | + | # Update the OSSO category database: | |
- | [sbox-FREMANTLE_X86: ~] | + | |
- | [sbox-FREMANTLE_X86: ~] | + | [sbox-FREMANTLE_X86: ~] > hildon-update-category-database /usr/share/mime |
- | + | ||
- | + | To remove the MIME from the platform, delete the XML file in /usr/share/mime/packages/ and update the databases as above. | |
- | + | ||
- | Update the OSSO category database: | + | |
- | + | ||
- | [sbox-FREMANTLE_X86: ~] | + | |
- | + | ||
- | + | ||
- | + | ||
- | To remove the MIME from the platform, delete the XML file in | + | |
== Registering MIME type with package == | == Registering MIME type with package == | ||
Line 157: | Line 149: | ||
When the <code>hildon_mime_open_*</code> API is called with a URI, GnomeVFS is used to get the MIME type. Then the list of applications that can handle that type is listed, and the default one is used. If there is no default, the first one from the list is used. | When the <code>hildon_mime_open_*</code> API is called with a URI, GnomeVFS is used to get the MIME type. Then the list of applications that can handle that type is listed, and the default one is used. If there is no default, the first one from the list is used. | ||
- | Then a | + | Then a DBus message is sent to activate the service specified by the 'X-Osso-Service' value for the found applications's desktop file, and the URI is passed to it for opening. |
[[Category:Development]] | [[Category:Development]] | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Fremantle]] | [[Category:Fremantle]] |
Learn more about Contributing to the wiki.