Class: Y2Network::Widgets::Destination
- Inherits:
-
CWM::CustomWidget
- Object
- CWM::CustomWidget
- Y2Network::Widgets::Destination
- Defined in:
- src/lib/y2network/widgets/destination.rb
Instance Method Summary collapse
- #contents ⇒ Object
- #handle ⇒ Object
- #help ⇒ Object
- #init ⇒ Object
-
#initialize(route) ⇒ Destination
constructor
A new instance of Destination.
- #store ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize(route) ⇒ Destination
Returns a new instance of Destination.
32 33 34 35 36 37 |
# File 'src/lib/y2network/widgets/destination.rb', line 32 def initialize(route) super() textdomain "network" @route = route end |
Instance Method Details
#contents ⇒ Object
39 40 41 42 43 44 |
# File 'src/lib/y2network/widgets/destination.rb', line 39 def contents HBox( CheckBox(Id(:default), Opt(:notify, :hstretch), _("Default Route")), InputField(Id(:destination), Opt(:hstretch), _("&Destination")) ) end |
#handle ⇒ Object
54 55 56 57 58 |
# File 'src/lib/y2network/widgets/destination.rb', line 54 def handle default_value ? disable_destination : enable_destination nil end |
#help ⇒ Object
46 47 48 49 50 51 52 |
# File 'src/lib/y2network/widgets/destination.rb', line 46 def help _( "<p><b>Default Route</b> matches all destination for a given IP " \ "address family as long as no specific route matches. <b>Destination</b>" \ " specifies the IP address (in CIDR format) for which the route applies.</p>" ) end |
#init ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'src/lib/y2network/widgets/destination.rb', line 60 def init Yast::UI.ChangeWidget(Id(:destination), :ValidChars, Yast::IP.ValidChars + "/") val = @route.to Yast::UI.ChangeWidget(Id(:default), :Value, val == :default) if val != :default Yast::UI.ChangeWidget(Id(:destination), :Value, (val.to_s + "/" + val.prefix.to_s)) end handle end |
#store ⇒ Object
78 79 80 |
# File 'src/lib/y2network/widgets/destination.rb', line 78 def store @route.to = default_value ? :default : IPAddr.new(destination_value) end |