Class: Bootloader::Grub2Widget::LoaderLocationWidget
- Inherits:
-
CWM::CustomWidget
- Object
- CWM::CustomWidget
- Bootloader::Grub2Widget::LoaderLocationWidget
show all
- Includes:
- Grub2Helper
- Defined in:
- src/lib/bootloader/grub2_widgets.rb
Overview
Represents stage1 location for bootloader
Instance Method Summary
collapse
#grub2, #grub_default, #password, #stage1
Instance Method Details
#contents ⇒ Object
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 597
def contents
textdomain "bootloader"
VBox(
Frame(
_("Boot Code Location"),
HBox(
HSpacing(1),
VBox(*location_checkboxes),
HSpacing(1)
)
),
VSpacing(1)
)
end
|
#handle(event) ⇒ Object
613
614
615
616
617
618
619
620
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 613
def handle(event)
return unless event["ID"] == :custom
checked = Yast::UI.QueryWidget(Id(:custom), :Value)
Yast::UI.ChangeWidget(Id(:custom_list), :Enabled, checked)
nil
end
|
#init ⇒ Object
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 622
def init
if locations.include?(:boot)
Yast::UI.ChangeWidget(Id(:boot), :Value,
stage1.boot_partition?)
end
if locations.include?(:logical)
Yast::UI.ChangeWidget(Id(:logical), :Value, stage1.boot_partition?)
end
if locations.include?(:extended)
Yast::UI.ChangeWidget(Id(:extended), :Value, stage1.extended_boot_partition?)
end
Yast::UI.ChangeWidget(Id(:mbr), :Value, stage1.mbr?) if locations.include?(:mbr)
init_custom_devices(stage1.custom_devices)
end
|
#store ⇒ Object
638
639
640
641
642
643
644
645
646
647
648
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 638
def store
stage1.clear_devices
locations.each { |l| add_location(l) }
return unless Yast::UI.QueryWidget(:custom, :Value)
devs = Yast::UI.QueryWidget(:custom_list, :Value)
devs.split(",").each do |dev|
stage1.add_device(DevicePath.new(dev).path)
end
end
|
#validate ⇒ Object
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 650
def validate
return true if !Yast::UI.QueryWidget(:custom, :Value)
devs = Yast::UI.QueryWidget(:custom_list, :Value)
if devs.strip.empty?
Yast::Report.Error(_("Custom boot device has to be specified if checked"))
Yast::UI.SetFocus(Id(:custom_list))
return false
end
invalid_devs = invalid_custom_devices(devs)
if !invalid_devs.empty?
ret = Yast::.ContinueCancel(
format(
_(
"These custom devices can be invalid: %s." \
"Please check if exist and spelled correctly." \
"Do you want to continue?"
),
invalid_devs.join(", ")
)
)
if !ret
Yast::UI.SetFocus(Id(:custom_list))
return false
end
end
true
end
|