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



On Wed, Nov 12, 2008 at 3:10 AM, Paul Davis <paul linuxaudiosystems com> wrote:
> On Wed, 2008-11-12 at 09:09 +0100, Mike Massonnet wrote:
>> 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);
>
> not likely to work in a cross-platform GTK application, no?
>

Also depends on the intention of "open"; do you intend to open the
file for reading/writing/moving/deleting a file, or do you intend to
open the URI with whatever the default application is.

GIO was specifically written for this, and works cross-platform, but
is still fairly new and might be hard for application developers to
adopt (requires an up-to-date GLib and to effectively use it, an
up-to-date GTK+ as well). In the former case above, you need to make
sure the location is mounted, then just perform whatever GIO
operations you want from there on out. In the latter case where you
want to launch the URI, use gtk_show_uri().

-A. Walton

>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>


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