-->

Previous | Table of Contents | Next

Page 87

Next, edit mymail.fp using a text editor. Remove all the lines in the file except for the following, which start at approximately line 94:


CONTROL Mail

{

  TYPE                  icon

  CONTAINER_NAME        Top

  CONTAINER_TYPE        BOX

  POSITION_HINTS        5

  ICON                  DtMail

  LABEL                 Mail

  ALTERNATE_ICON        DtMnew

  MONITOR_TYPE          mail

  DROP_ACTION           Dtmail

  PUSH_ACTION           Dtmail

  PUSH_RECALL           true

  CLIENT_NAME           dtmail

  HELP_TOPIC            FPOnItemMail

  HELP_VOLUME           FPanel

}

This the default description for the Mail control. As you can see, there are a lot of configuration options available for a control. (See the dtfpfile manual page for a complete description.) In order to remove this control, you need to specify its name, its type, and the fact that you want it deleted in a file that will be read prior to /usr/dt/appconfig/types/C/dtwm.fp. You can actually cut the entry down to the following and place in it mymail.fp:


CONTROL Mail

{

  CONTAINER_NAME        Top

  CONTAINER_TYPE        BOX

  DELETE                True

}

Save the file and restart the Workspace Manager, either by logging out and in again or by selecting Restart Workspace Manager from the root menu. As the CDE reinitializes, it will process the DELETE directive in your home directory and omit the Mail control.

However, the Front Panel looks a little strange now, so rather than omit the Mail icon completely, replace it with your preferred mail reader. You'll use elm for the sake of this exercise. Before you can add this to the Front Panel, you have to detour to the Application Manager and create a new action.

Creating New Actions

The CDE supplies a tool, Create Action, that is intended for, logically enough, creating actions. After an action is defined, it can be installed as an icon on the desktop, the Front Panel, or a subpanel. (Or all of them, if you wish.)

The Create Action tool is located in the Desktop_Apps section of the Application Manager. To start it, launch the Application Manager from the Front Panel, double-click the Desktop_Apps icon, and then double-click the Create Action icon.

Page 88

TIP
If you don't use elm to read mail but want to complete this exercise, you can either replace elm with the name of your mail reader or complete the exercise and answer No when elm asks you whether it should create folders. Running elm like this has no permanent effect on your configuration. If you use an X Window_based mail reader, select a window type of Graphical.

In the Create Action dialog box, shown in Figure 6.5, you simply need to specify an action name; use Read Mail in the top text box and elm for the command to run. Also, select a window type of Terminal (Auto-Close). After these fields are filled in, select Save from the File menu.


Figure 6.5.
The Create Action
dialog box.


Now you have an icon called Read Mail in the root directory of Application Manager. If you want to, you can move this icon to another part of the directory tree. You also now have a desktop configuration file named $HOME/.dt/types/Read_Mail.dt that is read in as part of the Front Panel initialization process, creating an action Read_Mail that can be specified in CONTROL definitions.

Page 89

Creating Controls

With this new action, you can now create a completely new control:


CONTROL MyOwnMail

{

  TYPE                  icon

  CONTAINER_NAME        Top

  CONTAINER_TYPE        BOX

  POSITION_HINTS        5

  ICON                  DtMail

  LABEL                 Mail

  ALTERNATE_ICON        DtMnew

  MONITOR_TYPE          mail

  PUSH_ACTION           Dtmail

  PUSH_RECALL           true

}

Place this in a file named myownmail.fp in the $HOME/.dt/types directory and restart the Workspace Manager. The Mail icon has returned and will launch elm in a dtterm window if clicked. When elm exits, the window closes because you selected an Auto-Close terminal in the Create Action dialog earlier.

This configuration contains a few fewer lines than the original Mail control. You removed the HELP_TOPIC and HELP_VOLUME directives because they are solely concerned with the help topics included for the desktop mail tool. You also removed the DROP_ACTION because elm is not prepared to handle drag-and-drop operations. However, you did retain the MONITOR_TYPE and ALTERNATE_ICONS directive because they will work together to notify you when new mail has arrived by changing the Front Panel icon. See the manual pages dtfpfile and dtdtfile for more details on component options.

Modifying Controls

Now that you have successfully created a new control, you can do it the easy way. Creating a completely new MyOwnMail control is not necessary.

Move myownmail.fp to mymail.fp. (It's important to actually move the file because if myownmail.fp still exists at the end of the exercise, you'll have two mail icons!)

Modify the file so that it reads this way:


CONTROL Mail

{

  TYPE                  icon

  CONTAINER_NAME        Top

  CONTAINER_TYPE        BOX

  POSITION_HINTS        5

  ICON                  DtMail

  LABEL                 Mail

  ALTERNATE_ICON        DtMnew

  MONITOR_TYPE          mail

  PUSH_ACTION           Dtmail

  PUSH_RECALL           true

}

Page 90

When the desktop is restarted, the Front Panel remains the same. Because you specified a control name of Mail in your personal configuration, which is read in first, it overrode the default mail control.

Creating and Modifying Subpanels

Earlier you used the mouse to create new subpanels and add icons to them. When you make changes this way, they are added to the fp_dynamic subdirectory of $HOME/.dt/types. Do not edit these files by hand in order to make changes and additions to subpanels.

Creating Subpanels

A SUBPANEL definition looks very much like that of a CONTROL:


SUBPANEL Games

{

  CONTAINER_NAME        Date

  TITLE                 Games

}

This creates a subpanel named Games and places it above the Calendar control because the control name for Calendar is Date in the default configuration. The new panel has a single control for the calendar, which is created automatically by the Workspace Manager.

Now create an action called Spider, using the Create Action tool in the Application Manager. Then create a file in $HOME/.dt/types named Spider.fp that contains the following (a quick way would be to copy mymail.fp and edit it):


CONTROL Spider

{

  CONTAINER_NAME        Games

  CONTAINER_TYPE        SUBPANEL

  LABEL                 Spider

  ICON                  redhat_folder

  PUSH_ACTION           Spider

  PUSH_RECALL           true

}

When the desktop is restarted, a Red Hat icon appears in the Games subpanel. When it is clicked, the solitaire application Spider starts.

Modifying Subpanels

Like default controls, default subpanels can be modified.

To remove the Install Icon control, add


CONTROL_INSTALL False

To add a control to a subpanel, specify the subpanel as the container. For example, the following, when placed in an .fp file in the $HOME/.dt/types directory, will add a handy manual page control to the Help subpanel:

Previous | Table of Contents | Next