Mac OS X gnome_vfs_url_show Patch




Greetings,

I have hacked libgnome to support URLs with the additional ability to open local and remote files in the users preferred native Mac OS X application and directories in the Finder.

This enables a user in Gnumeric for instance to link any local files and directories with the Hyperlink command along with most remote files and directories supporting such protocols as HTTP/HTTPS, FTP, SMB/CIFS (Samba), AFP (apple file sharing) and so on.

I am not sure if there are additional areas that could benefit from similar hacks, if so please let me know.

The patch below is crude in that it has been done at the post config level. I have tested it pretty extensively with Mac OS X 10.3.4 and 10.3.5 and it works great.

diff -Naur libgnome-2.6.0-old/libgnome/gnome-url.c libgnome-2.6.0-new/libgnome/gnome-url.c
--- libgnome-2.6.0-old/libgnome/gnome-url.c	Fri Apr 25 05:20:12 2003
+++ libgnome-2.6.0-new/libgnome/gnome-url.c	Fri Aug 13 14:03:26 2004
@@ -65,10 +65,45 @@
 {
 	GnomeVFSResult result;

+/*
+*     A hack by Jeshua Lacock; OpenOSX; 8.12.2004
+* On Mac OS X (Darwin), the open command opens a file (or a directory or URL), just as +* if you had double-clicked the file's icon. If no application name is specified, the +* default application as determined via LaunchServices is used to open the
+*     specified files.
+*
+* If the file is in the form of a URL, the file will be opened as a URL.
+*
+* 'open' returns -1 if unsuccessful, or the pid of the resulting process
+*     on Mac OS X (Darwin) `man open` or:
+* http://developer.apple.com/documentation/Darwin/Reference/ManPages/ html/open.1.html
+*
+* If the file is in the form of a URL, the file will be opened as a URL.
+*/
+        char launchCommand[256] = "open ";
+        int openResults = 0;
+        //OpenOSX Note: now use open in place of launchURL
+
 	g_return_val_if_fail (url != NULL, FALSE);

-	result = gnome_vfs_url_show_with_env (url, envp);
-	
+        /*result = gnome_vfs_url_show_with_env (url, envp);*/
+
+
+        strcat (launchCommand, url);
+        openResults = gnome_execute_shell ("/usr/bin", launchCommand);
+
+        if (openResults > 0) {
+                return TRUE;
+        }
+        else {
+                g_set_error (error,
+                        GNOME_URL_ERROR,
+                        GNOME_URL_ERROR_URL,
+ _("Unknown internal error while displaying this location."));
+
+                return FALSE;
+        }
+
 	switch (result) {
 	case GNOME_VFS_OK:
 		return TRUE;




Jeshua Lacock __________________________
Programmer/Owner            Phone:   415.608.2139
http://OpenOSX.com           Fax:        208.462.4170
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_




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