|
|
You can use application rules to define special icons for certain types of files, and to start your application when a user double-click on one of those icons. For example, specially formatted calendar files created and displayed by a calendar program could be represented by a calendar file icons.
To define special icons for data files:
The name of the pixmap file must end in the .px extension.
To help users identify it as a file icon, you should base the design of your data file icon on the standard SCO OpenServer system file icon. For example, a C header file is represented by a file icon labeled with an ``.h'':
For example, the following rule specifies that files with the .cal suffix will be represented by the icon pixmap file Cal_file.px. The rule also specifies that double-clicking on one of these file icons will have the same effect as dropping the file icon on the application's icon: it will start the calendar program with the calendar file displayed. For more about Desktop rules, see the Graphical Environment Guide.
1 icon_rules 2 { 3 *.cal /F 4 { 5 picture=Cal_file.px;6 trigger_action: activate 7 { 8 filetype /usr/bin/calendar 9 if [ == $_type(1) F ] && [ == $_type(2) X ] 10 then 11 /usr/bin/calendar $* $static_arg 12 else 13 fyi -t 'Calendar' 'Calendar is not installed on your system' 14 fi 15 } 16 } 17 }
Use the following syntax to install your pixmap:
deskconfobj -alrg -name pixmap_name -src fileUse the -alrg (add large pixmap) option to add a pixmap. For pixmap_name, substitute the name of the pixmap file (Cal_file.px for the above example). For file, substitute the pathname of the pixmap file to be copied.
Use the following syntax to install your rule:
deskconfobj -arule -name rule_name -src fileFor rule_name, substitute a name that is unlikely to be duplicated by other programs (typically your application's class name). For file, substitute the pathname of the file that contains the rules to be copied.
The data file's name will be used as the icon label. For more about using deskconfobj, see ``Install icon files''.