Class: Bootloader::Grub2Widget::TimeoutWidget

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

Overview

Represents bootloader timeout value

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Grub2Helper

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

Constructor Details

#initialize(hidden_menu_widget) ⇒ TimeoutWidget

Returns a new instance of TimeoutWidget.



51
52
53
54
55
56
57
58
59
# File 'src/lib/bootloader/grub2_widgets.rb', line 51

def initialize(hidden_menu_widget)
  textdomain "bootloader"

  super()

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

Instance Attribute Details

#maximumObject (readonly)

Returns the value of attribute maximum.



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

def maximum
  @maximum
end

#minimumObject (readonly)

Returns the value of attribute minimum.



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

def minimum
  @minimum
end

Instance Method Details

#helpObject



67
68
69
70
# File 'src/lib/bootloader/grub2_widgets.rb', line 67

def help
  _("<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



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

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

#labelObject



63
64
65
# File 'src/lib/bootloader/grub2_widgets.rb', line 63

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

#storeObject



80
81
82
83
84
85
86
87
88
# File 'src/lib/bootloader/grub2_widgets.rb', line 80

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