libgnome r3884 - in trunk: . libgnome



Author: alexl
Date: Tue Mar  3 19:38:37 2009
New Revision: 3884
URL: http://svn.gnome.org/viewvc/libgnome?rev=3884&view=rev

Log:
2009-03-03  Alexander Larsson  <alexl redhat com>

        Bug 561172 â gnome-open fails on local URIs with anchors

        * libgnome/gnome-open.c:
	For URIs, use the passed in URI, not the one from the GFile,
	so that we can properly handle e.g. mailto: and other links
	not supported by GIO.




Modified:
   trunk/ChangeLog
   trunk/libgnome/gnome-open.c

Modified: trunk/libgnome/gnome-open.c
==============================================================================
--- trunk/libgnome/gnome-open.c	(original)
+++ trunk/libgnome/gnome-open.c	Tue Mar  3 19:38:37 2009
@@ -10,6 +10,15 @@
 #include "gnome-program.h"
 #include "gnome-init.h"
 
+static gboolean
+is_file_uri_with_anchor (char *str)
+{
+  if (g_ascii_strncasecmp (str, "file:", 5) == 0 &&
+      strchr (str, '#') != NULL)
+    return TRUE;
+  return FALSE;
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -29,7 +38,12 @@
 		      NULL);
 
   file = g_file_new_for_commandline_arg (argv[1]);
-  uri = g_file_get_uri (file);
+  if (g_file_is_native (file) && !is_file_uri_with_anchor (argv[1]))
+    uri = g_file_get_uri (file);
+  else
+      /* For uris, use the original string, as it might be
+	 modified by passing throught GFile (e.g. mailto: links) */
+    uri = g_strdup (argv[1]);
   g_object_unref (file);
 
   if (g_app_info_launch_default_for_uri (uri, NULL, &err))



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