home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 December
/
PCWorld_2000-12_cd.bin
/
Komunikace
/
Comanche
/
plugins
/
hostname
/
hostname.tcl
next >
Wrap
Text File
|
2000-11-02
|
3KB
|
82 lines
class hostnamePlugIn {
inherit basePlugIn
variable hostnameXuiPP
variable hostnameEntry
variable hostnameNodeId
constructor {} {
set hostnameXuiPP [xuiPropertyPage ::#auto]
$hostnameXuiPP configure -icon network
$hostnameXuiPP setLabel [mesg::get configuring_hostname]
$hostnameXuiPP setName hostnamePP
set hostnameEntry [xuiString ::#auto]
$hostnameEntry setLabel [mesg::get hostname]
$hostnameEntry setName hostname
$hostnameXuiPP addComponent $hostnameEntry
}
method init { args }
method _inquiryForRightPaneContent { node }
method _inquiryForPropertyPages { node }
method _receivedPropertyPages { node xuiPropertyPages}
}
# args contains the options that are passed to the plugIn at initialization
# time.
#
# -namespace contains the name of the name space server
body hostnamePlugIn::init {args} {
# We are hooking to the root node
# The ::plugInUtils::addNode syntaxis is the following
# ::plugInUtils::addNode caller namespace parentNode
# where
# caller: Name of the object that is adding the node (the plugIn object)
# namespace: Namespace where we are adding the node
# parentNode: Parent node
#
# The list of available icons is in view/images.tcl
array set options $args
set namespace $options(-namespace)
set parentNode [[ $namespace getRootNode] getId]
set hostnameNode [::plugInUtils::addNode $this $namespace $parentNode \
-classes {hostname leaf} \
-openIcon network \
-closedIcon network \
-label [mesg::get hostname_settings]]
set hostnameNodeId [$hostnameNode getId]
}
body hostnamePlugIn::_inquiryForRightPaneContent { node } {
global tcl_platform
if {$tcl_platform(platform) == "windows"} {
set result [mesg::get hostname_right_pane_windows]
} else {
set result [mesg::get hostname_right_pane]
append result " <b>[exec hostname]</b>"
}
return $result
}
body hostnamePlugIn::_inquiryForPropertyPages { node } {
global tcl_platform
if {$tcl_platform(platform) == "windows"} {
return
} else {
$hostnameEntry setValue [exec hostname]
}
return $hostnameXuiPP
}
body hostnamePlugIn::_receivedPropertyPages { node xuiPropertyPages } {
set pp [$xuiPropertyPages getComponentByName hostnamePP]
set newHostname [[$pp getComponentByName hostname] getValue]
catch {exec hostname $newHostname}
}