After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 676313 - gvfs-open: use g_app_info_launch_default_for_uri()
gvfs-open: use g_app_info_launch_default_for_uri()
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Tomas Bzatek
gvfs-maint
Depends on:
Blocks: 665379
 
 
Reported: 2012-05-18 12:57 UTC by Dan Winship
Modified: 2012-06-25 15:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gvfs-open: use g_app_info_launch_default_for_uri() (3.32 KB, patch)
2012-05-18 12:57 UTC, Dan Winship
committed Details | Review
gvfs-open: Construct full URI for local paths (1.68 KB, patch)
2012-06-22 12:39 UTC, Tomas Bzatek
committed Details | Review

Description Dan Winship 2012-05-18 12:57:42 UTC
noticed while trying to test the fix for bug 666386
Comment 1 Dan Winship 2012-05-18 12:57:44 UTC
Created attachment 214306 [details] [review]
gvfs-open: use g_app_info_launch_default_for_uri()

g_app_info_launch_default_for_uri() didn't exist when gvfs-open was
first written, but now that it does, there's no reason not to use it.
Comment 2 Matthias Clasen 2012-05-19 00:30:19 UTC
Review of attachment 214306 [details] [review]:

Looks good to me
Comment 3 Dan Winship 2012-06-20 14:44:47 UTC
belatedly committed

Attachment 214306 [details] pushed as e8b4b33 - gvfs-open: use g_app_info_launch_default_for_uri()
Comment 4 Tomas Bzatek 2012-06-21 08:35:52 UTC
Was just looking at it yesterday. The g_app_info_launch_default_for_uri() can't handle local paths, i.e. strings that are not valid URIs. Let's deal with it in another commit, reopening for now.
Comment 5 Tomas Bzatek 2012-06-22 12:39:58 UTC
Created attachment 217024 [details] [review]
gvfs-open: Construct full URI for local paths

g_app_info_launch_default_for_uri() can't cope with local paths, which are not valid URIs. To work around this, let's go through GFile and let it construct a file:// URI so we don't regress from previous versions. gvfs-open is heavily  used by xdg-open.
Comment 6 Dan Winship 2012-06-22 15:18:06 UTC
Comment on attachment 217024 [details] [review]
gvfs-open: Construct full URI for local paths

>+	  file = g_file_new_for_commandline_arg (locations[i]);
>+	  res = g_app_info_launch_default_for_uri (g_file_get_uri (file),

You could just call g_filename_to_uri() (which is what GFile will end up doing internally)...
Comment 7 Tomas Bzatek 2012-06-25 13:00:33 UTC
(In reply to comment #6)
> (From update of attachment 217024 [details] [review])
> >+	  file = g_file_new_for_commandline_arg (locations[i]);
> >+	  res = g_app_info_launch_default_for_uri (g_file_get_uri (file),
> 
> You could just call g_filename_to_uri() (which is what GFile will end up doing
> internally)...

Good point, wasn't aware of that function. However brief testing indicates it's not a full replacement, GFile does much more during its construction, such as path canonicalization. Generally g_filename_to_uri() works well with absolute pathnames but can't cope with relative ones (and URIs are always absolute).
Comment 8 Dan Winship 2012-06-25 13:06:30 UTC
ah. yeah, the patch makes sense to me then
Comment 9 Tomas Bzatek 2012-06-25 15:45:16 UTC
Comment on attachment 217024 [details] [review]
gvfs-open: Construct full URI for local paths

(In reply to comment #8)
> ah. yeah, the patch makes sense to me then

Committed to master.

Closing this bugreport, feel free to report any issues caused by these changes.