/[libconf]/libconf/applications/network/lan_conf
ViewVC logotype

Diff of /libconf/applications/network/lan_conf

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dams, Tue Oct 21 16:17:28 2003 UTC revision 1.2 by dams, Sun Nov 2 17:55:50 2003 UTC
# Line 39  gtkadd($window, Line 39  gtkadd($window,
39                           ),                           ),
40                 )                 )
41        );        );
42    
43    # global notebook page
44  $main_notebook->append_page(my $global_notebook = new Gtk2::Notebook, Gtk2::Label->new(N('Global parameters')));  $main_notebook->append_page(my $global_notebook = new Gtk2::Notebook, Gtk2::Label->new(N('Global parameters')));
45  $global_notebook->set_tab_pos('right');  $global_notebook->set_tab_pos('right');
46  $global_notebook->append_page(gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,5), 5),  $global_notebook->append_page(gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,5), 5),
47                                         0, gtkadd(new Gtk2::Frame(N('General network parameters')),                                         0, gtkadd(new Gtk2::Frame(N('General network parameters')),
48                                                   gtkpack__(gtkset_border_width(Gtk2::VBox->new(0,5), 5),                                                   gtkset_border_width(my $general_net_table = mycreate_packtable({},
49                                                             getBestWidget($sys_network->{general}, '{NETWORKING}', N('Activate networking')),                                                       [ getBestWidget($sys_network->{general}, '{NETWORKING}', 'Activate networking') ],
50                                                             gtkpack__(Gtk2::HBox->new(0,5), 'Hostname : ', getBestWidget($sys_network->{general}, N('{HOSTNAME}'))),                                                       [ N('Hostname'), getBestWidget($sys_network->{general}, '{HOSTNAME}') ],
51                                                             gtkpack__(Gtk2::HBox->new(0,5), 'Gateway : ', getBestWidget($sys_network->{general}, N('{GATEWAY}'))),                                                       [ N('Gateway'), getBestWidget($sys_network->{general}, '{GATEWAY}') ],
52                                                             gtkpack__(Gtk2::HBox->new(0,5), 'Gateway device : ', getBestWidget($sys_network->{general}, N('{GATEWAYDEV}'))),                                                       [ N('Gateway device'), getBestWidget($sys_network->{general}, '{GATEWAYDEV}') ],
53                                                             gtkpack__(Gtk2::HBox->new(0,5), 'NIS domain  : ', getBestWidget($sys_network->{general}, N('{NISDOMAIN}'))),                                                       [ N('NIS domain'), getBestWidget($sys_network->{general}, '{NISDOMAIN}') ],
54                                                             getBestWidget($sys_network->{general}, '{FORWARD_IPV4}', N('Forward IPV4')),                                                       [ getBestWidget($sys_network->{general}, '{FORWARD_IPV4}', N('Forward IPV4')) ],
55                                                             getBestWidget($sys_network->{general}, '{DEFRAG_IPV4}', N('Defrag IPV4')),                                                       [ getBestWidget($sys_network->{general}, '{DEFRAG_IPV4}', N('Defrag IPV4')) ],
56                                                             getBestWidget($sys_network->{general}, '{VLAN}', 'Virtual LAN'),                                                       [ getBestWidget($sys_network->{general}, '{VLAN}', N('Virtual LAN')) ],
57                                                            ),                                                                                          ), 5),
58                                                  ),                                                  ),
59                                        ),                                        ),
60                                Gtk2::Label->new(N('General')),                                Gtk2::Label->new(N('General')),
61                               );                               );
62  $global_notebook->append_page(gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,5), 5),  $global_notebook->append_page(gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,5), 5),
63                                     0, gtkadd(new Gtk2::Frame(N('IPX')),                                     0, gtkadd(new Gtk2::Frame(N('IPX')),
64                                          gtkpack__(gtkset_border_width(Gtk2::VBox->new(0,5), 5),                                               gtkset_border_width(mycreate_packtable({},
65                                                    getBestWidget($sys_network->{general}, '{IPX}', N('Activate IPX')),                                                    [ getBestWidget($sys_network->{general}, '{IPX}', N('Activate IPX')) ],
66                                                    gtkpack__(Gtk2::HBox->new(0,5), 'IPX Auto primary : ', getBestWidget($sys_network->{general}, N('{IPXAUTOPRIMARY}'))),                                                    [ N('IPX Auto primary'), getBestWidget($sys_network->{general}, '{IPXAUTOPRIMARY}') ],
67                                                    gtkpack__(Gtk2::HBox->new(0,5), 'IPX Auto frame : ', getBestWidget($sys_network->{general}, N('{IPXAUTOFRAME}'))),                                                    [ N('IPX Auto frame'), getBestWidget($sys_network->{general}, '{IPXAUTOFRAME}') ],
68                                                    gtkpack__(Gtk2::HBox->new(0,5), 'IPX internal net num : ', getBestWidget($sys_network->{general}, N('{IPXINTERNALNODENUM}'))),                                                    [ N('IPX internal net num'), getBestWidget($sys_network->{general}, '{IPXINTERNALNODENUM}') ],
69                                                    gtkpack__(Gtk2::HBox->new(0,5), 'IPX internal node num  : ', getBestWidget($sys_network->{general}, N('{IPXINTERNALNODENUM}'))),                                                    [ N('IPX internal node num'), getBestWidget($sys_network->{general}, '{IPXINTERNALNODENUM}') ],
70                                                    gtkpack__(Gtk2::HBox->new(0,5), 'IFPLUGD args  : ', getBestWidget($sys_network->{general}, N('{IFPLUGD_ARGS}'))),                                                    [ N('IFPLUGD args'), getBestWidget($sys_network->{general}, '{IFPLUGD_ARGS}') ],
71                                                   ),                                                   ), 5),
72                                              ),                                              ),
73                                        ),                                        ),
74                                Gtk2::Label->new(N('IPX')),                                Gtk2::Label->new(N('IPX')),
# Line 80  $global_notebook->append_page(gtkpack_(g Line 82  $global_notebook->append_page(gtkpack_(g
82                                          getBestWidget($sys_network->{general}, '{IPV6_AUTOCONF}', N('IPV6 Autoconf')),                                          getBestWidget($sys_network->{general}, '{IPV6_AUTOCONF}', N('IPV6 Autoconf')),
83                                          getBestWidget($sys_network->{general}, '{IPV6_ROUTER}', N('IPV6 Router')),                                          getBestWidget($sys_network->{general}, '{IPV6_ROUTER}', N('IPV6 Router')),
84                                          getBestWidget($sys_network->{general}, '{IPV6_AUTOTUNNEL}', N('IPV6 Autotunnel')),                                          getBestWidget($sys_network->{general}, '{IPV6_AUTOTUNNEL}', N('IPV6 Autotunnel')),
85                                          gtkpack__(Gtk2::HBox->new(0,5), 'IPV6 Default gateway : ', getBestWidget($sys_network->{general}, N('{IPV6_DEFAULTGW}'))),                                          gtkpack__(Gtk2::HBox->new(0,5), N('IPV6 Default gateway : '), getBestWidget($sys_network->{general}, '{IPV6_DEFAULTGW}')),
86                                          gtkpack__(Gtk2::HBox->new(0,5), 'IPV6 Default device : ', getBestWidget($sys_network->{general}, N('{IPV6_DEFAULTDEV}'))),                                          gtkpack__(Gtk2::HBox->new(0,5), N('IPV6 Default device : '), getBestWidget($sys_network->{general}, '{IPV6_DEFAULTDEV}')),
87                                          gtkpack__(Gtk2::HBox->new(0,5), 'IPV6 Radvd pidfile : ', getBestWidget($sys_network->{general}, N('{IPV6_RADVD_PIDFILE}'))),                                          gtkpack__(Gtk2::HBox->new(0,5), N('IPV6 Radvd pidfile : '), getBestWidget($sys_network->{general}, '{IPV6_RADVD_PIDFILE}')),
88                                          gtkpack__(Gtk2::HBox->new(0,5), 'IPV6 to IPV4 Radvd pidfile : ', getBestWidget($sys_network->{general}, N('{IPV6TO4_RADVD_PIDFILE}'))),                                          gtkpack__(Gtk2::HBox->new(0,5), N('IPV6 to IPV4 Radvd pidfile : '), getBestWidget($sys_network->{general}, '{IPV6TO4_RADVD_PIDFILE}')),
89                                          gtkpack__(Gtk2::HBox->new(0,5), 'IPV6 Radvd trigger action : ', getBestWidget($sys_network->{general}, N('{IPV6_RADVD_TRIGGER_ACTION}'))),                                          gtkpack__(Gtk2::HBox->new(0,5), N('IPV6 Radvd trigger action : '), getBestWidget($sys_network->{general}, '{IPV6_RADVD_TRIGGER_ACTION}')),
90                                         ),                                         ),
91                               ),                               ),
92                                        ),                                        ),
93                                Gtk2::Label->new(N('IPV6')),                                Gtk2::Label->new(N('IPV6')),
94                               );                               );
95    
96    # interfaces notebook page
97    my $int_clist_tree_model = Gtk2::ListStore->new('Glib::String', 'Glib::String', 'Glib::String');
98    $main_notebook->append_page(gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,5), 5),
99                                         0, gtkadd(Gtk2::Frame->new(N('Network Interfaces')),
100                                                   gtkpack__(gtkset_border_width(Gtk2::HBox->new(0,5), 5),
101                                                             my $int_clist = Gtk2::TreeView->new_with_model($int_clist_tree_model),
102                                                             gtkadd(gtkset_layout(my $int_button_box = new Gtk2::VButtonBox, 'end'),
103                                                                    gtksignal_connect(new Gtk2::Button(N("Add")), clicked => sub { }),
104                                                                    gtksignal_connect(new Gtk2::Button(N("Configure")), clicked => sub { }),
105                                                                    gtksignal_connect(new Gtk2::Button(N("Delete")), clicked => sub { }),
106                                                                   )
107                                                            ),
108                                                  ),
109                                        ), Gtk2::Label->new(N('Interfaces'))
110                               );
111    $int_clist->append_column(Gtk2::TreeViewColumn->new_with_attributes(N('Name'), Gtk2::CellRendererText->new, 'text' => 0));
112    $int_clist->append_column(Gtk2::TreeViewColumn->new_with_attributes(N('IP address'), Gtk2::CellRendererText->new, 'text' => 1));
113    $int_clist->append_column(Gtk2::TreeViewColumn->new_with_attributes(N('Mask'), Gtk2::CellRendererText->new, 'text' => 2));
114    
115    foreach my $key (keys %{$sys_network->{interfaces}}) {
116        $int_clist_tree_model->append_set(0 => $key, 1 => $sys_network->{interfaces}{$key}{IPADDR}, 2 => $sys_network->{interfaces}{$key}->{NETMASK});
117    }
118    # while (my ($key, $value) = %{$sys_network->{interfaces}}) {
119    #     $int_clist_tree_model->append_set(undef, [ 0 => $key, 1 => $value->{IPADDR}, 2 => $value->{NETMASK} ]);
120    # }
121    $int_clist->show_all();
122    
123    
124  # we make everything visible in the window  # we make everything visible in the window
125  $window->show_all();  $window->show_all();
126    
127  #and we start the Gtk2 main loop.  #and we start the Gtk2 main loop.
128  Gtk2->main;  Gtk2->main;
129    
130    
131    
132    sub mycreate_packtable {
133        my ($options, @l) = @_;
134        my $w = Gtk2::Table->new(0, 0, $options->{homogeneous} || 0);
135        each_index {
136            my ($i, $l) = ($::i, $_);
137            if (@$l == 1 ) {
138                $w->attach($l->[0], 0, 2, $i, $i + 1, 'fill', 'fill', 5, 0);
139            } else {
140                each_index {
141                    my $j = $::i;
142                    if ($_) {
143                        ref $_ or $_ = gtkpack_(Gtk2::HBox->new(0,0),
144                                                1, Gtk2::HBox->new(0,0),
145                                                0, Gtk2::Label->new($_)
146                                               );
147                        $w->attach($_, $j, $j + 1, $i, $i + 1, 'fill', 'fill', 5, 0);
148                        $_->show;
149                    }
150                } @$l;
151            }
152        } @l;
153        $w->set_col_spacings($options->{col_spacings} || 0);
154        $w->set_row_spacings($options->{row_spacings} || 5);
155        $w
156    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26