Skip to content

Commit

Permalink
add servers widget
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Nov 7, 2017
1 parent bb54c31 commit cc5c8d2
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions src/lib/y2ntp_client/widgets.rb
Expand Up @@ -40,6 +40,7 @@ def items
current_policy = Yast::NtpClient.ntp_policy
if !["", "auto"].include?(current_policy)
items << [current_policy, current_policy]
end
end

def init
Expand All @@ -54,4 +55,68 @@ def store
end
end
end

class NtpStart < CWM::RadioButtons
def initialize
textdomain "ntp-client"
end

def label
_("Start NTP Daemon")
end

def opt
[:notify]
end

def items
[
# radio button
["never", _("Only &Manually")],
# radio button
["sync", _("&Synchronize without Daemon")],
# radio button
["boot", _("Now and on &Boot")]
]
end

def init
self.value = if Yast::NtpClient.synchronize_time
"sync"
elsif Yast::NtpClient.run_service
"boot"
else
"never"
end
end

def handle
# TODO: display interval for sync without daemon
nil
end

def store
Yast::NtpClient.run_service = value == "boot"
Yast::NtpClient.synchronize_time = value == "sync"
end
end

class ServersTable < CWM::Table
def initialize
textdomain "ntp-client"
end

def header
[
# table header for list of servers
_("Synchronization Servers")
]
end

def items
Yast::NtpClient.ntp_conf.pools.keys.map do |server|
[server, server]
end
end
end
end

0 comments on commit cc5c8d2

Please sign in to comment.