summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-12-18 18:39:09 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-12-18 18:39:09 +0000
commit8a96dc951335f9faf34d3630e25977c6f221dfee (patch)
treee43b2e58b4b8d19b71e81201198104a714c38a01
parentf2d4e6ad2134449e98c844bd1131f0a1e7b3add0 (diff)
downloadcontrol-center-8a96dc951335f9faf34d3630e25977c6f221dfee.tar
control-center-8a96dc951335f9faf34d3630e25977c6f221dfee.tar.gz
control-center-8a96dc951335f9faf34d3630e25977c6f221dfee.tar.bz2
control-center-8a96dc951335f9faf34d3630e25977c6f221dfee.tar.xz
control-center-8a96dc951335f9faf34d3630e25977c6f221dfee.zip
(deleting profiles)
- list profiles rather than deleting current one - prevent to delete current profile
-rwxr-xr-xcontrol-center30
1 files changed, 24 insertions, 6 deletions
diff --git a/control-center b/control-center
index 3c74ab91..cf024029 100755
--- a/control-center
+++ b/control-center
@@ -393,12 +393,30 @@ my @menu_items = (
[ $shared_translations{profiles} . $shared_translations{delete}, undef, sub {
return if !$done && $netcnx->{PROFILE} ne "default";
- my $prof = $netcnx->{PROFILE};
- $netcnx->{PROFILE} = "default";
- network::netconnect::set_profile($netcnx);
- # we must delete the old profile after the switch because set-profile "restore" the old one by saving current one...
- network::netconnect::del_profile($prof);
- update_profiles(1);
+ my $dialog = _create_dialog(N("Delete profile"), { stock => 'gtk-dialog-warning' });
+ gtkpack($dialog->vbox,
+ Gtk2::Label->new(N("Profile to delete:")),
+ my $combo_dialog = Gtk2::OptionMenu->new,
+ );
+ $combo_dialog->set_popdown_strings(grep { ! /default/ } network::netconnect::get_profiles());
+ gtkpack($dialog->action_area,
+ gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { $dialog->destroy }),
+ gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub {
+ my $profile2delete = $combo_dialog->entry->get_text;
+ if ($profile2delete eq $netcnx->{PROFILE}) {
+ !err_dialog(N("Warning"), N("You can not delete the current profile"));
+ return 1;
+ }
+ $dialog->destroy;
+ Gtk2->main_quit;
+ network::netconnect::del_profile($profile2delete);
+ $profile2delete eq $netcnx->{PROFILE} ? set_profiles("default") : update_profiles();
+ update_profiles(1);
+ }),
+ );
+ $dialog->show_all;
+ $dialog->run;
+ return;
}, undef, '<Item>' ],
[ join('/', $shared_translations{profiles}, ""), undef, undef, undef, '<Separator>' ],