The DATA_ATTRIBUTES
definition
defines the appearance and behavior of the data type. It specifies the name
of the data type, and provides the ability to specify:
The File Manager icon (ICON field)
The double-click behavior and contents of the Selected menu (ACTIONS field)
Use the ICON field to specify the icon used in File Manager. If you do not specify an icon image, File Manager displays only a label.
The value of the ICON field can be:
The base file name is the name of the file containing the icon image, minus the file-name suffixes for size (m and t) and image type (bm and pm). For example, if files are named GameIcon.m.pm and GameIcon.t.pm, use GameIcon.
If you use the base file name, the icon files must be placed in a directory on the icon search path:
Personal icons: HomeDirectory/.dt/icons
System-wide icons: /etc/dt/appconfig/icons/language
An absolute path to the icon file, including the full file name.
You should use the absolute path only if the icon file is not located on the icon search path. For example, if icon file GameIcon.m.pm is placed in the directory /doc/projects, which is not on the icon search path, the value of the ICON field would be /doc/projects/GameIcon.m.pm.
Table 13-1 lists icon sizes you should create and the corresponding file names.
Size in Pixels |
Bitmap Name |
Pixmap Name |
---|---|---|
32 by 32 |
name.m.bm |
name.m.pm |
16 by 16 |
name.t.bm |
name.t.pm |
There are two ways that data types are associated with actions:
The ACTIONS field in the DATA_ATTRIBUTES
definition lists the actions
that will appear in File Manager's Selected menu. The first action in the
list is the default (double-click) action.
Actions can be restricted to specified data types using the action definition's ARG_TYPE field.
For example, the following data type definition creates a data type for special "readme" files created by your system administrator that use the naming convention *.rm.
DATA_ATTRIBUTES SysReadmeFile { ICON SysReadMe ACTIONS Open,Respond } DATA_CRITERIA SysReadmeFileCriteria { NAME_PATTERN *.rm DATA_ATTRIBUTES_NAME SysReadmeFile }
A special Respond action is defined below for the file. It opens a writable copy of the file in Text Editor. When the file is saved and Text Editor is exited, the file is mailed to the system administrator (mail address sysadmin@utd).
ACTION Respond { ARG_TYPE SysReadmeFile EXEC_STRING /bin/sh -c 'cp %Arg_1% $HOME/readme.temp;\ chmod +w $HOME/readme.temp; \ dtpad $HOME/readme.temp; \ cat $HOME/readme.temp | \ /usr/bin/mailx sysadmin@utd; \ rm $HOME/readme.temp' WINDOW_TYPE NO_STDIO }
If a file is an invisible data type, it never appears in File Manager.
Use the PROPERTIES field in the DATA_ATTRIBUTES
definition to specify that
objects of this type be hidden:
PROPERTIES invisible
Table 13-2 shows
the DATA_ATTRIBUTES
fields that
are used primarily by application programmers. They specify how files behave
when the user performs various desktop activities.
For more information, see the Common Desktop Environment Programmer's Guide, which is part of the developer environment documentation.
Table 13-2 DATA_ATTRIBUTES Fields and Descriptions
Field |
Description |
---|---|
For containers such as directories. Specifies an action to be run when a file is moved to a container of this data type. |
|
For containers such as directories. Specifies an action to be run when a file is copied to a container of this data type. |
|
Specifies an action to be run when a file is linked to a file of this data type. |
|
Specifies that files of this data type contain text that can be displayed in a text box. |
|
Specifies the corresponding ToolTalk media type. |
|
Specifies the corresponding MIME type. |
|
Specifies the corresponding X400 type. |