Skip to content

Commit

Permalink
more fixes for working UI
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jan 26, 2016
1 parent 91891bf commit 76a6e14
Showing 1 changed file with 15 additions and 35 deletions.
50 changes: 15 additions & 35 deletions src/lib/bootloader/grub2_widgets.rb
Expand Up @@ -26,7 +26,7 @@ def password
end

def sections
BootloaderFactory.current.password
BootloaderFactory.current.sections
end

def grub2
Expand All @@ -45,8 +45,6 @@ def initialize(hidden_menu_widget)
@hidden_menu_widget = hidden_menu_widget
end

private

attr_reader :minimum, :maximum

def label
Expand All @@ -60,7 +58,7 @@ def help
end

def init
if grub_default.hidden_timeout && grub_default.hidden_timeout > 0
if grub_default.hidden_timeout && grub_default.hidden_timeout.to_i > 0
self.value = grub_default.hidden_timeout
else
self.value = grub_default.timeout
Expand All @@ -85,8 +83,6 @@ def initialize
textdomain "bootloader"
end

private

def label
_("Set &active Flag in Partition Table for Boot Partition")
end
Expand Down Expand Up @@ -116,8 +112,6 @@ def initialize
textdomain "bootloader"
end

private

def label
_("Write &generic Boot Code to MBR")
end
Expand Down Expand Up @@ -146,8 +140,6 @@ def initialize
textdomain "bootloader"
end

private

def label
_("&Hide Menu on Boot")
end
Expand All @@ -159,7 +151,7 @@ def help
end

def init
self.value = default_grub.hidden_timeout && default_grub.hidden_timeout > 0
self.value = grub_default.hidden_timeout && grub_default.hidden_timeout.to_i > 0
end
end

Expand All @@ -170,8 +162,6 @@ def initialize
textdomain "bootloader"
end

private

def label
_("Probe Foreign OS")
end
Expand Down Expand Up @@ -199,8 +189,6 @@ def initialize
textdomain "bootloader"
end

private

def label
_("O&ptional Kernel Command Line Parameter")
end
Expand Down Expand Up @@ -228,8 +216,6 @@ def initialize
textdomain "bootloader"
end

private

def init
self.value = grub2.pmbr_action
end
Expand Down Expand Up @@ -257,8 +243,6 @@ def initialize
textdomain "bootloader"
end

private

MASKED_PASSWORD = "**********"

def contents
Expand Down Expand Up @@ -295,7 +279,7 @@ def validate
Yast::UI.SetFocus(Id(:pw1))
return false
end
if Yast::UI.QueryWidget(Id(:pw1), :Value) == UI.QueryWidget(Id(:pw2), :Value)
if Yast::UI.QueryWidget(Id(:pw1), :Value) == Yast::UI.QueryWidget(Id(:pw2), :Value)
return true
end
Yast::Report.Error(_(
Expand All @@ -310,13 +294,13 @@ def init
# read state on disk only if not already set by user (bnc#900026)
value = enabled && password.password? ? MASKED_PASSWORD : ""

UI.ChangeWidget(Id(:use_pas), :Value, enabled)
UI.ChangeWidget(Id(:pw1), :Enabled, enabled)
UI.ChangeWidget(Id(:pw1), :Value, value)
UI.ChangeWidget(Id(:pw2), :Enabled, enabled)
UI.ChangeWidget(Id(:pw2), :Value, value)
UI.ChangeWidget(Id(:unrestricted_pw), :Enabled, enabled)
UI.ChangeWidget(Id(:unrestricted_pw), :Value, password.unrestricted?)
Yast::UI.ChangeWidget(Id(:use_pas), :Value, enabled)
Yast::UI.ChangeWidget(Id(:pw1), :Enabled, enabled)
Yast::UI.ChangeWidget(Id(:pw1), :Value, value)
Yast::UI.ChangeWidget(Id(:pw2), :Enabled, enabled)
Yast::UI.ChangeWidget(Id(:pw2), :Value, value)
Yast::UI.ChangeWidget(Id(:unrestricted_pw), :Enabled, enabled)
Yast::UI.ChangeWidget(Id(:unrestricted_pw), :Value, password.unrestricted?)
end

def handle(event)
Expand All @@ -343,7 +327,7 @@ def store
# special value as we do not know password, so it mean user do not change it
password.password = value if value != MASKED_PASSWORD

value = UI.QueryWidget(Id(:unrestricted_pw), :Value)
value = Yast::UI.QueryWidget(Id(:unrestricted_pw), :Value)
password.unrestricted = value
end

Expand All @@ -367,8 +351,6 @@ def initialize
textdomain "bootloader"
end

private

def contents
# TODO: simplify a bit content or split it
VBox(
Expand Down Expand Up @@ -433,13 +415,13 @@ def init
Yast::UI.ChangeWidget(Id(:gfxterm_frame), :Value, enable)


UI.ChangeWidget(Id(:gfxmode), :Items, vga_modes_items)
Yast::UI.ChangeWidget(Id(:gfxmode), :Items, vga_modes_items)
mode = grub_default.gfxmode

# there's mode specified, use it
UI.ChangeWidget(Id(:gfxmode), :Value, mode) if mode && mode != ""
Yast::UI.ChangeWidget(Id(:gfxmode), :Value, mode) if mode && mode != ""

UI.ChangeWidget(Id(:theme), :Value, grub_default.theme)
Yast::UI.ChangeWidget(Id(:theme), :Value, grub_default.theme)
end

def vga_modes_items
Expand Down Expand Up @@ -525,8 +507,6 @@ def help
)
end

private

def init
self.value = sections.default
end
Expand Down

0 comments on commit 76a6e14

Please sign in to comment.