Launching .desktop files with GIO

Jannis Pohlmann jannis at xfce.org
Sun Aug 23 23:45:54 CEST 2009


Hey Nick, Brian,

just to reply to what was discussed on IRC (and because you two are not
online at the moment):

<kelnos> actually i wonder
<kelnos> can you launch .desktop files using gio?
<kelnos> (and also set screen and startup notification stuff?)
<NSchermer> yeah that is, in a combination of GAppLaunchContext,
GAppInfo and a list of GFiles <kelnos> mmm
<NSchermer> no timestamp iirc
<kelnos> boo

On Unixes one can create a GDesktopAppInfo from a filename and call
g_app_info_launch() with an empty file list to call a desktop file
without any arguments.

Here are two links to the API docs:
http://library.gnome.org/devel/gio/2.18/gio-Desktop-file-based-GAppInfo.html
http://library.gnome.org/devel/gio/2.18/GAppInfo.html

The launch() method takes a GAppLaunchContext argument. The
GAppLaunchContext interface is implemented by GdkAppLaunchContext
and that class allows to set things like display, screen and also a
timestamp to be used for startup notification:

http://library.gnome.org/devel/gdk/stable/gdk-Application-launching.html

Again, GDesktopAppInfo is only available when gio-unix-2.0 is
available. I'm not sure why that is. Its obvious that the menu spec is
only really being used on Unixes, but GDesktopAppInfo might still be
useful for individual files. Dunno if that would be a problem for e.g.
xfdesktop.

  - Jannis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20090823/7060a31f/attachment.pgp>


More information about the Xfce4-dev mailing list