Class: Y2Network::Dialogs::AddInterface
- Inherits:
-
CWM::Dialog
- Object
- CWM::Dialog
- Y2Network::Dialogs::AddInterface
- Defined in:
- src/lib/y2network/dialogs/add_interface.rb
Overview
Dialog which starts new device creation
Instance Method Summary collapse
-
#abort_button ⇒ Object
as it is a sub dialog it can only cancel and cannot abort.
-
#back_button ⇒ Object
no back button for add dialog.
- #contents ⇒ Object
-
#initialize(default: nil) ⇒ AddInterface
constructor
A new instance of AddInterface.
-
#legacy_init ⇒ Object
initialize legacy stuff, that should be removed soon.
-
#run ⇒ Y2Network::InterfaceConfigBuilder?
Returns new builder when type selected or nil if canceled.
-
#should_open_dialog? ⇒ Boolean
always open new dialog.
Constructor Details
#initialize(default: nil) ⇒ AddInterface
Returns a new instance of AddInterface.
33 34 35 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 33 def initialize(default: nil) @type_widget = Widgets::InterfaceType.new(default: default ? default.short_name : nil) end |
Instance Method Details
#abort_button ⇒ Object
as it is a sub dialog it can only cancel and cannot abort
80 81 82 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 80 def Yast::Label.CancelButton end |
#back_button ⇒ Object
no back button for add dialog
75 76 77 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 75 def "" end |
#contents ⇒ Object
37 38 39 40 41 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 37 def contents HBox( @type_widget ) end |
#legacy_init ⇒ Object
initialize legacy stuff, that should be removed soon
44 45 46 47 48 49 50 51 52 53 54 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 44 def legacy_init # FIXME: This is for backward compatibility only # dhclient needs to set just one dhcp enabled interface to # DHCLIENT_SET_DEFAULT_ROUTE=yes. Otherwise interface is selected more # or less randomly (bnc#868187). However, UI is not ready for such change yet. # As it could easily happen that all interfaces are set to "no" (and # default route is unreachable in such case) this explicit setup was # added. # FIXME: not implemented in network-ng Yast::LanItems.set_default_route = true end |
#run ⇒ Y2Network::InterfaceConfigBuilder?
Returns new builder when type selected or nil if canceled
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 57 def run legacy_init ret = super log.info "AddInterface result #{ret}" ret = :back if ret == :abort return if ret == :back # TODO: use factory to get proper builder builder = InterfaceConfigBuilder.for(InterfaceType.from_short_name(@type_widget.result)) proposed_name = Yast::Lan.yast_config.interfaces.free_name(@type_widget.result) builder.name = proposed_name builder end |
#should_open_dialog? ⇒ Boolean
always open new dialog
85 86 87 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 85 def should_open_dialog? true end |