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, #sections, #stage1
Instance Method Details
#contents ⇒ Object
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 771
def contents
textdomain "bootloader"
VBox(
Frame(
_("Boot Code Location"),
HBox(
HSpacing(1),
VBox(*location_checkboxes),
HSpacing(1)
)
),
VSpacing(1)
)
end
|
#handle(event) ⇒ Object
787
788
789
790
791
792
793
794
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 787
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
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 796
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
812
813
814
815
816
817
818
819
820
821
822
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 812
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
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 824
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::Popup.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
|