Class: Bootloader::BlsWidget::TimeoutWidget
- Inherits:
-
CWM::CustomWidget
- Object
- CWM::CustomWidget
- Bootloader::BlsWidget::TimeoutWidget
- Defined in:
- src/lib/bootloader/bls_widgets.rb
Overview
Represents bootloader timeout value
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#maximum ⇒ Object
readonly
Returns the value of attribute maximum.
-
#minimum ⇒ Object
readonly
Returns the value of attribute minimum.
Instance Method Summary collapse
- #contents ⇒ Object
- #help ⇒ Object
- #init ⇒ Object
-
#initialize ⇒ TimeoutWidget
constructor
A new instance of TimeoutWidget.
- #store ⇒ Object
Constructor Details
#initialize ⇒ TimeoutWidget
Returns a new instance of TimeoutWidget.
15 16 17 18 19 20 21 22 23 |
# File 'src/lib/bootloader/bls_widgets.rb', line 15 def initialize textdomain "bootloader" super() @minimum = 0 @maximum = 600 @default = 10 end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
25 26 27 |
# File 'src/lib/bootloader/bls_widgets.rb', line 25 def default @default end |
#maximum ⇒ Object (readonly)
Returns the value of attribute maximum.
25 26 27 |
# File 'src/lib/bootloader/bls_widgets.rb', line 25 def maximum @maximum end |
#minimum ⇒ Object (readonly)
Returns the value of attribute minimum.
25 26 27 |
# File 'src/lib/bootloader/bls_widgets.rb', line 25 def minimum @minimum end |
Instance Method Details
#contents ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'src/lib/bootloader/bls_widgets.rb', line 27 def contents CheckBoxFrame( Id(:cont_boot), _("Automatically boot the default entry after a timeout"), false, HBox( IntField(Id(:seconds), _("&Timeout in Seconds"), @minimum, @maximum, default_value), HStretch() ) ) end |
#help ⇒ Object
40 41 42 43 44 |
# File 'src/lib/bootloader/bls_widgets.rb', line 40 def help _("<p>Continue boot process after defined seconds.</p>" \ "<p><b>Timeout in Seconds</b>\n" \ "specifies the time the boot loader will wait until the default kernel is loaded.</p>\n") end |
#init ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'src/lib/bootloader/bls_widgets.rb', line 46 def init current_bl = ::Bootloader::BootloaderFactory.current if current_bl.respond_to?(:timeout) timeout = current_bl.timeout elsif current_bl.respond_to?(:grub_default) && current_bl.grub_default.respond_to?(:timeout) timeout = current_bl.grub_default.timeout else log.error("Bootloader #{current_bl} does not support timeout") disable return end Yast::UI.ChangeWidget(Id(:cont_boot), :Value, timeout >= 0) Yast::UI.ChangeWidget(Id(:seconds), :Value, timeout < 0 ? default_value : timeout) end |
#store ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'src/lib/bootloader/bls_widgets.rb', line 62 def store current_bl = ::Bootloader::BootloaderFactory.current cont_boot = Yast::UI.QueryWidget(Id(:cont_boot), :Value) value = cont_boot ? Yast::UI.QueryWidget(Id(:seconds), :Value) : -1 if current_bl.respond_to?(:timeout) current_bl.timeout = value elsif current_bl.respond_to?(:grub_default) && current_bl.grub_default.respond_to?(:timeout) current_bl.grub_default.timeout = value else log.error("Bootloader #{current_bl} does not support timeout") end end |