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 669936 - gio does not return the default application chosen by the user
gio does not return the default application chosen by the user
Product: glib
Classification: Platform
Component: gio
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
Depends on:
Reported: 2012-02-12 18:32 UTC by Luc Menut
Modified: 2012-11-09 14:39 UTC
See Also:
GNOME target: ---
GNOME version: ---

Description Luc Menut 2012-02-12 18:32:20 UTC
When I use Firefox (build with --enable-gio) or Epipĥany with KDE4, they don't use the default application I chosen.
eg. if I choose to use okular to view pdf files in KDE4 systemsettings,
firefox, thunderbird or epiphany still uses evince by default to read pdf.
This is working fine with gio 2.28.6 (Mageia 1: Firefox 10.0.1 & gio 2.28.6).
This isn't working with gio 2.31.16 (current Mageia Cauldron), and gio 2.30.1 (OpenSuse 12.1 KDE4 LiveCD).
As it's working fine with previous release, I think it's a regression with recent release of gio library.
cat ~/.local/share/applications/mimeapps.list
[Added Associations]

[Removed Associations]
with this mimeapps.list, Firefox propose to read pdf files with evince when using gio 2.31.16 or 2.30.1, which is wrong.

cf. mime-actions-spec specifications
"User-specified application ordering

Users can change the default order of applications by writing (using graphical tools, of course) into the file ~/.local/share/applications/mimeapps.list

The syntax of this file is:
[Added Associations]
[Removed Associations]

This means that foo1 is the preferred application for mimetype1, but if it is not installed then foo2 is going to be used, etc. "
Comment 1 Psy[H[] 2012-11-07 17:15:42 UTC
I confirm this.
I actually wanted to report similar issue with thunar, which uses gio as a backend. mime-actions-spec specification is not honored in gio.
If you choose an default application for some file via Thunar, it will be written to the end of the list, instead of the beginning as the spec suggests.

I was redirected here from xfce bug tracker
My original report is here:
Comment 2 Matthias Clasen 2012-11-07 22:10:58 UTC
Try gvfs-mime --query application/pdf

Here is what I see:

$ gvfs-mime --query application/pdf
Default application for 'application/pdf': evince.desktop
Registered applications:
Recommended applications:

The Default application line is what causes firefox to choose evince.
Changing the order in the Added Associations line for application/pdf doesn't change that. What helps is to add

[Default Applications]

to ~/.local/share/applications/mimeapps.list
Comment 3 Psy[H[] 2012-11-08 03:22:51 UTC
[Default Applications] is not in the mime-action-spec, it should not exist in mimeapps.list
Comment 4 Matthias Clasen 2012-11-09 14:26:23 UTC
It definitively was discussed on the list. Quite possible that it hasn't made it back into the written spec. But that is not a GLib bug.
Comment 5 Psy[H[] 2012-11-09 14:39:05 UTC
Could you point me to the discussion, please?