Skip to content

Commit

Permalink
split complex method
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Aug 5, 2014
1 parent 286417a commit ceda983
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/lib/registration/ui/autoyast_config_dialog.rb
Expand Up @@ -174,6 +174,22 @@ def refresh_widget_state
Yast::UI.ChangeWidget(Id(:reg_server_cert_fingerprint), :Enabled, fingeprint_enabled && enabled)
end

def store_config
data_widgets = [ :do_registration, :reg_server, :reg_server_cert,
:email, :reg_code, :slp_discovery, :install_updates,
:reg_server_cert_fingerprint_type, :reg_server_cert_fingerprint
]

data = data_widgets.map do |w|
[w.to_s, Yast::UI.QueryWidget(Id(w), :Value)]
end

import_data = Hash[data]
# keep the current addons
import_data["addons"] = config.addons
config.import(import_data)
end

def handle_dialog
begin
ret = Yast::UI.UserInput
Expand All @@ -189,24 +205,9 @@ def handle_dialog
end
end until ret == :next || ret == :back || ret == :addons

if ret == :next || ret == :addons
data_widgets = [ :do_registration, :reg_server, :reg_server_cert,
:email, :reg_code, :slp_discovery, :install_updates,
:reg_server_cert_fingerprint_type, :reg_server_cert_fingerprint
]

data = data_widgets.map do |w|
[w.to_s, Yast::UI.QueryWidget(Id(w), :Value)]
end

import_data = Hash[data]
# keep the current addons
import_data["addons"] = config.addons
config.import(import_data)
end
store_config if ret == :next || ret == :addons

ret

end

end
Expand Down

0 comments on commit ceda983

Please sign in to comment.