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 620161 - gtk_show_uri opens http urls in a browser other than the GNOME default.
gtk_show_uri opens http urls in a browser other than the GNOME default.
Status: RESOLVED INVALID
Product: gvfs
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2010-05-31 15:41 UTC by Ken Bloom
Modified: 2010-09-20 16:30 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ken Bloom 2010-05-31 15:41:33 UTC
This is Debian bug #583302 (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=583302)

Evolution is ignoring my preference for default web browser when I
click on links.

default-applications-properties is set to iceweasel,
x-www-browser is set to iceweasel
$BROWSER is set to iceweasel

and yet Evolution chooses chromium-browser instead.

This is in consonance with the contents of /usr/share/applications/mimeinfo.cache and
Evolution runs runs through the applications there in order
text/html=bluefish.desktop;chromium-browser.desktop;kde4-kfmclient_html.desktop;abiword.desktop;iceweasel.desktop;kompozer.desktop;arora.desktop;elinks.desktop;

[bloom@cat-in-the-hat evolution]$ strace -f evolution 2>&1 | grep /usr/share/applications/
[pid  7465] stat("/usr/share/applications/mimeinfo.cache",  <unfinished ...>
[pid  7465] open("/usr/share/applications/mimeinfo.cache", O_RDONLY) = 44
[pid  7465] stat("/usr/share/applications/defaults.list",  <unfinished ...>
[pid  7465] stat("/usr/share/applications/mimeapps.list",  <unfinished ...>
[pid  7465] open("/usr/share/applications/bluefish.desktop", O_RDONLY <unfinished ...>
[pid  7465] open("/usr/share/applications/chromium-browser.desktop", O_RDONLY <unfinished ...>

if I uninstall chromium, it opens the link in konqueror, by calling
kfmclient.

Evolution should use the Gnome default browser to open hyperlinks, rather than opening them by MIME type.
Comment 1 Matthew Barnes 2010-05-31 21:57:35 UTC
We use gtk_show_uri() and GVFS handles the rest.  Not an Evolution issue.
Comment 2 Ken Bloom 2010-06-01 00:43:11 UTC
Well, either Evolution is wrong to call gtk_show_uri(), or gtk_show_uri() is doing the wrong thing. If it's the former, please fix it. If it's the later, please reassign to gtk+.
Comment 3 Ken Bloom 2010-06-02 13:08:47 UTC
I'm reassigning this on the theory that gtk_show_uri() is doing the wrong thing.
Comment 4 Matthias Clasen 2010-06-02 14:43:26 UTC
What does 

 gconftool-2 --get /desktop/gnome/url-handlers/http/command

say ?
Comment 5 Ken Bloom 2010-06-02 15:27:02 UTC
sensible-browser %s
Comment 6 Ken Bloom 2010-06-02 15:56:19 UTC
Just to clarify, sensible-browser is a tool in Debian that runs through several different standard places to select a web browser, and runs the first browser that it finds in these places.

First it looks at $BROWSER (which, as I mentioned, is set to iceweasel)
Then it looks at three alternatives in order:

/usr/bin/gnome-www-browser   which links to /usr/lib/iceweasel/iceweasel
if $DISPLAY and $GNOME_DESKTOP_SESSION_ID are set

/usr/bin/x-www-browser   which links to /usr/lib/iceweasel/iceweasel
if $DISPLAY is set

if these environment variables are not set (or these links are not executable), it runs www-browser (in a terminal window if $DISPLAY is set)
/usr/bin/www-browser     links to /usr/bin/links2

It is also clear from the strace of evolution that sensible-browser is not getting run, rather gtk_show_uri is looking through the mime handlers and picking from there.
Comment 7 Matthias Clasen 2010-06-02 16:38:00 UTC
The call path is

  gtk_show_uri
    g_app_info_launch_default_for_uri
      g_file_query_default_handler
        g_app_info_get_default_for_uri_scheme

Which will use the gconf implementation to look up
/desktop/gnome/url-handlers/http/command
Comment 8 Ken Bloom 2010-06-02 18:22:47 UTC
Testing this in gdb (for the URL https://bugzilla.gnome.org/show_bug.cgi?id=620161) I see that uri_scheme = "http" and  g_app_info_get_default_for_uri_scheme is returning null.
Comment 9 Matthias Clasen 2010-06-02 23:25:42 UTC
What does

gconftool-2 --get /desktop/gnome/url-handlers/http/enabled 

say ? 

the gconf implementation looks at that as well.
Comment 10 Ken Bloom 2010-06-03 00:14:09 UTC
It says "true".
Comment 11 Matthias Clasen 2010-06-03 23:26:36 UTC
No further ideas here. A simple test confirms that this works as expected here.
You could debug into the gconf backend and see whats going on in gapplookupgconf.c:get_default_for_uri_scheme
Comment 12 Matthias Clasen 2010-06-03 23:27:34 UTC
In any case, this is not a GTK+ bug
Comment 13 Ken Bloom 2010-06-04 13:27:19 UTC
What process am I supposed to debug to trace get_default_for_uri_scheme? It looks like the symbol is in /usr/lib/gio/modules/libgiogconf.so, but lsof doesn't tell me that any process has it loaded.
Comment 14 Matthias Clasen 2010-06-04 14:15:52 UTC
In that case, thats likely your problem.

do you have a /usr/lib/gio/modules/giomodule.cache ?

if so, what does it contain ?
Comment 15 Ken Bloom 2010-06-04 14:32:16 UTC
It appears the real problem is that I really want to get appropriate default browser behavior without running gnome-session (or at least running a highly customized list of stuff from my .xsession and not running all of the gnome graphical stuff.)

If I run gnome-session, and then start evolution from the panel, things work. If I run gnome-session, and then start evolution from a pre-existing termianl, things don't work.

Is it really true that gnome-session provides this information to the programs that need it? Is there any way I can make the default browser behavior work without having to throw away my highly customized desktop setup?
Comment 16 Matthias Clasen 2010-06-04 14:34:18 UTC
oh, sorry, I don't really have the bandwidth to debug handrolled session setups right now
Comment 17 Ken Bloom 2010-06-04 14:39:34 UTC
Sorry to wast your time. Any tips where to look for more information?
Comment 18 Bastien Nocera 2010-06-04 18:36:16 UTC
GNOME_DESKTOP_SESSION_ID will obviously not be set in the environment if you don't start the mailer from a child of gnome-session. That's how environment variables work.
Comment 19 Ken Bloom 2010-09-20 16:30:58 UTC
For those who want to use the GNOME default web browser to visit URIs in GTK+ applications, but do not want to run a full GNOME session yourself, the workaround is to set the environment variable GIO_USE_URI_ASSOCIATION=gconf. (I discovered this by reading http://library.gnome.org/devel/gio/stable/ch03.html and experimenting a bit).

I'm sure the procedure for using the XFCE4 default web browser is similar, but I don't know the name of the GDesktopAppInfoLookup implementation to use.