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
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 542
def contents
textdomain "bootloader"
VBox(
Frame(
_("Boot Code Location"),
HBox(
HSpacing(1),
VBox(*location_checkboxes),
HSpacing(1)
)
),
VSpacing(1)
)
end
|
#handle(event) ⇒ Object
558
559
560
561
562
563
564
565
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 558
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
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 567
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
583
584
585
586
587
588
589
590
591
592
593
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 583
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
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
|
# File 'src/lib/bootloader/grub2_widgets.rb', line 595
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
|