Re: How can I open an uri use gtk function?

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

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.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]