Skip to content

Commit

Permalink
fixes to make it run
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidner committed Jul 27, 2015
1 parent 558324f commit 04852e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions timezone/src/include/timezone/dialogs.rb
Expand Up @@ -345,6 +345,9 @@ def SetTimeDialog
ret = ntp_handled if ntp_handled != nil
show_current_time.call if ret == :redraw

if ret == :ntp || ret == :manual
ntp_rb = ret == :ntp
end
if ret == :ntp
if !ntp.ensure_installed
ntp_rb = false
Expand Down
20 changes: 11 additions & 9 deletions timezone/src/lib/timezone/ntp.rb
Expand Up @@ -5,18 +5,21 @@ module Yast
# TODO: separate UI and non-UI, figure out a reasonable UI interface
# (check also CWM)
class TimezoneNtp
include Yast::UIShortcuts

# [Boolean] if system clock is configured to sync with NTP
attr :used
attr_accessor :used

# [String] ntp server configured to sync with
# FIXME we use an array, but this is the one to contact now
attr :server
attr_accessor :server

def initialize
self.used = false
self.server = "" # FIXME better nil
# when checking for NTP status for first time, check the service status
self.first_time = true
@first_time = true
@installed = Stage.initial || Package.Installed("yast2-ntp-client")
end

# @return [String] a RichText help
Expand All @@ -35,11 +38,11 @@ def ui_init
{
"replace_point" => Id(:rp),
"country" => Language.GetLanguageCountry,
"first_time" => first_time
"first_time" => @first_time
}
)
)
self.first_time = false
@first_time = false
ntp_rb
end

Expand All @@ -56,7 +59,7 @@ def ui_handle(user_input)
# if the responsible yast package is not installed,
# fall back to disabling the config widgets
def installed?
Stage.initial || Package.Installed("yast2-ntp-client")
@installed
end


Expand Down Expand Up @@ -141,8 +144,7 @@ def save
# The called client has been meanwhile moved to this package but it
# does not check for the dependencies itself yet.
def ntp_call(acall, args)
args = deep_copy(args)
if !@ntp_installed
if !@installed
# replace "replace_point" by the widgets
if acall == "ui_init"
return false # deselect the RB
Expand All @@ -167,7 +169,7 @@ def ntp_call(acall, args)
end

ret = WFM.CallFunction("timezone_ntp", [acall, args])
deep_copy(ret)
ret
end
end
end

0 comments on commit 04852e0

Please sign in to comment.