diff options
author | Damien Chaumette <dchaumette@mandriva.com> | 2004-04-23 13:43:26 +0000 |
---|---|---|
committer | Damien Chaumette <dchaumette@mandriva.com> | 2004-04-23 13:43:26 +0000 |
commit | f28d850401a26239b89895fedc2c043408abf0df (patch) | |
tree | 7e8efadfe32862638ffbb27bd38e466f3f71dbd6 | |
parent | f603d7cc0fd45bff0389722e376460c6bab121a3 (diff) | |
download | drakx-backup-do-not-use-f28d850401a26239b89895fedc2c043408abf0df.tar drakx-backup-do-not-use-f28d850401a26239b89895fedc2c043408abf0df.tar.gz drakx-backup-do-not-use-f28d850401a26239b89895fedc2c043408abf0df.tar.bz2 drakx-backup-do-not-use-f28d850401a26239b89895fedc2c043408abf0df.tar.xz drakx-backup-do-not-use-f28d850401a26239b89895fedc2c043408abf0df.zip |
change packing to get a better GUI
-rwxr-xr-x | perl-install/standalone/drakconnect | 179 |
1 files changed, 95 insertions, 84 deletions
diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect index 1e878eec8..39e6c960b 100755 --- a/perl-install/standalone/drakconnect +++ b/perl-install/standalone/drakconnect @@ -146,7 +146,7 @@ $window1->{window}->add( } ), ), - 1, gtkadd(Gtk2::Frame->new(N("LAN configuration")), + 1, gtkadd(gtkcreate_frame(N("LAN configuration")), gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,0), 5), 0, $list, 0, Gtk2::HBox->new(0,0), @@ -214,12 +214,15 @@ sub manage { }; $window->{rwindow}->add(gtkpack_(Gtk2::VBox->new, - 0, $interface_menu = gtksignal_connect(Gtk2::OptionMenu->new, - changed => sub { - $selected = $interface_menu->get_text; - $notebook->set_current_page($p->{$selected}{gui}{index}); - }, - ), + 0, gtkpack__(Gtk2::HBox->new, + Gtk2::Label->new(N("Device selected")), + $interface_menu = gtksignal_connect(Gtk2::OptionMenu->new, + changed => sub { + $selected = $interface_menu->get_text; + $notebook->set_current_page($p->{$selected}{gui}{index}); + }, + ), + ), 1, $notebook, 0, create_okcancel(my $oc = { @@ -306,54 +309,56 @@ sub build_notebook { my $is_ethernet = $interface =~ /eth|ath|wlan/; if ($intf->{pages}{'TCP/IP'}) { - gtkpack_($gui->{sheet}{'TCP/IP'} = Gtk2::VBox->new(0,0), - if_($is_ethernet, - 0, $gui->{intf}{BOOTPROTO} = gtksignal_connect(Gtk2::OptionMenu->new, - changed => sub { - return if !$_[0]->realized; - my $proto = $gui->{intf}{BOOTPROTO}; - my $protocol = $intf->{BOOTPROTO} = { reverse %{$proto->{protocols}} }->{$proto->get_text}; - - foreach ($gui->{intf}{IPADDR}, $gui->{intf}{NETMASK}, $gui->{netc}{GATEWAY}) { - $_->set_sensitive($protocol eq "static" ? 1 : 0) - }; $apply->() }, - ), - ), - 1, gtkpack(Gtk2::HBox->new(0,0), - gtkpack_(Gtk2::VBox->new(0,0), - 0, gtkpack_(Gtk2::VBox->new(0,0), - 1, Gtk2::Label->new(N("IP address")), - 0, gtksignal_connect($gui->{intf}{IPADDR} = Gtk2::Entry->new, - key_press_event => $apply), - ), - 0, gtkpack_(Gtk2::VBox->new(0,0), - 1, Gtk2::Label->new(N("Netmask")), - 0, gtksignal_connect($gui->{intf}{NETMASK} = Gtk2::Entry->new, - key_press_event => $apply), - ), - if_($is_ethernet, - 0, gtkpack_(Gtk2::VBox->new(0,0), - 1, Gtk2::Label->new(N("Gateway")), - 0, gtksignal_connect($gui->{netc}{GATEWAY} = Gtk2::Entry->new, - key_press_event => $apply), - ), - ), - ), - Gtk2::VSeparator->new, - gtkpack_(Gtk2::VBox->new(0,0), - 1, gtkadd(Gtk2::Frame->new(N("DNS servers")), - gtkpack(Gtk2::VBox->new(0,0), - Gtk2::Label->new($intf->{dns1} || $netc->{dnsServer}), - Gtk2::Label->new($intf->{dns2} || $netc->{dnsServer2}), - Gtk2::Label->new($intf->{dns3} || $netc->{dnsServer3}), - ), - ), - 1, gtkadd(Gtk2::Frame->new(N("Search Domain")), - Gtk2::Label->new($intf->{domain} || $netc->{DOMAINNAME} || 'none'), - ), - ), - ), - ); + gtkpack($gui->{sheet}{'TCP/IP'} = Gtk2::HBox->new, + gtkadd(gtkcreate_frame(N("IP configuration")), + gtkpack_(my $vbox = Gtk2::VBox->new, + if_($is_ethernet, + 0, gtkpack__(Gtk2::HBox->new, + $gui->{intf}{BOOTPROTO} = gtksignal_connect(Gtk2::OptionMenu->new, + changed => sub { + return if !$_[0]->realized; + my $proto = $gui->{intf}{BOOTPROTO}; + my $protocol = $intf->{BOOTPROTO} = { reverse %{$proto->{protocols}} }->{$proto->get_text}; + + foreach ($gui->{intf}{IPADDR}, $gui->{intf}{NETMASK}, $gui->{netc}{GATEWAY}) { + $_->set_sensitive($protocol eq "static" ? 1 : 0) + }; $apply->() }, + ), + ), + ), + 0, gtkpack(Gtk2::VBox->new(1,0), + gtkpack__(Gtk2::HBox->new, Gtk2::Label->new(N("IP address"))), + gtkpack__(Gtk2::HBox->new, gtksignal_connect($gui->{intf}{IPADDR} = Gtk2::Entry->new, + key_press_event => $apply)), + ), + 0, gtkpack(Gtk2::VBox->new(1,0), + gtkpack__(Gtk2::HBox->new, Gtk2::Label->new(N("Netmask"))), + gtkpack__(Gtk2::HBox->new, gtksignal_connect($gui->{intf}{NETMASK} = Gtk2::Entry->new, + key_press_event => $apply)), + ), + if_($is_ethernet, + 0, gtkpack(Gtk2::VBox->new(1,0), + gtkpack__(Gtk2::HBox->new, Gtk2::Label->new(N("Gateway"))), + gtkpack__(Gtk2::HBox->new, gtksignal_connect($gui->{netc}{GATEWAY} = Gtk2::Entry->new, + key_press_event => $apply)), + ), + ), + ), + ), + gtkpack_(Gtk2::VBox->new, + 1, gtkadd(gtkcreate_frame(N("DNS servers")), + gtkpack(Gtk2::VBox->new(0,0), + Gtk2::Label->new($intf->{dns1} || $netc->{dnsServer}), + Gtk2::Label->new($intf->{dns2} || $netc->{dnsServer2}), + Gtk2::Label->new($intf->{dns3} || $netc->{dnsServer3})), + ), + 1, gtkadd(gtkcreate_frame(N("Search Domain")), + Gtk2::Label->new($intf->{domain} || $netc->{DOMAINNAME} || 'none'), + ), + ), + ); + $vbox->set_border_width(5); + if ($is_ethernet) { my $proto = $gui->{intf}{BOOTPROTO}; $proto->{protocols} = { static => N("static"), dhcp => N("DHCP") }; @@ -448,24 +453,26 @@ sub build_notebook { if ($interface_kind =~ /^speedtouch|sagem$/) { $gui->{description} = $interface_kind eq 'speedtouch' ? 'Alcatel|USB ADSL Modem (Speed Touch)' : 'Analog Devices Inc.|USB ADSL modem'; } - gtkpack_($gui->{sheet}{Account} = Gtk2::VBox->new(0,0), + gtkpack_($gui->{sheet}{Account} = Gtk2::VBox->new, if_($interface eq 'modem', - 0, gtkpack_(Gtk2::VBox->new(0,0), - 1, Gtk2::Label->new(N("Authentication")), - 0, $gui->{intf}{auth} = gtksignal_connect(Gtk2::OptionMenu->new, - changed => $apply), + 0, gtkpack(Gtk2::VBox->new(1,0), + gtkpack__(Gtk2::HBox->new, Gtk2::Label->new(N("Authentication"))), + gtkpack__(Gtk2::HBox->new, $gui->{intf}{auth} = gtksignal_connect(Gtk2::OptionMenu->new, + changed => $apply)), )), - map { (0, gtkpack_(Gtk2::VBox->new(0,0), - 1, Gtk2::Label->new($_->[0]), - 0, $gui->{intf}{$_->[1]} = gtksignal_connect(Gtk2::Entry->new, - key_press_event => $apply), - ), + map { (0, gtkpack(Gtk2::VBox->new(1,0), + gtkpack__(Gtk2::HBox->new, Gtk2::Label->new($_->[0])), + gtkpack__(Gtk2::HBox->new, $gui->{intf}{$_->[1]} = gtksignal_connect(Gtk2::Entry->new, + key_press_event => $apply)), + ), ); } ([ N("Account Login (user name)"), 'login' ], [ N("Account Password"), 'passwd' ], if_($interface =~ /^(isdn|modem)$/, [ N("Provider phone number"), $1 eq 'modem' ? 'phone' : 'phone_out' ]), ), ); + $gui->{sheet}{Account}->set_border_width(5); + my %auth_methods = map_index { $::i => $_ } N("PAP"), N("Terminal-based"), N("Script-based"), N("CHAP"), N("PAP/CHAP"); $gui->{intf}{auth}->set_popdown_strings(values %auth_methods); $gui->{intf}{auth}->set_text($auth_methods{$intf->{Authentication}}); @@ -475,11 +482,11 @@ sub build_notebook { if ($intf->{pages}{Modem}) { gtkpack($gui->{sheet}{Modem} = Gtk2::HBox->new(0,0), if_($interface eq 'modem', - gtkpack__(Gtk2::VBox->new(0,0), - (map { (gtkpack_(Gtk2::VBox->new(0,0), - 1, Gtk2::Label->new($_->[0]), - 0, $gui->{intf}{$_->[1]} = gtksignal_connect(Gtk2::OptionMenu->new, - changed => $apply), + gtkpack__(Gtk2::VBox->new(0,5), + (map { (gtkpack(Gtk2::VBox->new(1,0), + gtkpack__(Gtk2::HBox->new, Gtk2::Label->new($_->[0])), + gtkpack__(Gtk2::HBox->new, $gui->{intf}{$_->[1]} = gtksignal_connect(Gtk2::OptionMenu->new, + changed => $apply)), ), ), } ([ N("Flow control"), 'FlowControl' ], @@ -492,31 +499,33 @@ sub build_notebook { # ), ), Gtk2::VSeparator->new, - gtkpack__(new Gtk2::VBox(0,0), - gtksignal_connect($gui->{intf_bool}{UseLockFile} = Gtk2::CheckButton->new(N("Use lock file")), - toggled => $apply), - gtkpack(Gtk2::HBox->new(0,0), + gtkpack__(new Gtk2::VBox(0,10), + gtkpack__(Gtk2::HBox->new(0,5), Gtk2::Label->new(N("Modem timeout")), $gui->{intf}{Timeout} = gtksignal_connect(Gtk2::SpinButton->new(Gtk2::Adjustment->new($intf->{Timeout}, 0, 120, 1, 5, 0), 0, 0), value_changed => $apply), ), - gtksignal_connect($gui->{intf_bool}{WaitForDialTone} = Gtk2::CheckButton->new(N("Wait for dialup tone before dialing")), + gtksignal_connect($gui->{intf_bool}{UseLockFile} = Gtk2::CheckButton->new(N("Use lock file")), toggled => $apply), - gtkpack(Gtk2::HBox->new(0,0), + gtkpack__(Gtk2::HBox->new, gtksignal_connect($gui->{intf_bool}{WaitForDialTone} = Gtk2::CheckButton->new(N("Wait for dialup tone before dialing")), + toggled => $apply)), + gtkpack__(Gtk2::HBox->new(0,5), Gtk2::Label->new(N("Busy wait")), $gui->{intf}{BusyWait} = gtksignal_connect(Gtk2::SpinButton->new(Gtk2::Adjustment->new($intf->{BusyWait}, 0, 120, 1, 5, 0), 0, 0), value_changed => $apply), ), - Gtk2::Label->new(N("Modem sound")), - my @volume_radio = gtkradio('', N("Enable"), N("Disable")), + gtkpack__(Gtk2::HBox->new(0,5), + Gtk2::Label->new(N("Modem sound")), + gtkpack__(Gtk2::VBox->new(0,5), my @volume_radio = gtkradio('', N("Enable"), N("Disable"))), + ), ), ), if_($interface eq 'isdn', gtkpack_(Gtk2::VBox->new(0,0), - map { (0, gtkpack_(Gtk2::VBox->new(0,0), - 1, Gtk2::Label->new($_->[0]), - 0, $gui->{intf}{$_->[1]} = gtksignal_connect(Gtk2::Entry->new, - key_press_event => $apply), + map { (0, gtkpack(Gtk2::VBox->new(1,0), + gtkpack__(Gtk2::HBox->new, Gtk2::Label->new($_->[0])), + gtkpack__(Gtk2::HBox->new, $gui->{intf}{$_->[1]} = gtksignal_connect(Gtk2::Entry->new, + key_press_event => $apply)), ), ); } ([ N("Card IRQ"), 'irq' ], @@ -533,6 +542,8 @@ sub build_notebook { ), ), ); + $gui->{sheet}{Modem}->set_border_width(5); + $protocol_radio[0]->signal_connect(toggled => sub { $gui->{intf_radio}{protocol} = 2; $apply->() }); $protocol_radio[1]->signal_connect(toggled => sub { $gui->{intf_radio}{protocol} = 3; $apply->() }); $volume_radio[0]->signal_connect(toggled => sub { $gui->{intf_radio}{Volume} = 1; $apply->() }); @@ -959,7 +970,7 @@ Please run \"Internet access\" in control center.")); $dialog->{rwindow}->add(gtkpack_(Gtk2::VBox->new, 0, Gtk2::Label->new(N("Internet Connection Configuration")), - 1, gtkadd(Gtk2::Frame->new(N("Internet access")), + 1, gtkadd(gtkcreate_frame(N("Internet access")), gtkset_border_width(create_packtable({ col_spacings => 5, row_spacings => 5, homogenous => 1 }, [ Gtk2::Label->new(N("Connection type: ")), Gtk2::Label->new(translate($netcnx->{type})) ], @@ -969,7 +980,7 @@ Please run \"Internet access\" in control center.")); ), 5), ), - 1, gtkadd(Gtk2::Frame->new(N("Parameters")), gtkset_border_width($param_vbox, 5)), + 1, gtkadd(gtkcreate_frame(N("Parameters")), gtkset_border_width($param_vbox, 5)), 0, gtkpack(create_hbox('edge'), gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => $exit_dialogsub), gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { |