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 642797 - g_app_info_get_default_for_type() broken for subtypes
g_app_info_get_default_for_type() broken for subtypes
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-02-20 09:48 UTC by Vincent Untz
Modified: 2011-02-20 15:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
appinfo: Do not override system default handler with less specific one (1.92 KB, patch)
2011-02-20 09:48 UTC, Vincent Untz
committed Details | Review

Description Vincent Untz 2011-02-20 09:48:27 UTC
Here's my mimeapps.list (well, the relevant part):

[Added Associations]
text/x-patch=gvim.desktop;
text/plain=gvim.desktop;

[Default Applications]
application/xml=gvim.desktop
text/plain=gvim.desktop

Now, if I double-click an opendocument file, it will open in vim instead of libreoffice. That's obviously wrong.

I believe this got introduced in 678bcad92c2a6350cd5dbf4ea3a567d99cf4c29d.

Here's a patch to fix this.
Comment 1 Vincent Untz 2011-02-20 09:48:30 UTC
Created attachment 181387 [details] [review]
appinfo: Do not override system default handler with less specific one

We were considering explicitly configured defaults for parent types
after we already got results for the specific type we're interested in.

This resulted in the explicit default for text/plain to override all
system defaults for subtypes of text/plain, for example. The explicit
default should not apply to subtypes that have a system default.
Comment 2 Matthias Clasen 2011-02-20 14:21:13 UTC
Makes sense to me; if the mime system had a spec somewhere, this should be documented...
Comment 3 Matthias Clasen 2011-02-20 14:27:50 UTC
Review of attachment 181387 [details] [review]:

::: gio/gdesktopappinfo.c
@@ +3061,3 @@
 
+          /* Pick the explicit default application if we got no result earlier
+           * (ie, for more specific mime types) */

Pet peeve of mine: for multiline comments, move the closing */ to the beginning of the next line to line up the stars...
Comment 4 Matthias Clasen 2011-02-20 14:35:10 UTC
I guess I should ask cosimo to write up a description of the defaults.list / mimeapps.list system we are using...
Comment 5 Vincent Untz 2011-02-20 15:07:08 UTC
Pushed with the fix for the comment.