[FOSS-GPS] FoxtrotGPS: launching documentation from the UI (was: FoxtrotGPS documentation (format? license?))

Joshua Judson Rosen rozzin at geekspace.com
Wed Dec 12 15:57:42 PST 2012


David Bannon <dbannon at internode.on.net> writes:
>
> On Mon, 2012-12-10 at 20:15 -0500, Joshua Judson Rosen wrote:
>
> > I think I'd try just calling the `xdg-open' command if it exists,
> > and then probably try falling back to the `run-mailcap' or `see' command
> > if xdg-open doesn't work--so it'd use whatever PDF/HTML viewer/brower
> > is appropriate on the user's system.
>
> 'see' is fine on my Ubuntu box but not available on a Centos box I still
> have access to. But xdg-open does work there.

Hmm--looking into what xdg-open does..., I find that there's actually
an API for this in GLib:

    http://developer.gnome.org/gio/2.32/GAppInfo.html#g-app-info-launch
    http://developer.gnome.org/gio/2.32/GFile.html#g-file-query-default-handler

When running under GNOME, it looks like xdg-open just defers to gvfs-open,
which then looks up a default handler with g_file_query_default_handler,
and then invokes it with g_app_info_launch.

But neither of those functions are actually GNOME-specific--
they're in GLib, which we're already using.

On unix systems, the back end for g_file_query_default_handler
is XDG:

    http://developer.gnome.org/gio/2.32/gio-Desktop-file-based-GAppInfo.html

So, it seems mostly equivalent to calling xdg-open.

-- 
"Don't be afraid to ask (λf.((λx.xx) (λr.f(rr))))."


More information about the FOSS-GPS mailing list