ACC SHELL

Path : /usr/share/YaST2/include/bootloader/elilo/
File Upload :
Current File : //usr/share/YaST2/include/bootloader/elilo/widgets.ycp

/**
 * 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 56563 2009-04-02 08:41:25Z jreidinger $
 *
 */


{

    textdomain "bootloader";

    import "Label";
    import "Mode";
    import "BootCommon";
    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 (`Frame ( _("EFI Label"), `HBox(`HSpacing(1),`VBox(
	    `VSpacing (1),
	    `Left (`CheckBox (`id (`create_entry), `opt (`notify),
		// check box
		_("&Create EFI Entry"))),
	    `Left (`InputField (`id (`location), `opt (`hstretch),
		// text entry label
		_("&EFI Entry Name"))),
	     `VStretch ()
	))));
	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) ``{
	UI::ChangeWidget (`id (`create_entry), `Value, create_efi_entry);
	UI::ChangeWidget (`id (`location), `Value, BootCommon::globals["boot_efilabel"]:"");
	UI::ChangeWidget (`id (`location), `Enabled, create_efi_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) ``{
	UI::ChangeWidget (`id (`location), `Enabled,
	    UI::QueryWidget (`id (`create_entry), `Value));
	return nil;
    }

    /**
      * 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) ``{
	BootCommon::globals["boot_efilabel"] = (string)
	    UI::QueryWidget (`id (`location), `Value);
	BootCommon::location_changed = true;
	create_efi_entry = (boolean)
	    UI::QueryWidget (`id (`create_entry), `Value);
    }

    /**
      * 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;
}



}

ACC SHELL 2018