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

Returns a new instance of Startmode.



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

def initialize(config, plug_priority_widget)
  super()
  textdomain "network"

  @config = config
  @plug_priority_widget = plug_priority_widget
end

Instance Method Details

#handleObject



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

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

  nil
end

#helpObject



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
99
100
101
102
# File 'src/lib/y2network/widgets/startmode.rb', line 57

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



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

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

#itemsObject



104
105
106
107
108
# File 'src/lib/y2network/widgets/startmode.rb', line 104

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

#labelObject



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

def label
  _("Activate &Device")
end

#optObject



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

def opt
  [:notify]
end

#storeObject



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

def store
  @config.startmode = value
end