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 159860 - win32 hyperlink problems
win32 hyperlink problems
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Main System
git master
Other Windows
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2004-11-29 15:46 UTC by Dominic Lachowicz
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
src/cut-n-paste-code/goffice/utils/go-file.c (2.16 KB, patch)
2004-12-14 13:33 UTC, Ivan Wong
none Details | Review
go-file.c (2.25 KB, patch)
2004-12-16 18:20 UTC, Ivan Wong
none Details | Review
go-file.c (2.47 KB, patch)
2004-12-17 07:47 UTC, Ivan Wong
accepted-commit_now Details | Review

Description Dominic Lachowicz 2004-11-29 15:46:57 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.
Comment 1 Dominic Lachowicz 2004-11-29 15:47:51 UTC
the email link type doesn't work either. that may necessitate another bug report.
Comment 2 Jody Goldberg 2004-11-29 18:58:24 UTC
It's not impossible that the url and email handlers have not been connected on
win32.
Comment 3 Ivan Wong 2004-12-14 13:33:03 UTC
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
Comment 4 Dominic Lachowicz 2004-12-15 20:36:40 UTC
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)'"
Comment 5 Ivan Wong 2004-12-16 14:46:48 UTC
may I know your value of:

HKEY_CLASSES_ROOT\http\shell\open\command
Comment 6 Dominic Lachowicz 2004-12-16 15:00:19 UTC
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"
Comment 7 Ivan Wong 2004-12-16 17:56:47 UTC
> 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);
Comment 8 Ivan Wong 2004-12-16 18:08:45 UTC
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
Comment 9 Ivan Wong 2004-12-16 18:20:38 UTC
Created attachment 34908 [details] [review]
go-file.c
Comment 10 Ivan Wong 2004-12-16 18:50:26 UTC
To test:

http://www.ivanwong.info/gnumeric/gnumeric-1.4.1-rc3.exe
Comment 11 Jody Goldberg 2004-12-16 19:09:24 UTC
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.
Comment 12 Ivan Wong 2004-12-16 19:37:24 UTC
Ah yes, I missed that `if (i != argc-1)` check. Moreover, is it better to do a -
-argc as well?
Comment 13 Ivan Wong 2004-12-16 19:42:56 UTC
> 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.
Comment 14 Dominic Lachowicz 2004-12-16 20:19:43 UTC
i don't know how you want to properly resolve this issue. i can only say that
rc3 fixed this problem.
Comment 15 Ivan Wong 2004-12-17 07:47:35 UTC
Created attachment 34929 [details] [review]
go-file.c

How about this?
Comment 16 Jody Goldberg 2004-12-17 14:16:41 UTC
Comment on attachment 34929 [details] [review]
go-file.c

Excellent!  It apparently helps to actually know the win32 api.   I'll commit
that now.
Comment 17 Jody Goldberg 2004-12-17 14:17:24 UTC
committed.