Bug 10042

Summary: xdg-mime doesn't check defaults.list correctly
Product: Portland Reporter: Frederic Crozat <fred>
Component: xdg-utilsAssignee: Portland Bugs <portland-bugs>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium    
Version: 1.0   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: check .desktop file from defaults.list exists

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;
}

Comment 4 GitLab Migration User 2019-02-16 13:28:26 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdg-utils/issues/17.

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.