Class: Y2Network::Widgets::InterfaceName
- Inherits:
-
CWM::ComboBox
- Object
- CWM::ComboBox
- Y2Network::Widgets::InterfaceName
- Defined in:
- src/lib/y2network/widgets/interface_name.rb
Instance Method Summary collapse
- #help ⇒ Object
- #init ⇒ Object
-
#initialize(settings) ⇒ InterfaceName
constructor
A new instance of InterfaceName.
- #items ⇒ Object
- #label ⇒ Object
- #opt ⇒ Object
- #store ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize(settings) ⇒ InterfaceName
Returns a new instance of InterfaceName.
29 30 31 32 33 34 |
# File 'src/lib/y2network/widgets/interface_name.rb', line 29 def initialize(settings) textdomain "network" @settings = settings @old_name = @settings.name end |
Instance Method Details
#help ⇒ Object
44 45 46 47 |
# File 'src/lib/y2network/widgets/interface_name.rb', line 44 def help # FIXME: missing. Try to explain what it affect. Especially for fake devices "" end |
#init ⇒ Object
49 50 51 52 |
# File 'src/lib/y2network/widgets/interface_name.rb', line 49 def init self.value = @settings.name Yast::UI.ChangeWidget(Id(), :ValidChars, @settings.name_valid_characters) end |
#items ⇒ Object
54 55 56 57 58 |
# File 'src/lib/y2network/widgets/interface_name.rb', line 54 def items @settings.proposed_names.map do |name| [name, name] end end |
#label ⇒ Object
36 37 38 |
# File 'src/lib/y2network/widgets/interface_name.rb', line 36 def label _("&Configuration Name") end |
#opt ⇒ Object
40 41 42 |
# File 'src/lib/y2network/widgets/interface_name.rb', line 40 def opt [:editable, :hstretch] end |
#store ⇒ Object
82 83 84 85 86 |
# File 'src/lib/y2network/widgets/interface_name.rb', line 82 def store return if @settings.name == value @settings.rename_interface(value) end |
#validate ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'src/lib/y2network/widgets/interface_name.rb', line 60 def validate if @old_name != value && @settings.name_exists?(value) Yast::Popup.Error( format(_("Configuration name %s already exists.\nChoose a different one."), value) ) focus return false end if !@settings.valid_name?(value) # TODO: write in popup what is limitations Yast::Popup.Error( format(_("Configuration name %s is invalid.\nChoose a different one."), value) ) focus return false end true end |