Class: Y2Network::Widgets::Startmode

Inherits:
CWM::ComboBox
  • Object
show all
Defined in:
src/lib/y2network/widgets/startmode.rb

Instance Method Summary collapse

Constructor Details

#initialize(config, plug_priority_widget) ⇒ Startmode


26
27
28
29
30
31
# File 'src/lib/y2network/widgets/startmode.rb', line 26

def initialize(config, plug_priority_widget)
  textdomain "network"

  @config = config
  @plug_priority_widget = plug_priority_widget
end

Instance Method Details

#handleObject


50
51
52
53
54
# File 'src/lib/y2network/widgets/startmode.rb', line 50

def handle
  value == "ifplugd" ? @plug_priority_widget.enable : @plug_priority_widget.disable

  nil
end

#helpObject


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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'src/lib/y2network/widgets/startmode.rb', line 56

def help
  # tricky init only to not break long help text translations
  items_help =
    [
      # TRANSLATORS: help text for Device Activation
      _(
        "<p><b>Manually</b>: You control the interface manually\n" \
          "via 'ifup' or 'qinternet' (see 'User Controlled' below).</p>\n"
      ),
      # TRANSLATORS: help text for Device Activation
      _(
        "<b>On Cable Connection</b>:\n" \
          "The interface is watched for whether there is a physical\n" \
          "network connection. That means either the cable is connected or the\n" \
          "wireless interface can connect to an access point.\n"
      ),
      # TRANSLATORS: help text for Device Activation
      _(
        "With <b>On Hotplug</b>,\n" \
          "the interface is set up as soon as it is available. This is\n" \
          "nearly the same as 'At Boot Time', but does not result in an error at\n" \
          "boot time if the interface is not present.\n"
      ),
      # TRANSLATORS: help text for Device Activation
      _(
        "Using <b>On NFSroot</b> is similar to <tt>auto</tt>. Interfaces with this startmode will never\n" \
          "be shut down via <tt>rcnetwork stop</tt>. <tt>ifdown <iface></tt> is still available.\n" \
          "Use this if you have an NFS or iSCSI root filesystem.\n"
      )
    ]

  # Device activation main help. The individual parts will be
  # substituted as %1
  Yast::Builtins.sformat(
    _(
      "<p><b><big>Device Activation</big></b></p> \n" \
        "<p>Choose when to bring up the network interface. <b>At Boot Time</b> activates it during system boot, \n" \
        "<b>Never</b> does not start the device.\n" \
        "%1</p>\n"
    ),
    items_help.join(" ")
  )
end

#initObject


41
42
43
44
# File 'src/lib/y2network/widgets/startmode.rb', line 41

def init
  self.value = @config.startmode.name
  handle
end

#itemsObject


100
101
102
103
104
# File 'src/lib/y2network/widgets/startmode.rb', line 100

def items
  Y2Network::Startmode.all.map do |mode|
    [mode.to_s, mode.to_human_string]
  end
end

#labelObject


37
38
39
# File 'src/lib/y2network/widgets/startmode.rb', line 37

def label
  _("Activate &Device")
end

#optObject


33
34
35
# File 'src/lib/y2network/widgets/startmode.rb', line 33

def opt
  [:notify]
end

#storeObject


46
47
48
# File 'src/lib/y2network/widgets/startmode.rb', line 46

def store
  @config.startmode = value
end