How does GTK register URI handlers?

3

I use Google Chrome on my Debian laptop, but at one point I had Firefox installed. Now I'm developing a GTK application, and when I click on a link, it outputs this:

(charry.phpw:6267): Gtk-WARNING **: Unable to show 'http://t.co/nOOjE9u1': Failed to execute child process "/opt/firefox/firefox" (No such file or directory)

I don't understand why it would be calling for Firefox, because I have x-www-browser set to Chrome. Does anyone have insight as to how GTK picks a browser to open hyperlinks?

Now I have to expand this question. I woke up this morning and tried to run this application on my Windows box, but it says:

<php.exe:3360>: Gtk-WARNING **: Unable to show 'http://t.co/tKtwKbAt': No application is registered as handling this file

So how does GTK register URI handlers? No one on the Internet seems to know how to do this...without Gnome, at least.

soren121

Posted 2011-10-09T03:03:21.613

Reputation: 297

Answers

1

GTK uses GVFS, which used to use scheme settings from Gconf (/desktop/gnome/uri-handlers), but has since switched to XDG MIME Actions spec, with preferences kept in ${XDG_DATA_HOME-~/.local/share}/applications.

~/.local/share/applications/mimeapps.list:

[Default Applications]
x-scheme-handler/http=firefox.desktop

The .desktop files are looked for in the subfolder applications of both $XDG_DATA_HOME and every path listed in $XDG_DATA_DIRS.

If mimeapps.list does not exist, defaults.list will be used.


I don't know the answer for Windows (yet), but Process Monitor will be useful in determining the location.

user1686

Posted 2011-10-09T03:03:21.613

Reputation: 283 655