Results 1 to 3 of 3

Thread: GNOME - Register Application with MIME Type

  1. #1
    Join Date
    Jan 2007
    Beans
    26

    GNOME - Register Application with MIME Type

    I'm trying to create a .deb package for a programme I'm developing called OpenFracas, and I would like to be able to have it create a new MIME type upon installation, and then to register that application with GNOME so that nautilus automatically opens files of that type with this application.

    I've been reading through the GNOME docs that I found here:
    http://www.gnome.org/~shaunm/admin-g...metypes-9.html
    and I've been able to create the new MIME type, by placing this file in /usr/share/mime/packages/openfracas.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
       <mime-type type="text/fracas-map">
         <comment>Fracas2 map</comment>
         <glob pattern="*.map"/>
       </mime-type>
    </mime-info>
    And .mime and .keys files in /usr/share/mime-info/
    .mime:
    Code:
    text/fracas-map
    	ext: map
    .keys:
    Code:
    text/fracas-map:
    	description=fracas map
    	default_action_type=application
    	short_list_application_ids_for_novice_user_level=openfracas
    	category=Documents/Data

    Nautilus now shows the correct MIME Type for these files, but I cannot get it to open files of this type with the desired application. I have also created a .desktop file in /usr/share/applications and a .applications file in /usr/share/application-registry/

    .desktop:
    Code:
    [Desktop Entry]
    Encoding=UTF-8
    Name=OpenFracas
    Comment=A strategy game of tactical combat and world conquest
    Exec=openfracas %f
    Icon=/usr/share/games/openfracas/Misc/icon.png
    Terminal=false
    Type=Application
    Categories=GNOME;GTK;Game;ArcadeGame;
    StartupNotify=true
    MimeType=text/fracas-map;
    X-Ubuntu-Gettext-Domain=gnome-games
    .applications
    Code:
    openfracas
    	command=openfracas
    	name=OpenFracas
    	can_open_multiple_files=false
    	expects_uris=false
    	requires_terminal=false
    	mime_types=text/fracas-map
    But nautilus still says "No application is known for this kind of file."

    Am I missing a step somewhere, or have I gotten something wrong in my configuration files? I'd appreciate any help anyone can offer.

    Thanks.

  2. #2
    Join Date
    Jun 2006
    Location
    Gwangju, Korea
    Beans
    3,479

    Re: GNOME - Register Application with MIME Type

    I don't know about your actual problem, but I think that the extension .map is likely to collide with other filetypes with the same extension. It's too generic.

    I'm pretty sure that Nautilus determines mimetype by examining magic numbers, not extensions. My evidence is that a .php file beginning with <?php is identified as a PHP file, but one beginning with HTML code is identified as HTML, despite the extension.

    So it might pay to examine how to add your data to the mime magic file. If the file command gives proper info, my guess is that Nautilus will start to behave with your other settings.

  3. #3
    Join Date
    Jan 2007
    Beans
    26

    Re: GNOME - Register Application with MIME Type

    Thanks for the tip. I actually just solved the problem, I wasn't calling `update-desktop-database` as root, so it wasn't regenerating the mimeinfo.cache file in /usr/share/applications

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •