0087-0090.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 433 行
HTML
433 行
<HTML>
<HEAD>
<TITLE>Developer.com - Online Reference Library - 0672311739:RED HAT LINUX 2ND EDITION:Common Desktop Environment</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311739 //-->
<!-- TITLE=RED HAT LINUX 2ND EDITION //-->
<!-- AUTHOR=DAVID PITTS ET AL //-->
<!-- PUBLISHER=MACMILLAN //-->
<!-- IMPRINT=SAMS PUBLISHING //-->
<!-- PUBLICATION DATE=1998 //-->
<!-- CHAPTER=06 //-->
<!-- PAGES=0075-0096 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="0084-0086.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0091-0093.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-87"><P>Page 87</P></A>
<P>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:
</P>
<!-- CODE //-->
<PRE>
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
}
</PRE>
<!-- END CODE //-->
<P>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:
</P>
<!-- CODE SNIP //-->
<PRE>
CONTROL Mail
{
CONTAINER_NAME Top
CONTAINER_TYPE BOX
DELETE True
}
</PRE>
<!-- END CODE SNIP //-->
<P>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.
</P>
<P>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.
</P>
<H4><A NAME="ch06_ 13">
Creating New Actions
</A></H4>
<P>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.)
</P>
<P>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.
</P>
<A NAME="PAGENUM-88"><P>Page 88</P></A>
<CENTER>
<TABLE BGCOLOR="#FFFF99">
<TR><TD><B>
TIP
</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
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.
</BLOCKQUOTE></TD></TR>
</TABLE></CENTER>
</P>
<P>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.
</P>
<BR>
Figure 6.5.<BR>
The Create Action<BR> dialog box.<BR>
<a href="8brhu05.html"><img src="images/tn_8brhu05_jpg.jpg"></a><BR>
<BR>
<P>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.
</P>
<A NAME="PAGENUM-89"><P>Page 89</P></A>
<H5><A NAME="ch06_ 14">
Creating Controls
</A></H5>
<P>With this new action, you can now create a completely new control:
</P>
<!-- CODE //-->
<PRE>
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
}
</PRE>
<!-- END CODE //-->
<P>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.
</P>
<P>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.
</P>
<H5><A NAME="ch06_ 15">
Modifying Controls
</A></H5>
<P>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.
</P>
<P>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!)
</P>
<P>Modify the file so that it reads this way:
</P>
<!-- CODE //-->
<PRE>
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
}
</PRE>
<!-- END CODE //-->
<A NAME="PAGENUM-90"><P>Page 90</P></A>
<P>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.
</P>
<H4><A NAME="ch06_ 16">
Creating and Modifying Subpanels
</A></H4>
<P>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.
</P>
<H5><A NAME="ch06_ 17">
Creating Subpanels
</A></H5>
<P>A SUBPANEL definition looks very much like that of a
CONTROL:
</P>
<!-- CODE SNIP //-->
<PRE>
SUBPANEL Games
{
CONTAINER_NAME Date
TITLE Games
}
</PRE>
<!-- END CODE SNIP //-->
<P>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.
</P>
<P>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):
</P>
<!-- CODE //-->
<PRE>
CONTROL Spider
{
CONTAINER_NAME Games
CONTAINER_TYPE SUBPANEL
LABEL Spider
ICON redhat_folder
PUSH_ACTION Spider
PUSH_RECALL true
}
</PRE>
<!-- END CODE //-->
<P>When the desktop is restarted, a Red Hat icon appears in the Games subpanel. When it is
clicked, the solitaire application Spider starts.
</P>
<H5><A NAME="ch06_ 18">
Modifying Subpanels
</A></H5>
<P>Like default controls, default subpanels can be modified.
</P>
<P>To remove the Install Icon control, add
</P>
<!-- CODE SNIP //-->
<PRE>
CONTROL_INSTALL False
</PRE>
<!-- END CODE SNIP //-->
<P>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:
</P>
<P><CENTER>
<a href="0084-0086.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0091-0093.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?