DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Writing a SCOadmin manager

Exiting the application

Managers should preserve user preferences (such as toolbar, refresh options, short help, and so on) before exiting. SaScreenPolicy(3tlib) allows managers to save and retrieve information about user preference configuration in a per-user database ($HOME/.scoadmin.pref).

During shutdown, you may have to interrupt the procedural flow from the caller to present error dialogs to the user. This requires returning to the event-driven user interface loop. The procedure shown in ``Template shutdown procedure: UiStop'' uses ``Template secondary shutdown procedure: UiStop2'' and a callback to return control to the caller,

Template shutdown procedure: UiStop

proc UiStop {cb} {
	global appvals

# Suspend autorefreshes to reduce our error concerns if {$appvals(autorefresh)} { SaAutoRefreshPause }

set vtMain $appvals(vtMain) set client $appvals(client)

# Store modified preferences

# short help set cmd [list SaShortHelpStore $client] if {[ErrorCatch errorStack 0 $cmd dummy] != 0 } { lappend errorStacks $errorStack }

# auto refresh if {$appvals(autorefresh)} { set cmd [list SaAutoRefreshStore $client] if {[ErrorCatch errorStack 0 $cmd dummy] != 0 } { lappend errorStacks $errorStack } }

# toolbar if {$appvals(toolbarcust)} { set cmd {UiToolBarStore} if {[ErrorCatch errorStack 0 $cmd dummy] != 0 } { lappend errorStacks $errorStack } }

# any problems? if [info exists errorStacks] { # present error dialog and enter event-driven Ui loop. # Re-gain procedural control via UiStop2 (part 2) and # eventually, the caller's cb SaDisplayErrorStacks $vtMain.UIStop $errorStacks {} \ [list UiStop2 $cb] VtUnLock VtMainLoop } else { # stop vtcl VtUnLock VtClose # return control to the caller eval $cb } }

Template secondary shutdown procedure: UiStop2

   proc UiStop2 {cb {cbs {}}} {
   	VtUnLock
   	VtClose
   	# return control to the caller
   	eval $cb

See also:


Next topic: Interfacing with object service agents (OSAs)
Previous topic: Using print controls

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005