summaryrefslogtreecommitdiff
path: root/themes/openSUSE/src/dia_net.inc
blob: 645644315780e92c68dd6835a7be75937e4a85fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%
% network setup dialogs.
%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Some global vars.
%
/.net_no	0 def
/.net_dhcp	1 def
/.net_static	2 def

/net.default .net_no def
/net.config_type .undef def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Build menu list.
%
% ( ) ==> ( )
%
/net.init {
  /xmenu.net .xm_size array def

  /xmenu xmenu.net def

  xmenu .xm_list [ /txt_no_network "DHCP" /txt_manual_network ] put

  xmenu .xm_title /txt_network_config put

  xmenu .xm_current net.default put

  /input.net.static [ 4 { 127 string } repeat ] def

  % just once (see install.init)
  /net.init { } def
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Update network selection menu.
%
% ( ) ==> ( )
%
/net.update {
  /xmenu xmenu.net def

  /net.config_type xmenu .xm_current get def

  xmenu .xm_current get .net_static eq {
    net.dialog
  } if

  /window.action actRedrawPanel def
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Show net selection menu.
%
% ( ) => ( )
%
/panel.net {
  "net" help.setcontext

  window.xmenu
  dup .xmenu xmenu.net put
  dup .xmenu.update /net.update put
  dup window.init
      window.show
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Return width of panel entry.
%
% ( ) => ( width )
%
/panel.net.width {
  /xmenu xmenu.net def

  pmenu.width
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Redraw panel entry.
%
% ( panel ) => ( )
%
/panel.net.update {
  /xmenu xmenu.net def

  pmenu.panel.update
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/net.dialog {
  /dia window.dialog def

  dia .text "" put

  dia .title txt_manual_network_title put

  % ip, netmask, gateway, dns nameserver, domain

  % Must all be of same size!
  dia .ed.list 4 array put
  dia .ed.buffer.list input.net.static put
  dia .ed.text.list [ txt_host_ip txt_gateway_ip txt_nameservers txt_domain_name ] put

  dia .ed.focus 0 put
  dia .ed.width 300 put

  dia .buttons [
    button.ok button.default actNothing button.setaction
    button.cancel button.notdefault /net.static.abort button.setaction
    config.rtl { exch } if
  ] put

  dia window.init
  dia window.show
} def


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/net.static.abort {
  xmenu.net .xm_current over .xm_last get put
  actNothing
} def