Closed
Bug 675466
Opened 13 years ago
Closed 13 years ago
[Linux] Download manager disregards user's configured default handler apps in recent Gnome versions, due to use of deprecated GnomeVFS APIs (instead of GIO)
Categories
(Core Graveyard :: File Handling, defect)
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 713802
People
(Reporter: dholbert, Unassigned)
References
()
Details
(Whiteboard: [workaround in comment 4])
STR: 0. Be running Ubuntu. (I'm on v11.04). Install VLC or another non-default ogg video player. 1. Run "wget http://media.tinyvid.tv/q31g9htvwjdh.ogg " to save that file to your desktop. 2. Right-click on that file, and choose "Properties", and then "Open With" tab, and click the radiobutton for VLC instead of Totem. 3. Now start Firefox. Visit the above URL. Right-click the video and choose "Save As", and save it somewhere. 4. When the download completes, double-click the file *in the download manager.* EXPECTED RESULTS: VLC opens. ACTUAL RESULTS: Totem opens. Digging into this a bit, it appears we end up with this stack after I've chosen "Save As": { #0 nsGnomeVFSService::GetAppForMimeType (this=0x7fbb76cd4560, aMimeType=..., aApp=0x7fffa10252e0) at ../../../../mozilla/toolkit/system/gnome/nsGnomeVFSService.cpp:212 #1 0x00007fbb886a7a1d in nsGNOMERegistry::GetFromType (aMIMEType=...) at ../../../mozilla/uriloader/exthandler/unix/nsGNOMERegistry.cpp:196 #2 0x00007fbb886a8aba in nsMIMEInfoUnix::GetHasDefaultHandler (this=0x7fbb64905dc0, _retval=0x7fffa10256b4) at ../../../mozilla/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp:103 #3 0x00007fbb886a64db in nsOSHelperAppService::GetMIMEInfoFromOS (this=0x7fbb738ac7a0, aType=..., aFileExt=..., aFound=0x7fffa10258bc) at ../../../mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp:1541 #4 0x00007fbb886992b3 in nsExternalHelperAppService::GetFromTypeAndExtension (this=0x7fbb738ac7a0, aMIMEType=..., aFileExt=..., _retval=0x7fffa1025c30) at ../../../mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp:2583 #5 0x00007fbb88692b89 in nsExternalHelperAppService::DoContent (this=0x7fbb738ac7a0, aMimeContentType=..., aRequest=0x7fbb6386a858, aWindowContext=0x7fbb6aea44b0, aForceSave=1, aStreamListener=0x7fffa10260a0) at ../../../mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp:834 } Level 0 in that backtrace is this function: > 203 NS_IMETHODIMP > 204 nsGnomeVFSService::GetAppForMimeType(const nsACString &aMimeType, > 205 nsIGnomeVFSMimeApp** aApp) > 206 { > 207 *aApp = nsnull; > 208 GnomeVFSMimeApplication *app = > 209 gnome_vfs_mime_get_default_application(PromiseFlatCString(aMimeType).get()); > 210 > 211 if (app) { > 212 nsGnomeVFSMimeApp *mozApp = new nsGnomeVFSMimeApp(app); > 213 NS_ENSURE_TRUE(mozApp, NS_ERROR_OUT_OF_MEMORY); > 214 > 215 NS_ADDREF(*aApp = mozApp); > 216 } > 217 > 218 return NS_OK; > 219 } http://mxr.mozilla.org/mozilla-central/source/toolkit/system/gnome/nsGnomeVFSService.cpp#203 ...and "app" returned by gnome_vfs_mime_get_default_application is: $26 = { id = 0x7fbb64b46340 "totem.desktop", name = 0x7fbb64b58170 "Movie Player", command = 0x7fbb64b46440 "totem", can_open_multiple_files = 1, expects_uris = GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS, supported_uri_schemes = 0x7fbb6513e200, requires_terminal = 0, reserved1 = 0x0, priv = 0x7fbb64d06ac0 }
Reporter | ||
Comment 1•13 years ago
|
||
Here's the API documentation for gnome_vfs_mime_get_default_application(): http://developer.gnome.org/gnome-vfs/stable/gnome-vfs-2.0-gnome-vfs-mime-database.html#gnome-vfs-mime-get-default-application Snippets from that documentation: > Query the MIME database for the application to be executed on files of MIME type mime_type by default. > Returns: a GnomeVFSMimeApplication representing the default handler of mime_type. I'm not sure if "default" there means the global default, or if it includes the user's chosen default app. Also -- FWIW, after step 2 of the STR, this appears in ~/.local/share/applications/mimeapps.list : > [Default Applications] > audio/ogg=vlc.desktop
Reporter | ||
Comment 2•13 years ago
|
||
See also this "Ask Ubuntu" (stackexchange) page on this issue: http://askubuntu.com/questions/20015/firefox-application-associations-not-working
Reporter | ||
Comment 3•13 years ago
|
||
Nautilus appears to use "GAppInfo" instead of "GnomeVFSMimeApplication" to represent apps in this case, and it calls "g_app_info_get_default_for_type" to look up the default app. This struct & method appear to be part of GIO as opposed to GnomeVFS (and IIUC, GIO is a replacement for GnomeVFS). Documentation: http://developer.gnome.org/gio/2.26/GAppInfo.html#g-app-info-get-default-for-type Source reference, from nautilus-2.32.2.1/libnautilus-private/nautilus-mime-actions.c (obtained via "apt-get source nautilus"): > GAppInfo * > nautilus_mime_get_default_application_for_file (NautilusFile *file) > { > GAppInfo *app; > char *mime_type; [...] > mime_type = nautilus_file_get_mime_type (file); > app = g_app_info_get_default_for_type (mime_type, !file_has_local_path (file));
Reporter | ||
Comment 4•13 years ago
|
||
(In reply to comment #1) > Also -- FWIW, after step 2 of the STR, this appears in > ~/.local/share/applications/mimeapps.list : > > [Default Applications] > > audio/ogg=vlc.desktop Aha! So GIO apparently uses that file ("mimeapps.list") to store user-configured default apps. However, GnomeVFS expects this file to have a different name -- "defaults.list"[1]. The files appear to have the same format, though, so you can fake out GnomeVFS by providing it with GIO's file, like so: cd .local/share/applications/ ln -s mimeapps.list defaults.list [and then restart Firefox] That effectively works around this bug, at least on my Ubuntu 11.04 system. [1] http://library.gnome.org/admin/system-admin-guide/stable/mimetypes-registering.html.en
Summary: Download manager opens files using OS-default app, regardless of whether user has chosen a different default → [Linux] Download manager disregards user's configured default handler apps in recent Gnome versions, due to use of deprecated GnomeVFS APIs (instead of GIO)
Reporter | ||
Comment 5•13 years ago
|
||
Also, FWIW, you can use the "gnomevfs-info" tool (in package "libgnomevfs2-bin") to see what app GnomeVFS thinks should open a particular file. That tool is just as confused as Firefox after this bug's original STR, and it gets faked out just as effectively as Firefox by the workaround in comment 4.
Whiteboard: [workaround in comment 4]
Reporter | ||
Updated•13 years ago
|
Component: Download Manager → File Handling
Product: Toolkit → Core
QA Contact: download.manager → file-handling
Reporter | ||
Comment 6•13 years ago
|
||
It appears that we do have code to provide GIO support, added in bug 402892. You have to explicitly add a build flag to get it, though. (--enable-gio)
Hardware: x86_64 → All
Comment 7•13 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #6) > It appears that we do have code to provide GIO support, added in bug 402892. > You have to explicitly add a build flag to get it, though. (--enable-gio) Is there any downsides to just make that the default?
Reporter | ||
Comment 8•13 years ago
|
||
I think it doesn't work on old GTK versions. But as those become deprecated / unused, that becomes less of an issue. In any case, it looks like that's covered in bug 713802. Duping to that bug.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
Assignee | ||
Updated•8 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•