From d554f081d32d36428ac4a080707204ba4c25ea06 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 8 Sep 2003 16:46:47 +0000 Subject: increase drakconnect robustness regarding profiles managment - fix set_profiles() call on profiles menu user change - (set_profiles) consolidate netcnx->{PROFILE} setting where we call set_profile - (update_profiles) rely on netcnx->{PROFILE} - fix profiles list update when wizard exits --- perl-install/standalone/drakconnect | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'perl-install/standalone/drakconnect') diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect index a8088fcf3..137dd32cc 100755 --- a/perl-install/standalone/drakconnect +++ b/perl-install/standalone/drakconnect @@ -90,25 +90,25 @@ my $profile_combo = gtksignal_connect(Gtk2::OptionMenu->new, changed => sub { return if $::ignore_profile_change; my $selected_profile = $combo->get_text; return if $selected_profile eq $netcnx->{PROFILE}; - $netcnx->{PROFILE} = $selected_profile; - set_profiles($netcnx) if $combo->window; # is realized?; + set_profiles($selected_profile) if $combo->window; # is realized?; }); -sub update_profiles { - my ($new_profile) = @_; - $new_profile ||= $netcnx->{PROFILE} || "default"; +# update combo profiles +sub update_profiles() { @profiles = network::netconnect::get_profiles(); $button_del->set_sensitive(@profiles > 1); local $::ignore_profile_change = 1; $profile_combo->set_popdown_strings(@profiles); - $profile_combo->set_text($new_profile); + $profile_combo->set_text($netcnx->{PROFILE}); } +# Change current profile sub set_profiles { my ($new_profile) = @_; + $netcnx->{PROFILE} = $new_profile; network::netconnect::set_profile($netcnx); network::netconnect::load_conf($netcnx, $netc, $intf); - update_profiles($new_profile); + update_profiles(); update(); $button_apply->set_sensitive(1); } @@ -196,11 +196,10 @@ $window1->{window}->add( gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { $dialog->destroy }), gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { - my $curr_prof = $profile_combo->get_text; #warn if already existing network::netconnect::add_profile($netcnx, $entry_dialog->get_text); - update_profiles($curr_prof); + update_profiles(); $dialog->destroy; }), ); @@ -301,17 +300,17 @@ sub sensitive_buttons { $SIG{CHLD} = sub { my $child = waitpid(-1, POSIX::WNOHANG); + # when the wizard has exiter, reload everything to catch its changes return if !($wizard_pid && $child eq $wizard_pid); undef $wizard_pid; sensitive_buttons(1); - #- reload everything... $netcnx = {}; $netc = {}; $intf = {}; network::netconnect::read_net_conf('', $netcnx, $netc); modules::load_category('net'); @all_cards = network::ethernet::conf_network_card_backend($netc, $intf); network::netconnect::load_conf($netcnx, $netc, $intf); network::network::probe_netcnx_type('', $netc, $intf, $netcnx); - $profile_combo->set_text(-e "/etc/sysconfig/network-scripts/drakconnect_conf." . ($profile_combo->entry->get_text || "default")); + update_profiles(); update(); }; -- cgit v1.2.1