diff --git a/src/lib/y2ntp_client/widgets.rb b/src/lib/y2ntp_client/widgets.rb index b1b5c2ee..9bc00abb 100644 --- a/src/lib/y2ntp_client/widgets.rb +++ b/src/lib/y2ntp_client/widgets.rb @@ -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 @@ -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