Re: [Nautilus-list] How to install MIME types under GNOME+Nautilus?



On Sun, 2001-11-18 at 20:32, Jim Knoble wrote:
> Hi.  I'm a developer trying to integrate a non-GNOME app with the GNOME
> desktop, and i'm having a devil of a time finding docs describing how
> to do this.  Much of what i have found appears to be rather out of date.
> 
> By trial-and-error i've come up with the following files to install
> under the mime-info directory:
> 
>   -------- <gnome-prefix>/share/mime-info/my-mime-type.mime --------
> 
>     application/x-myvendor-myapplication
>             ext: myext MYEXT
> 
>   -------- <gnome-prefix>/share/mime-info/my-mime-type.keys --------
> 
>     application/x-myvendor-myapplication:
>             open=myapp %f
>             edit=myapp %f
>             view=myapp %f
>             icon_filename=myapp-icon.png
> 	    description=MyApplication Document
>             default_action_type=application
>             short_list_application_ids_for_novice_user_level=myapp
>             short_list_application_ids_for_intermediate_user_level=myapp
>             short_list_application_ids_for_advanced_user_level=myapp
> 
>   -------- end --------

You probably also want a .application file...for example:

----<prefix>/share/application-registry/mozilla.applications----

mozilla
        command=mozilla
        name=Mozilla
        can_open_multiple_files=true
        expects_uris=true
        requires_terminal=false
        supported_uri_schemes=file,http,ftp,telnet,gopher
     
mime_types=text/html,x-directory/webdav,x-directory/webdav-prefer-directory,image/gif,image/jpeg,text/xml

----- end -----

mime_types should list everything it can handle. short_list_application
is used to determine what actually gets displayed to the user. However,
its much easier for the user to add your app to its "displayed" list if
you've already stated that you support a particular mime type.
"expects_uris" is generally "false" for most apps, and if it is, the
supported_uri_schemes field obviously shouldn't be there.

Can open multiple files determines if Nautilus will allow the program to
be called with "application doc1 doc2 doc3" etc.


>   (1) For the apps listed in 
>       'short_list_application_ids_for_novice_user_level'[*] (and
>       '..._intermediate_...' and '..._advanced_...': Are the
>       "application IDs" paths to binaries, or names of desktop files
>       (e.g., myapp.desktop), or something else?  That is, how do they
>       map to an application?

They are the names of applications in the .applications file.

>   (2) Why don't absolute path names work for icon_filename?  It seems i
>       have to put a copy of an icon into /usr/share/pixmaps/ in order
>       for Nautilus to use it.  I.e., the following does not seem to
>       work:
>       
>         icon_filename=/opt/myapp/share/myapp-icon.png
> 
>       Doesn't seem to work when double-quoted either:
>       
>         icon_filename="/opt/myapp/share/myapp-icon.png"

Because all Nautilus icons are themable. You really shouldn't include
the ".png" either. It should just be icon_filename=myapp-icon. Nautilus
will figure out that there's a PNG in /usr/share/pixmaps that fits.

>   (3) How do i extend a MIME type that may already be defined?  For
>       example, say myapp also reads and writes documents produced by
>       bobsapp (type application/x-bob-bobsapp).  Bobsapp is installed,
>       and hence has already installed a .mime and .keys file.  Is it
>       sufficient for me to install additional .mime and .keys files, or
>       am i supposed to edit or replace files installed by bobsapp?

You don't. We haven't defined the behavior when two entries define the
same MIME type. If you have a new MIME type entry, it should be
integrated into gnome-mime-data (i.e. gnome-vfs). Application entries
should be installed by the application, but we prefer MIME entries to be
in the central database (so even if your app isn't installed we can tell
the user what the heck a file is).

>   (4) Where can i find up-to-date documentation on MIME types and
>       GNOME?  I can't seem to find any useful information on
>       developer.gnome.org or by searching on Google, and i'm becoming
>       rather frustrated.  I really don't have time to waste searching
>       through source code, learning GNOME APIs, or scavenging through
>       Makefiles.  It's hard enough to sift through stuff on
>       developer.gnome.org (i can't even find a search function there!).

Its not documented *grin*

I wrote a small section for the human interface guide, but that's
obviously not the appropriate place for it. I'll integrate it into the
GnomeVFS documentation instead (it'll still be referenced from the
interface guide).

We probably should have a "So you want to write a GNOME application"
document or something ;-)

-Seth





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