-
Notifications
You must be signed in to change notification settings - Fork 15
/
main.rb
81 lines (71 loc) · 1.8 KB
/
main.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
require "yast"
require "cwm/dialog"
require "y2ntp_client/widgets/main_widgets"
Yast.import "Label"
Yast.import "NtpClient"
Yast.import "Stage"
module Y2NtpClient
module Dialog
# Main entry point for Ntp Client
class Main < CWM::Dialog
def initialize
textdomain "ntp-client"
end
def title
# dialog caption
_("NTP Configuration")
end
def contents
replace_point = CWM::ReplacePoint.new(widget: CWM::Empty.new("empty_interval"))
table = Widgets::ServersTable.new
VBox(
HBox(
HWeight(1, Widgets::NtpStart.new(replace_point)),
HSpacing(1),
HWeight(1, replace_point)
),
VSpacing(1),
Left(Widgets::PolicyCombo.new),
VSpacing(1),
*hardware_clock_widgets,
table,
HSpacing(0.2),
Left(HBox(
Widgets::AddPoolButton.new,
HSpacing(),
Widgets::EditPoolButton.new(table),
HSpacing(),
Widgets::DeletePoolButton.new(table)
))
)
end
def run
loop do
res = super
return res if res != :redraw
end
end
def abort_button
Yast::Label.CancelButton
end
def hardware_clock_widgets
if Yast::NtpClient.ntp_conf.hardware_clock?
[
Label(_("Hardware clock configured as source. YaST will keep it untouched.")),
VSpacing(1)
]
else
[Empty()]
end
end
def back_button
# no back button
""
end
def next_button
# FIXME: it probably cannot run in initial stage, so not needed
Yast::Stage.initial ? Yast::Label.AcceptButton : Yast::Label.OKButton
end
end
end
end