Class: Bootloader::TimeoutWidget

Inherits:
CWM::IntField
  • Object
show all
Includes:
Grub2Widget
Defined in:
src/lib/bootloader/grub2_widgets.rb

Overview

Represents bootloader timeout value

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from Grub2Widget

#grub2, #grub_default, #password, #sections, #stage1

Constructor Details

- (TimeoutWidget) initialize(hidden_menu_widget)

Returns a new instance of TimeoutWidget



43
44
45
46
47
48
49
# File 'src/lib/bootloader/grub2_widgets.rb', line 43

def initialize(hidden_menu_widget)
  textdomain "bootloader"

  @minimum = -1
  @maximum = 600
  @hidden_menu_widget = hidden_menu_widget
end

Instance Attribute Details

- (Object) maximum (readonly)

Returns the value of attribute maximum



51
52
53
# File 'src/lib/bootloader/grub2_widgets.rb', line 51

def maximum
  @maximum
end

- (Object) minimum (readonly)

Returns the value of attribute minimum



51
52
53
# File 'src/lib/bootloader/grub2_widgets.rb', line 51

def minimum
  @minimum
end

Instance Method Details

- (Object) help



57
58
59
60
# File 'src/lib/bootloader/grub2_widgets.rb', line 57

def help
  _("<p><b>Timeout in Seconds</b><br>\n" \
    "Specifies the time the bootloader will wait until the default kernel is loaded.</p>\n")
end

- (Object) init



62
63
64
65
66
67
68
# File 'src/lib/bootloader/grub2_widgets.rb', line 62

def init
  self.value = if grub_default.hidden_timeout && grub_default.hidden_timeout.to_i > 0
    grub_default.hidden_timeout.to_i
  else
    grub_default.timeout.to_i
  end
end

- (Object) label



53
54
55
# File 'src/lib/bootloader/grub2_widgets.rb', line 53

def label
  _("&Timeout in Seconds")
end

- (Object) store



70
71
72
73
74
75
76
77
78
# File 'src/lib/bootloader/grub2_widgets.rb', line 70

def store
  if @hidden_menu_widget.checked?
    grub_default.hidden_timeout = value.to_s
    grub_default.timeout = "0"
  else
    grub_default.hidden_timeout = "0"
    grub_default.timeout = value.to_s
  end
end