Class: Y2Network::Dialogs::EditInterface

Inherits:
CWM::Dialog
  • Object
show all
Defined in:
src/lib/y2network/dialogs/edit_interface.rb

Overview

Dialog to Edit Interface. Content of the dialog heavily depends on the interface type and change of type is not allowed after dialog creation.

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ EditInterface

Returns a new instance of EditInterface.

Parameters:

  • settings (InterfaceBuilder)

    object holding interface configuration modified by the dialog.


38
39
40
41
42
# File 'src/lib/y2network/dialogs/edit_interface.rb', line 38

def initialize(settings)
  @settings = settings

  textdomain "network"
end

Instance Method Details

#abort_buttonObject

abort is just cancel as this is a sub dialog


76
77
78
# File 'src/lib/y2network/dialogs/edit_interface.rb', line 76

def abort_button
  Yast::Label.CancelButton
end

#back_buttonObject

removes back button when editing device, but keep it when this dialog follows adding new interface


82
83
84
# File 'src/lib/y2network/dialogs/edit_interface.rb', line 82

def back_button
  @settings.newly_added? ? Yast::Label.BackButton : ""
end

#contentsObject


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
# File 'src/lib/y2network/dialogs/edit_interface.rb', line 48

def contents
  # if there is addr, make it initial unless for wifi, where first one should be wifi specific
  # configs
  addr_tab = Widgets::AddressTab.new(@settings)
  addr_tab.initial = true unless @settings.type.wireless?

  tabs = case @settings.type.short_name
  when "vlan", "dummy"
    [Widgets::GeneralTab.new(@settings), addr_tab]
  when "tun", "tap"
    [addr_tab]
  when "br"
    [Widgets::GeneralTab.new(@settings), addr_tab, Widgets::BridgePorts.new(@settings)]
  when "bond"
    [Widgets::GeneralTab.new(@settings), addr_tab, Widgets::BondPortsTab.new(@settings)]
  when "wlan"
    wireless = Widgets::WirelessTab.new(@settings)
    wireless.initial = true
    [Widgets::GeneralTab.new(@settings), wireless, addr_tab,
     Widgets::HardwareTab.new(@settings)]
  else
    [Widgets::GeneralTab.new(@settings), addr_tab, Widgets::HardwareTab.new(@settings)]
  end

  VBox(CWM::Tabs.new(*tabs))
end

#titleObject


44
45
46
# File 'src/lib/y2network/dialogs/edit_interface.rb', line 44

def title
  _("Network Card Setup")
end