Featured Sections
Linux is one of the few remaining upgrade paths for the Jornada series of Handheld computers.  One of many popular operating systems, favoured for servers but becoming popular for desktops.

Sections

Latest Updates

Search

SoftMaker File Associations and Icons on Ubuntu
2007-12-26 10:42:44

SoftMaker Office has a native version for Linux, but unfortunately it lacks an installer and by default does not create any file associations for its TMD and PMD formats. This guide explains how to do this (it may also be a useful source of reference for creating other file associations on Ubuntu).

This guide explains how to configure:

It is recommended that you have some experience in using the terminal and editing configuration files before proceeding. It is also advisable that you peform a backup before proceeding. This method worked when tested on Ubuntu 7.10, but it may not be the best method.

This guide assumes that Softmaker Office 2006 is installed in /opt/office

Step 1: Creating a mime-type
The first step is to create a "mime-type" which will be used to allow Ubuntu to recognize the TMD/PMD formats, based upon the file extension. To begin, open a command terminal and execute the following command:

Code:
sudo gedit /etc/mime.types

Now, append the following lines to the file and save it:

Code:
application/tmd.textmaker tmd
application/pmd.planmaker pmd

Step 2: Defining the mime-type
Next we need to give Ubuntu a way to decide if files are of the Softmaker file-types. To do this we create /usr/share/mime/packages/sm.xml:

Code:
sudo gedit /usr/share/mime/packages/sm.xml

Enter the following into the file:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/tmd.textmaker">
<comment>TextMaker Document</comment>
<glob pattern="*.tmd"/>
</mime-type>
<mime-type type="application/pmd.planmaker">
<comment>PlanMaker Document</comment>
<glob pattern="*.pmd"/>
</mime-type>

Save and close the file. Now, to make the above take effect run the following in the terminal:

Code:
sudo update-mime-database /usr/share/mime

Step 3: Assigning file icons
This step is fairly simple - just copy the Textmaker and Planmaker icons into the "mimetypes" folder of the theme you are using (or just copy them into the Gnome theme, which most other themes inherit). The new file will need to be called "gnome-mime-application-<mimetype goes here>.png"

Code:
sudo cp /opt/office/icons/tml_48.png /usr/share/icons/gnome/48x48/mimetypes/gnome-mime-application-tmd.textmaker.png
sudo cp /opt/office/icons/tml_32.png /usr/share/icons/gnome/32x32/mimetypes/gnome-mime-application-tmd.textmaker.png
sudo cp /opt/office/icons/tml_32.png /usr/share/icons/gnome/24x24/mimetypes/gnome-mime-application-tmd.textmaker.png
sudo cp /opt/office/icons/pml_48.png /usr/share/icons/gnome/48x48/mimetypes/gnome-mime-application-pmd.planmaker.png
sudo cp /opt/office/icons/pml_32.png /usr/share/icons/gnome/32x32/mimetypes/gnome-mime-application-pmd.planmaker.png
sudo cp /opt/office/icons/pml_32.png /usr/share/icons/gnome/24x24/mimetypes/gnome-mime-application-pmd.planmaker.png

To make the above icons display simply run the following in terminal:

Code:
cd /usr/share/icons
sudo gtk-update-icon-cache --force gnome

Step 4: Creating a .desktop (menu entry)
We now need to create a .desktop file. This creates an entry in the Gnome menu and also is used when we create the default "open with" command in Step 5.

Code:
sudo gedit /usr/share/applications/tm.desktop

Now, enter the following into gedit and save the file.

Code:
[Desktop Entry]
Encoding=UTF-8
Name=TextMaker
Type=Application
MimeType=application/tmd.textmaker
Comment=SoftMaker Word Processor
Exec=/opt/office/textmaker
Icon=/opt/office/icons/tml_48.png
Categories=GNOME;GTK;Office;
Terminal=false

And the same for Planmaker:

Code:
sudo gedit /usr/share/applications/pm.desktop

And Planmakers desktop entry:

Code:
[Desktop Entry]
Encoding=UTF-8
Name=PlanMaker
Type=Application
MimeType=application/pmd.planmaker
Comment=SoftMaker Spreadsheet
Exec=/opt/office/planmaker
Icon=/opt/office/icons/pml_48.png
Categories=GNOME;GTK;Office;
Terminal=false

The Gnome menu should now show Textmaker and Planmaker under the Office submenu.

Step 5: Setting the default "Open-with" actions
The step simply tells Ubuntu to use the above entrys to launch TMD/PMD documents. To start, run the following:

Code:
sudo gedit /usr/share/applications/defaults.list

And add the following to the end of the file:

Code:
application/tmd.textmaker=tm.desktop
application/pmd.planmaker=pm.desktop

Now, restart your computer to make the changes take effect. You may be able to make the settings take effect by running the following:

Code:
sudo update-desktop-database -q /usr/share/applications

Finished
If everything went well you should now have .tmd documents associated with Textmaker and showing the Textmaker icon, and the same for .pmd documents with Planmaker.


Copyright © CHAZCO