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
# File 'src/lib/y2network/widgets/tunnel.rb', line 28

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

Instance Method Details

#contentsObject


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

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

#helpObject


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

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

#initObject


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

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


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

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