GNOME Bugzilla – Bug 159860
win32 hyperlink problems
Last modified: 2004-12-22 21:47:04 UTC
type "hello" in A1. make a web link to "http://www.abisource.com". click on it. console output: "g_error_new: assertion 'domain != 0' failed." the bigger problem is that the link does not open the web browser to my intended site.
the email link type doesn't work either. that may necessitate another bug report.
It's not impossible that the url and email handlers have not been connected on win32.
Created attachment 34829 [details] [review] src/cut-n-paste-code/goffice/utils/go-file.c The current CVS doesn't work (and compile). This's the fix that I applied in gnumeric-1.4.1-rc1.exe
with rc2 I an error dialog that says: "Invalid Unable to activate the url 'http://www.abisource.com': 'Failed to execute child process (No such file or directory)'"
may I know your value of: HKEY_CLASSES_ROOT\http\shell\open\command
sure - it's: C:\PROGRA~1\MOZILL~1\FIREFOX.EXE -url "%1" this code was originally borrowed from code that i wrote in AbiWord (src/af/xap/win32/xap_Win32AppImp.cpp::openUrl()), which works fine. my guess is that the check_program() call is wholly unecessary (and probably even detrimental) on win32. i bet if you removed that 1 line, things would "just work"
> i bet if you removed that 1 line, things would "just work" No, regardless of the fact that check_program() is detrimental, it does return a "TRUE" for your case. > C:\PROGRA~1\MOZILL~1\FIREFOX.EXE -url "%1" That's the problem. I don' mean your registry value, it's absolutely right. I mean the following statement which doesn't like this command: char *cmd_line = g_strconcat (browser, " %1", NULL); This simply adds one more %1 to the command: C:\PROGRA~1\MOZILL~1\FIREFOX.EXE -url "%1" %1 So I guess it should be: char *cmd_line; if (!strstr (browser, " %1") && !strstr (browser, " \"%1\"")) cmd_line = g_strconcat (browser, " %1", NULL); else cmd_line = g_strdup (browser);
Just found another worth to note behaviour of g_shell_parse_argv(): cmd_line == '"C:\Program Files\Internet Explorer\iexplore.exe" -nohome' : argv[0] = 'C:\Program Files\Internet Explorer\iexplore.exe' cmd_line == 'C:\PROGRA~1\MOZILL~1\FIREFOX.EXE -url "%1"' : argv[0] = 'C:PROGRA~1MOZILL~1FIREFOX.EXE' That means if the filename is not double-quoted: 1. Double-quote it - or - 2. Double-slash it
Created attachment 34908 [details] [review] go-file.c
To test: http://www.ivanwong.info/gnumeric/gnumeric-1.4.1-rc3.exe
Ivan#7 : We ignore the trailing %1 if there is already one there, it gets dropped out. Ivan#8 : the backslashes are the likely root of the problem. I'd guessed that preparsing the line would simplify our lives. Looks like I was wrong. I'm guessing the double slash will be easier that implementing a correct parser.
Ah yes, I missed that `if (i != argc-1)` check. Moreover, is it better to do a - -argc as well?
> I'm guessing the double slash will be easier that implementing a correct parser. um.......In fact, why don't we use ShellExecute() to do the dirty job? I think what we currently do is not healthy - it should be done by Windows.
i don't know how you want to properly resolve this issue. i can only say that rc3 fixed this problem.
Created attachment 34929 [details] [review] go-file.c How about this?
Comment on attachment 34929 [details] [review] go-file.c Excellent! It apparently helps to actually know the win32 api. I'll commit that now.
committed.