Class: Y2Network::Widgets::Tunnel

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

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ Tunnel

Returns a new instance of Tunnel.



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

def initialize(settings)
  super()
  textdomain "network"
  @settings = settings
end

Instance Method Details

#contentsObject



34
35
36
37
38
39
40
41
# File 'src/lib/y2network/widgets/tunnel.rb', line 34

def contents
  VBox(
    HBox(
      InputField(Id(:tunnel_owner), _("Tunnel owner")),
      InputField(Id(:tunnel_group), _("Tunnel group"))
    )
  )
end

#helpObject



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

def help
  "" # TODO: cannot find it in old helps
end

#initObject



47
48
49
50
51
52
53
# File 'src/lib/y2network/widgets/tunnel.rb', line 47

def init
  log.info "init tunnel with #{@settings.inspect}"
  owner, group = @settings.tunnel_user_group

  Yast::UI.ChangeWidget(:tunnel_owner, :Value, owner || "")
  Yast::UI.ChangeWidget(:tunnel_group, :Value, group || "")
end

#storeObject



55
56
57
58
59
60
# File 'src/lib/y2network/widgets/tunnel.rb', line 55

def store
  @settings.assign_tunnel_user_group(
    Yast::UI.QueryWidget(:tunnel_owner, :Value),
    Yast::UI.QueryWidget(:tunnel_group, :Value)
  )
end