Class: Bootloader::SystemdBootWidget::TimeoutWidget

Inherits:
CWM::CustomWidget
  • Object
show all
Includes:
SystemdBootHelper
Defined in:
src/lib/bootloader/systemdboot_widgets.rb

Overview

Represents bootloader timeout value

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SystemdBootHelper

#systemdboot

Constructor Details

#initializeTimeoutWidget

Returns a new instance of TimeoutWidget.



23
24
25
26
27
28
29
30
31
# File 'src/lib/bootloader/systemdboot_widgets.rb', line 23

def initialize
  textdomain "bootloader"

  super()

  @minimum = 0
  @maximum = 600
  @default = 10
end

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



33
34
35
# File 'src/lib/bootloader/systemdboot_widgets.rb', line 33

def default
  @default
end

#maximumObject (readonly)

Returns the value of attribute maximum.



33
34
35
# File 'src/lib/bootloader/systemdboot_widgets.rb', line 33

def maximum
  @maximum
end

#minimumObject (readonly)

Returns the value of attribute minimum.



33
34
35
# File 'src/lib/bootloader/systemdboot_widgets.rb', line 33

def minimum
  @minimum
end

Instance Method Details

#contentsObject



35
36
37
38
39
40
41
42
43
44
45
46
# File 'src/lib/bootloader/systemdboot_widgets.rb', line 35

def contents
  CheckBoxFrame(
    Id(:cont_boot),
    _("Automatically boot the default entry after a timeout"),
    false,
    HBox(
      IntField(Id(:seconds), _("&Timeout in Seconds"), @minimum, @maximum,
        systemdboot.menu_timeout.to_i),
      HStretch()
    )
  )
end

#helpObject



48
49
50
51
52
# File 'src/lib/bootloader/systemdboot_widgets.rb', line 48

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

#initObject



54
55
56
57
58
# File 'src/lib/bootloader/systemdboot_widgets.rb', line 54

def init
  Yast::UI.ChangeWidget(Id(:cont_boot), :Value, systemdboot.menu_timeout >= 0)
  systemdboot.menu_timeout = default_value if systemdboot.menu_timeout < 0
  Yast::UI.ChangeWidget(Id(:seconds), :Value, systemdboot.menu_timeout)
end

#storeObject



60
61
62
63
# File 'src/lib/bootloader/systemdboot_widgets.rb', line 60

def store
  cont_boot = Yast::UI.QueryWidget(Id(:cont_boot), :Value)
  systemdboot.menu_timeout = cont_boot ? Yast::UI.QueryWidget(Id(:seconds), :Value) : -1
end