[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: open with for TeX documents



Hi,

On 5/9/05, Enver ALTIN <ealtin@parkyeri.com> wrote:
> Hey,
> 
> On Mon, 2005-05-09 at 14:41 +0300, Vaidotas Zemlys wrote:
> > So against what packages should I file the bug to solve these
> > problems:
> 
> That package is called shared-mime-info and it's developed by fellow
> hackers at FreeDesktop.org. If I were you, I would go upstream and learn
> more about the issue.
> 

I read the documentation and found this at
http://freedesktop.org/wiki/Standards_2fmime_2dactions_2dspec
<..skipped>
The extension element associates MIME entries with application
.desktop files (eg, gimp.desktop). Issues to address:
1. Must provide a way to find a command to execute to view/edit/etc a file.
2. There should be support for multiple actions (view, edit, print, etc).
3. There must be some kind of priority system (Vim can view HTML, but
should not be the default if a web browser is installed).
4. Internationalised descriptions of applications should not be
repeated (Gimp should not have to specify translations of "Edit in
Gimp" for every MIME type it supports).

The problem I was facing was mainly issue 3, coupled with other issues. 

TeX documents have mimetype text/x-tex which is declared as a subclass
of mimetype text/plain in
/usr/share/mime/packages/freedesktop.org.xml. This means that all the
programs which declare that they can open text/plain document in their
.desktop files placed in /usr/share/applications appears in the open
with list. This is the case for all the programs I mentioned: Kate,
Kwrite, Leafpad, Abiword, Screem, OpenOffice.org Writer, Emacs21,
Mousepad and Gedit. So I removed text/plain from line

MimeType= 

in the files abiword.desktop, screem.desktop and ooo645writer.desktop
and ran update-desktop-database. That solved the problem of appearance
of inapropriate applications in open with application list for text
documents. Yet still all the remaining programs were appearing int
list for tex documents, since like I've said text/x-tex is declared as
a subclass of mimetype text/plain. So I removed line

<sub-class-of type="text/plain"/> 

from text/x-tex mimetype declaration in
/usr/share/mime/packages/freedesktop.org.xml and ran

update-mime-database /usr/share/mime

as root. This resulted in empty open with list for tex documents. So
it was still the problem, since Kile should appear in this list, if it
is installed. It turned out that this was Kile bug. The file
kile.desktop had line [KDE Desktop Entry] instead of [Desktop Entry],
and it was ignored by update-desktop-database. After fixing it and
running update-desktop-database, Kile finally appeared in open with
program list for text documents.

So if you want that only certain applications should appear in open
with list for certain document. You must make certain that:
1. The application has its .desktop file in /usr/share/applications/
and it lists the mimetype of your document in MimeType line.
2. Unwanted applications does not list the mimetype of your document
in their .desktop file.
3. Your document mimetype is not a subclass of other mimetype, which
is listed in unwanted applications' .desktop files.
4. You ran update-desktop-database after .desktop file change, and
update-mime-database /usr/share/mime after mimetype description
change.

Then in open with list you will have only the appropriate applications. 

It is a partial solution though, since you must be root to do these
changes and you must muck with application's .desktop files and
mimetypes description. Your changes could probably contradict to
upstream's decision. Seeing the syntax of .desktop file I think, that
the issue 3 is not completely solved yet. My solution was based on
text/html mimetype description. It is not subclass of text/plain, so
only browsers appear in html document  open with list.

I filed a bug against kile. Should I file a bug against abiword,
screem and OpenOffice.org? Probably not, since in the worst case
scenario when for example abiword is the only program capable of
editing documents, you will not see any programs  in the open with
list for text documents, when cleary you can use abiword for that.

Vaidotas Zemlys



Reply to: