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
/
generic
/
section_widgets.ycp
< prev
next >
Wrap
Text File
|
2006-11-29
|
2KB
|
97 lines
/**
* File:
* include/bootloader/routines/sections_widgets.ycp
*
* Module:
* Bootloader installation and configuration
*
* Summary:
* Common widgets for being used by several bootloaders
*
* Authors:
* Joachim Plack <jplack@suse.de>
*
* $Id: section_widgets.ycp 33293 2006-10-09 17:11:36Z jplack $
*
*/
{
textdomain "bootloader";
import "BootCommon";
import "Label";
import "Stage";
include "bootloader/generic/widget_funcs.ycp";
/**
* Validate function of a widget
* @param widget any widget key
* @param event map event description of event that occured
* @return boolean true if widget settings ok
*/
boolean _SectionNameValidate (string widget, map event) {
list<string> existing = [];
foreach (map<string,any> s, BootCommon::sections, {
existing = add (existing, s["name"]:"");
});
existing = (list<string>)filter (string l, existing, {
return l != BootCommon::current_section_name;
});
existing = (list<string>)add (existing, "");
string new = (string)UI::QueryWidget (`id (widget), `Value);
if (contains (existing, new))
{
usedNameErrorPopup ();
return false;
}
return true;
}
/**
* Store function of a widget
* @param widget any widget key
* @param event map event description of event that occured
*/
void _SectionNameStore (string widget, map event) {
string value = (string)UI::QueryWidget (`id (widget), `Value);
BootCommon::current_section[widget] = value;
}
/**
* Cache for CommonSectionWidgets
*/
map<string,map<string,any> > _generic_common_section_widgets = nil;
/**
* Get common widgets for loader sections
* @return a map describing common loader section related widgets
*/
map<string,map<string,any> > _CommonSectionWidgets () {
if (_generic_common_section_widgets == nil)
{
_generic_common_section_widgets = $[
"name" : $[
// text entry
"label" : _("Section &Name"),
"widget" : `textentry,
"validate_type" : `function,
"validate_function" : _SectionNameValidate,
"store" : _SectionNameStore,
"help" : generic_Help("section-name"),
],
];
}
return _generic_common_section_widgets;
}
} // include end