URL Handler/API rev1
danielwilms (Talk | contribs) (New page: = Hildon URI API, rev 1 = This document describes the first revision of the hildon_uri_* API that was added in IT-2007. It has been revised and expanded in rev 2, see rev 2 for informatio...) |
m |
||
(2 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | + | {{out of date}} | |
- | This document describes the first revision of the hildon_uri_* API | + | This document describes the first revision of the <code>hildon_uri_*</code> API that was added in IT-2007. It has been revised and expanded in rev 2, see [[URL Handler/API rev2|API revision 2]] for information about that. |
- | that was added in IT-2007. It has been revised and expanded in rev 2, | + | |
- | see | + | |
- | The API brings functionality for actions to be performed | + | The API brings functionality for actions to be performed based on the scheme in the URI, such as "http" or "callto". There can be one or more actions for a scheme, and a default action for each scheme. |
- | scheme in the URI, such as "http" or "callto". There can be one or | + | |
- | more actions for a scheme, and a default action for each scheme. | + | |
- | This setup closely follows the hildon_mime_* API setup, and the | + | This setup closely follows the <code>hildon_mime_*</code> API setup, and the Freedesktop standard for desktop files is reused here as well. |
- | Freedesktop standard for desktop files is reused here as well. | + | |
- | This is be done by adding custom sections to the desktop files, | + | This is be done by adding custom sections to the desktop files, listing the URI actions for the application. This has the advantage that applications already have the build and Debian packaging mechanisms in place. |
- | listing the URI actions for the application. This has the advantage | + | |
- | that applications already have the build and Debian packaging | + | |
- | mechanisms in place. | + | |
Make sure to read the desktop entry [http://standards.freedesktop.org/desktop-entry-spec/latest/ specification] | Make sure to read the desktop entry [http://standards.freedesktop.org/desktop-entry-spec/latest/ specification] | ||
- | The utility update-desktop-database from desktop-file-utils is used to | + | The utility <code>update-desktop-database</code> from desktop-file-utils is used to handle the new fields that have been added. |
- | handle the new fields that have been added. | + | |
== Desktop file format == | == Desktop file format == | ||
Line 51: | Line 42: | ||
TranslationDomain=some_app | TranslationDomain=some_app | ||
- | + | The X-Osso-URI-Actions key in the [Desktop Entry] specifies the available actions that the application provides. Then for each action there is a corresponding groups, that specifies the properties of that action. | |
- | + | The keys are: | |
- | + | * '''Method:''' the D-Bus method to call on the service | |
- | + | * '''Name:''' the name of the action | |
- | + | * '''TranslationDomain:''' the translation domain to use when translating the name | |
== Default action == | == Default action == | ||
+ | |||
Just like for the MIME open functionality in upstream GNOME and in Maemo, there is a way to specify which application is the default if there are many that support the same URI scheme. The defaults file is located in $(prefix)/share/applications/uri-action-defaults.list. | Just like for the MIME open functionality in upstream GNOME and in Maemo, there is a way to specify which application is the default if there are many that support the same URI scheme. The defaults file is located in $(prefix)/share/applications/uri-action-defaults.list. | ||
== Updating the desktop database == | == Updating the desktop database == | ||
- | + | ||
+ | The 'update-desktop-database' command parses all the *.desktop files pointed to and generates a cache for them to speed up the lookup. This generation is usually done in the post-inst phase in a Debian package, in addition to "make install" in the makefile target: | ||
update-desktop-database $prefix/share/applications | update-desktop-database $prefix/share/applications | ||
- | + | Note that the update-desktop-database tool in Maemo has been patched to generate the cache for the added data. An example of a cache file, that resides in $(prefix)/share/applications: | |
- | + | [X-Osso-URI-Action Cache] | |
- | + | callto=im.desktop;gossip.desktop;gaim.desktop; | |
- | + | http=browser.desktop | |
- | + | https=browser.desktop | |
== Implementation details == | == Implementation details == | ||
When activating an action, the corresponding desktop file is used to lookup the D-Bus message and service name. The message is sent to the service. The arguments to the message consist of a an array of strings, which are the URIs passed. Note that the current implementation only sends one URI in the array, since the API only allows for one. | When activating an action, the corresponding desktop file is used to lookup the D-Bus message and service name. The message is sent to the service. The arguments to the message consist of a an array of strings, which are the URIs passed. Note that the current implementation only sends one URI in the array, since the API only allows for one. | ||
+ | |||
+ | [[Category:Development]] |
Latest revision as of 13:56, 23 March 2011
This article is out-of-date, and needs to be updated. Please see the talk page for discussion. |
This document describes the first revision of the hildon_uri_*
API that was added in IT-2007. It has been revised and expanded in rev 2, see API revision 2 for information about that.
The API brings functionality for actions to be performed based on the scheme in the URI, such as "http" or "callto". There can be one or more actions for a scheme, and a default action for each scheme.
This setup closely follows the hildon_mime_*
API setup, and the Freedesktop standard for desktop files is reused here as well.
This is be done by adding custom sections to the desktop files, listing the URI actions for the application. This has the advantage that applications already have the build and Debian packaging mechanisms in place.
Make sure to read the desktop entry specification
The utility update-desktop-database
from desktop-file-utils is used to handle the new fields that have been added.
Contents |
[edit] Desktop file format
See the following example:
[Desktop Entry] Version=1.0 Type=Application Encoding=UTF-8 Name=Instant messenger Comment=Talk to your friends Icon=im.png X-Osso-Service=com.nokia.im X-Osso-URI-Actions=callto;jabber;msn;
[X-Osso-URI-Action Handler callto] Method=call_to Name=call_this_contact TranslationDomain=some_app [X-Osso-URI-Action Handler jabber] Method=jabber_chat Name=send_message TranslationDomain=some_app
[X-Osso-URI-Action Handler msn] Method=msn_chat Name=send_message TranslationDomain=some_app
The X-Osso-URI-Actions key in the [Desktop Entry] specifies the available actions that the application provides. Then for each action there is a corresponding groups, that specifies the properties of that action.
The keys are:
- Method: the D-Bus method to call on the service
- Name: the name of the action
- TranslationDomain: the translation domain to use when translating the name
[edit] Default action
Just like for the MIME open functionality in upstream GNOME and in Maemo, there is a way to specify which application is the default if there are many that support the same URI scheme. The defaults file is located in $(prefix)/share/applications/uri-action-defaults.list.
[edit] Updating the desktop database
The 'update-desktop-database' command parses all the *.desktop files pointed to and generates a cache for them to speed up the lookup. This generation is usually done in the post-inst phase in a Debian package, in addition to "make install" in the makefile target:
update-desktop-database $prefix/share/applications
Note that the update-desktop-database tool in Maemo has been patched to generate the cache for the added data. An example of a cache file, that resides in $(prefix)/share/applications:
[X-Osso-URI-Action Cache] callto=im.desktop;gossip.desktop;gaim.desktop; http=browser.desktop https=browser.desktop
[edit] Implementation details
When activating an action, the corresponding desktop file is used to lookup the D-Bus message and service name. The message is sent to the service. The arguments to the message consist of a an array of strings, which are the URIs passed. Note that the current implementation only sends one URI in the array, since the API only allows for one.
- This page was last modified on 23 March 2011, at 13:56.
- This page has been accessed 5,434 times.