Class: Bootloader::LoaderTypeWidget

Inherits:
CWM::ComboBox
  • Object
show all
Defined in:
src/lib/bootloader/generic_widgets.rb

Overview

Widget to switch between all supported bootloaders

Instance Method Summary (collapse)

Constructor Details

- (LoaderTypeWidget) initialize

Returns a new instance of LoaderTypeWidget



13
14
15
# File 'src/lib/bootloader/generic_widgets.rb', line 13

def initialize
  textdomain "bootloader"
end

Instance Method Details

- (Object) handle



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'src/lib/bootloader/generic_widgets.rb', line 49

def handle
  old_bl = BootloaderFactory.current.name
  new_bl = value

  return nil if old_bl == new_bl

  if new_bl == "none"
    # popup - Continue/Cancel
    popup_msg = _(
      "\n" \
      "If you do not install any boot loader, the system\n" \
      "might not start.\n" \
      "\n" \
      "Proceed?\n"
    )

    return :redraw if !Yast::Popup.ContinueCancel(popup_msg)
  end

  BootloaderFactory.current_name = new_bl
  BootloaderFactory.current.propose

  :redraw
end

- (Object) help



74
75
76
77
78
79
80
# File 'src/lib/bootloader/generic_widgets.rb', line 74

def help
  _(
    "<p><b>Boot Loader Type</b><br>\n" \
      "To select whether to install a boot loader and which bootloader to install,\n" \
      "use <b>Boot Loader</b>.</p>"
  )
end

- (Object) init



23
24
25
# File 'src/lib/bootloader/generic_widgets.rb', line 23

def init
  self.value = BootloaderFactory.current.name
end

- (Object) items



31
32
33
34
35
# File 'src/lib/bootloader/generic_widgets.rb', line 31

def items
  BootloaderFactory.supported_names.map do |name|
    [name, localized_names(name)]
  end
end

- (Object) label



17
18
19
20
21
# File 'src/lib/bootloader/generic_widgets.rb', line 17

def label
  textdomain "bootloader"

  _("&Boot Loader")
end

- (Object) localized_names(name)



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

def localized_names(name)
  names = {
    "grub2"     => _("GRUB2"),
    "grub2-efi" => _("GRUB2 for EFI"),
    # Translators: option in combo box when bootloader is not managed by yast2
    "none"      => _("Not Managed"),
    "default"   => _("Default")
  }

  names[name] or raise "Unknown supported bootloader '#{name}'"
end

- (Object) opt



27
28
29
# File 'src/lib/bootloader/generic_widgets.rb', line 27

def opt
  [:notify]
end