Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
13.  Creating Data Types Manually Defining the Data Attributes of a Data Type  Previous   Contents   Next 
   
 

Specifying the Icon Image Used for a Data Type

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:

  • A base file name.

    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.

Table 13-1 Icon Names and Sizes for Data Type Icons

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

Associating Data Types with Actions

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
     }

Hiding Files Based on Data Type

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

Specifying Behaviors When the File Is Manipulated

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

MOVE_TO_ACTION

For containers such as directories. Specifies an action to be run when a file is moved to a container of this data type.

COPY_TO_ACTION

For containers such as directories. Specifies an action to be run when a file is copied to a container of this data type.

LINK_TO_ACTION

Specifies an action to be run when a file is linked to a file of this data type.

IS_TEXT

Specifies that files of this data type contain text that can be displayed in a text box.

MEDIA

Specifies the corresponding ToolTalk media type.

MIME_TYPE

Specifies the corresponding MIME type.

X400_TYPE

Specifies the corresponding X400 type.

Defining the Data Criteria for a Data Type

The DATA_CRITERIA definition defines the criteria used to assign an object type to a file or directory.

You can use the criteria show in Table 13-3 for object typing.

Table 13-3 DATA_CRITERIA Criteria and Descriptions

Criteria

Description

File name

The file name must match a specified pattern. Use the NAME_PATTERN field.

File location

The path must match a specified pattern. Use the PATH_PATTERN field.

File contents

A specified portion of the file's contents must match specified data. Use the CONTENT field.

File mode

The file must possess the specified permissions (read, write, execute, directory). Use the MODE field.

Symbolic links

The typing is based on the file to which the object is linked.

You can use more than one criteria for a data type. However, you should not use the NAME_PATTERN and PATH_PATTERN criteria in the same data type.

Name-Based Data Types

Use the NAME_PATTERN field to specify the naming requirement. The field value can include the following wildcards:

?--matches any single character

*--matches any sequence of characters (including a null string)

[cc...]--matches any of the characters (c) enclosed in brackets

[c-c]--matches any of the characters in the range c through c

 
 
 
  Previous   Contents   Next