On Thu, 2007-11-15 at 16:25 +0100, Xavier Claessens wrote: 
> Hello,
> 
> I'm trying to get ride of GnomeVFS dependency in Empathy. I'm looking
> for a replacement of gnome_vfs_open_url(), is there an API in gio to do
> the same thing?

There is no simple call for it, but all the ingredients for it is there.

Start by looking at:

GAppInfo *g_app_info_get_default_for_uri_scheme  (const char *uri_scheme);

(uri scheme comes from g_file_get_uri_scheme())

If that returns NULL, we must look at the file type, which is done with:

g_file_query_info() or g_file_query_info_async()

(passing G_FILE_ATTRIBUTE_STD_CONTENT_TYPE as attribute)

Then you can get the default from:

GAppInfo *g_app_info_get_default_for_type (const char  *content_type,
                                           gboolean     must_support_uris);

Clearly these could all go into a helper function:

GAppInfo *g_file_get_default_handler (GFile *file, 
                                      GCancellable, *cancellable, 
                                      GError **error)

Patches accepted.

Then you can launch the GAppInfo using g_app_info_launch(). 

For certain features (startup notification, starting on right screen)
you can also pass in a GAppLaunchContext implementation. This is a bit
tricky atm, but in the future such an implementation will be availible
in Gtk+ for simple use.


_______________________________________________
gnome-vfs-list mailing list
gnome-vfs-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gnome-vfs-list

Reply via email to