Bug 10042 - xdg-mime doesn't check defaults.list correctly
Summary: xdg-mime doesn't check defaults.list correctly
Status: NEW
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: 1.0
Hardware: Other All
: medium normal
Assignee: Portland Bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-20 07:09 UTC by Frederic Crozat
Modified: 2007-06-26 23:20 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
check .desktop file from defaults.list exists (1.26 KB, patch)
2007-02-20 07:12 UTC, Frederic Crozat
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Crozat 2007-02-20 07:09:09 UTC
version 1.0.1 of xdg-mime doesn't check defaults.list correctly :

it searchs for the first .desktop keyfile for a particular mimetype, without checking if this .desktop is available on the system.

The attached patch fixes this issue.

It isn't perfect, since xdg-mime doesn't checks if .desktop if valid (ie if Exec= is pointing to a existing executable file) or if it can be used (ie not in Hidden=true) but it is better.
Comment 1 Frederic Crozat 2007-02-20 07:12:44 UTC
Created attachment 8786 [details] [review]
check .desktop file from defaults.list exists
Comment 2 Waldo Bastian 2007-06-26 23:05:33 UTC
The patch doesn't really improve things because now it will fail telling you about certain applications that are default but that have their *.desktop file installed in a location outside $XDG_DATA_DIRS/applications that's explicitly included in /etc/xorg/menus/applications.menu

The current version at least guarantees that after
    xdg-mime default FOO.desktop mime/type
a following 
    xdg-mime query default mime/type
will always return FOO.desktop

We really need an application like ktradertest that takes the full spec into account, would be nice if gnomevfs had something similar.
Comment 3 Waldo Bastian 2007-06-26 23:20:31 UTC
I propose gnomevfs-default along the lines of:

main(argc, argv)
{
   GnomeVFSMimeApplication *app;
   const char *desktop_id;
   if (!argc)
   {
      printf("Usage: gnomevfs-default <mimetype>\n");
      return 2;
   }
   app = gnome_vfs_mime_get_default_application(argv[1]);
   if (!app) return 1;
   desktop_id = gnome_vfs_mime_application_get_desktop_id(app);
   if (!desktop_id) return 1;
   printf("%s\n", desktop_id);
   return 0;
}



Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.