Re: How can I open an uri use gtk function?
- From: Mike Massonnet <mmassonnet gmail com>
- To: gtk-list gnome org
- Subject: Re: How can I open an uri use gtk function?
- Date: Wed, 12 Nov 2008 09:09:02 +0100
Le Wed, 12 Nov 2008 10:13:38 +0800,
"Guoling Gao" <gguoling gmail com> a écrit :
> Hi all,
> Can I open URI use gtk function, except gnome-*? I want to open an
> URI from a program, but not find the right method.
> thanks.
xdg-open would be the simplest way of doing so, from head off:
command = g_strdup_printf ("xdg-open %s", uri);
gdk_spawn_command_line (command);
Otherwise you can use the GIO API, I don't know exactly so it's just a
random guess. GAppInfo has functions to launch uris, and GFile has
functions to get a GAppInfo (g_file_query_default_handler and
g_app_info_launch*).
I would recommend xdg-open of course. Depending on the build system
you are using, you can check at configure-time if the command xdg-open
is installed or not and print a message, for instance.
Cheers
Mike
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]