Adding an application to the default applications
For application developers.
The new gnome-default-applications-properties allows applications to provide a new entry in the default applications preferences without modifying the control-center.
Note that this is just dropping a single file in a directory, and shouldn't stop any non-GNOME applications from adding support for this feature.
The definition
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE default-apps SYSTEM "gnome-da-list.dtd">
<default-apps>
<web-browsers>
<web-browser>
<_name>Arora</_name>
<executable>arora</executable>
<command>arora %s</command>
<icon-name>web-browser</icon-name>
<run-in-terminal>false</run-in-terminal>
<netscape-remote>false</netscape-remote>
</web-browser>
</web-browsers>
</default-apps>Make sure this XML file gets translated, this is where the gnome-default-applications-properties will look for translations. This usually means adding intltool support to your build system.
Note the "web-browsers" and "web-browser" parts. This should be replaced by:
- mail-readers and mail-reader for Mailers.
- terminals and terminal for Terminal emulators.
- media-players and media-player for Movie and Music players.
- a11y-visual and visual for Visual Accessibility helpers.
- a11y-mobility and mobility for Mobility Accessibility helpers.
Your best course of action is copying an existing entry from gnome-default-applications.xml.in for the application type you want to support.
Where to drop the file
The file needs to be located in $(prefix)/gnome-control-center/default-apps
After having created your .xml file, you'll need to get it installed. It needs to be installed according to the output of:
pkg-config --variable=defappsdir gnome-default-applications
Here's a snippet to use in your configure.ac or configure.in:
AC_MSG_CHECKING([whether to install GNOME control-center default application definition])
if $PKG_CONFIG --variable=keysdir gnome-default-applications >/dev/null ; then
AC_MSG_RESULT([yes])
DEFAULTAPPS_DIR="`$PKG_CONFIG --variable=defappsdir gnome-default-applications`"
AC_SUBST(DEFAULTAPPS_DIR)
else
AC_MSG_RESULT([no])
DEFAULTAPPS_DIR=""
fi
AM_CONDITIONAL([DEFAULT_APPS_DEFINITION],[test -n "$DEFAULTAPPS_DIR"])And in the Makefile.am in the directory where the XML file is:
xml_in_files = browser.xml.in if DEFAULT_APPS_DEFINITION xmldir = $(DEFAULTAPPS_DIR) xml_DATA = $(xml_in_files:.xml.in=.xml) endif @INTLTOOL_XML_RULE@