home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
boot
/
i386
/
root
/
usr
/
share
/
YaST2
/
include
/
bootloader
/
elilo
/
widgets.ycp
< prev
Wrap
Text File
|
2006-11-29
|
4KB
|
160 lines
/**
* File:
* include/bootloader/elilo/widgets.ycp
*
* Module:
* Bootloader installation and configuration
*
* Summary:
* Widgets specific for ELILO bootloader
*
* Authors:
* Jiri Srain <jsrain@suse.cz>
*
* $Id: widgets.ycp 25285 2005-08-31 06:26:18Z jsrain $
*
*/
{
textdomain "bootloader";
import "Label";
import "Mode";
import "BootCommon";
import "TablePopup";
include "bootloader/routines/popups.ycp";
// Bootloader target widget
/**
* Get widget term
* @return widget term
*/
global define term getTargetWidget () ``{
boolean have_old = (old_efi_entry != nil && old_efi_entry != "");
term widget = `VBox (
`VSpacing (1),
`Left (`CheckBox (`id (`create_entry), `opt (`notify),
// check box
_("&Create EFI Entry"))),
`VSpacing (0.6),
`Left (`TextEntry (`id (`location),
// text entry label
_("&EFI Entry Name"))),
have_old ? `VSpacing (1) : `VSpacing (0),
have_old
? `Left (`CheckBox (`id (`remove_old),
// check box
sformat (_("&Remove Old EFI Entry (%1)"), old_efi_entry)))
: `VSpacing (0),
`VSpacing (1)
);
return widget;
}
/**
* Init function of a popup
* @param opt_id any option id
* @param opt_key any option key
*/
global define void targetInit (string widget) ``{
boolean have_old = (old_efi_entry != nil && old_efi_entry != "");
UI::ChangeWidget (`id (`create_entry), `Value, create_efi_entry);
UI::ChangeWidget (`id (`location), `Value, efi_entry_name);
UI::ChangeWidget (`id (`location), `Enabled, create_efi_entry);
if (have_old)
{
UI::ChangeWidget (`id (`remove_old), `Value, remove_old_efi);
UI::ChangeWidget (`id (`remove_old), `Enabled, create_efi_entry);
}
UI::SetFocus (`id (`create_entry));
}
/**
* Handle function of widget
* @param opt_id any option id
* @param opt_key any option key
* @param event map event that occured
*/
global symbol targetHandle (string widget, map event) ``{
boolean have_old = (old_efi_entry != nil && old_efi_entry != "");
UI::ChangeWidget (`id (`location), `Enabled,
UI::QueryWidget (`id (`create_entry), `Value));
if (have_old)
{
UI::ChangeWidget (`id (`remove_old), `Enabled,
UI::QueryWidget (`id (`create_entry), `Value));
}
}
/**
* Store function of a popup
* @param opt_id any option id
* @param opt_key any option key
*/
global define void targetStore (string widget, map event) ``{
boolean have_old = (old_efi_entry != nil && old_efi_entry != "");
efi_entry_name = (string)
UI::QueryWidget (`id (`location), `Value);
if (have_old)
{
remove_old_efi = (boolean)
UI::QueryWidget (`id (`remove_old), `Value);
}
BootCommon::location_changed = true;
create_efi_entry = (boolean)
UI::QueryWidget (`id (`create_entry), `Value);
BootCommon::location_changed = true;
}
/**
* Validate function of a popup
* @param opt_id any option id
* @param opt_key any option key
* @param event map event that caused validation
* @return boolean true if widget settings ok
*/
global define boolean targetValidate (string widget, map event)``{
return true; // FIXME check for valid characters
// FIXME check if not empty
}
/**
* Cache for ppcWidgets function
*/
map<string,map<string,any> > _elilo_widgets = nil;
/**
* Get widgets specific for ppc
* @return a map describing all ppc-specific widgets
*/
map<string,map<string,any> > Widgets () {
if (_elilo_widgets == nil)
{
_elilo_widgets = $[
"loader_location" : $[
"widget" : `func,
"widget_func" : getTargetWidget,
"init" : targetInit,
"handle" : targetHandle,
"store" : targetStore,
"validate_type" : `function,
"validate" : targetValidate,
"help" : " ",
],
];
}
return _elilo_widgets;
}
}