Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 449958 - media-gfx/gimp-2.8.2 should not set application/pdf filetype in .desktop file
Summary: media-gfx/gimp-2.8.2 should not set application/pdf filetype in .desktop file
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sebastian Pipping
URL:
Whiteboard:
Keywords:
: 458594 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-01-03 09:33 UTC by Cedric Sodhi
Modified: 2013-02-21 15:53 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Tool to list installed applications supporting the given MIME type (mimetest.c,1.10 KB, text/plain)
2013-01-06 16:34 UTC, Sebastian Pipping
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cedric Sodhi 2013-01-03 09:33:06 UTC
Gimp is installed with an entry for application/pdf in /usr/share/applications/zzz-gimp.desktop. This consequently overrides the (sensible) bindings from any PDF reader.

While one could argue that this misbehaviour is intrinsic to the insufficiently designed XDG specs, it would surely be reasonable to purge Gimp's binding to PDF for it's primarily not a PDF reader, whatsoever.
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2013-01-03 09:44:48 UTC
How is this a problem? If you have only GIMP installed and nothing else that wants to open PDFs, then this should be fine. If you have a preferred alternative, then your "desktop environment" should offer a choice between applications to open the PDF file with, and perhaps an option to select a default, or do nothing at all and fail gracefully. The GIMP desktop file is merely stating what it can do, not what the desktop environment should do.
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2013-01-04 17:30:22 UTC
Actually, on closer inspection I have to agree. Sure, gimp can import PDF files, but it complains about an unknown file type when you run `gimp /path/to/file.pdf'.
Comment 3 Sebastian Pipping gentoo-dev 2013-01-04 23:06:04 UTC
(In reply to comment #2)
> Actually, on closer inspection I have to agree. Sure, gimp can import PDF
> files, but it complains about an unknown file type when you run `gimp
> /path/to/file.pdf'.

Works fine over here, could it be you have Gimp installed with USE=-pdf or so?

The reason we currently rename gimp.desktop to zzz-gimp.desktop is because other desktop environments (e.g. XFCE) collect MIME types and run the first app based on matching .desktop files sorted alphabetically.  So zzz-gimp.desktop is meant to go very last and not ever hit while you have other apps supporting PDF around.

If your desktop takes the last (rather than the first) match, we're in trouble I guess.  What's your desktop environment?
Comment 4 Cedric Sodhi 2013-01-05 11:00:22 UTC
Jeroen, I agree with Sebastian, you're probably lacking PDF support in GIMP. That said, I agree with your original closing the bug as invalid. My thought on this is that XDG has no specification on how precedence should be handled (unfortunally). That said, everything concerning precedence is implementation specific (and up to a DE to unify consistently).

The .desktop files only specify which filetypes a application may open (if yours specify PDF whereas GIMP cannot handles those, that's surely a bug).

Sebastian, I don't use any DE, without which GAppInfo [1] seems to decided to use the last entry (zzz...).

[1] http://developer.gnome.org/gio/2.32/GAppInfo.html
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2013-01-05 16:42:59 UTC
(In reply to comment #4)
> Jeroen, I agree with Sebastian, you're probably lacking PDF support in GIMP.

No, USE=pdf.
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2013-01-05 16:46:53 UTC
There was something wrong with the PDF file I tested with. Sorry for any disturbance this may have caused. I'd still go with INVALID.
Comment 7 Sebastian Pipping gentoo-dev 2013-01-06 16:34:42 UTC
Created attachment 334676 [details]
Tool to list installed applications supporting the given MIME type

(In reply to comment #6)
> There was something wrong with the PDF file I tested with.

Thanks for clearing that up.


(In reply to comment #4)
> Sebastian, I don't use any DE, without which GAppInfo [1] seems to decided
> to use the last entry (zzz...).
> 
> [1] http://developer.gnome.org/gio/2.32/GAppInfo.html

To my understanding, the function g_app_info_get_recommended_for_type returns the list of supporting applications in alphabetically ascending order, except with some selected applications moved to the very beginning (which calls to function g_app_info_set_as_last_used_for_type seem to be causing).

I have written a small C program to list the list of supporting applications.  the code is attached.  Link and run it with:

  $ gcc -Wall -Wextra -o mimetest mimetest.c \
        $(pkg-config --cflags gio-2.0) \
        $(pkg-config --libs gio-2.0)
  $ ./mimetest application/pdf

For me, the out is this:

   Applications supporting MIME type "application/pdf":
   [1]
     id = "kde4-okularApplication_pdf.desktop"
     name = "Okular"
     command line = "okular %U %i -caption "%c""

   [2]
     id = "evince.desktop"
     name = "Document Viewer"
     command line = "evince %U"

   [3]
     id = "inkscape.desktop"
     name = "Inkscape"
     command line = "inkscape %F"

   [4]
     id = "zzz-gimp.desktop"
     name = "GNU Image Manipulation Program"
     command line = "gimp-2.8 %U"

Okular goind first is a bit odd.  I suppose the sub folder is due to that:

  /usr/share/applications/kde4/okularApplication_pdf.desktop
  /usr/share/applications/evince.desktop
  /usr/share/applications/inkscape.desktop
  /usr/share/applications/zzz-gimp.desktop


Now if I make sure this content

  [Added Associations]  
  application/pdf=inkscape.desktop;zzz-gimp.desktop;

is in file ~/.local/share/applications/mimeapps.list the output changes to

  Applications supporting MIME type "application/pdf":
  [1]
    id = "inkscape.desktop"
    name = "Inkscape"
    command line = "inkscape %F"

  [2]
    id = "zzz-gimp.desktop"
    name = "GNU Image Manipulation Program"
    command line = "gimp-2.8 %U"

  [3]
    id = "kde4-okularApplication_pdf.desktop"
    name = "Okular"
    command line = "okular %U %i -caption "%c""

  [4]
    id = "evince.desktop"
    name = "Document Viewer"
    command line = "evince %U"

so my custom entries go first in specified order followed by the remaining apps in original order.

Cedric, could you try the attached code and check the content of ~/.local/share/applications/mimeapps.list for any clues?
Comment 8 Sebastian Pipping gentoo-dev 2013-02-14 21:17:58 UTC
(In reply to comment #7)
> Cedric, could you try the attached code and check the content of
> ~/.local/share/applications/mimeapps.list for any clues?

Closing as NEEDINFO after a month of no reply.  Please re-open as needed.
Comment 9 Cedric Sodhi 2013-02-14 21:34:47 UTC
Sebastian, excuse my not replying. I did not take notice of your response.

mimeapps.list (or in my version of glib 2.32 defaults.list) works well and properly establishes a precedence among the installed applications which are capabable of opening a specific mimetype.
Comment 10 Jeroen Roovers (RETIRED) gentoo-dev 2013-02-21 15:53:22 UTC
*** Bug 458594 has been marked as a duplicate of this bug. ***