From 083dccf6341c38f8cbf8be2d9b57a787326d49bc Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 31 May 2006 15:15:43 +0000 Subject: drop old netprofile stuff, moved in draknetprofile --- control-center | 129 --------------------------------------------------------- 1 file changed, 129 deletions(-) diff --git a/control-center b/control-center index 80d64936..b0a72900 100755 --- a/control-center +++ b/control-center @@ -29,7 +29,6 @@ use standalone; use common; use detect_devices; use lang; -use network::network; # i18n: IMPORTANT: to get correct namespace (drakconf instead of libDrakX) BEGIN { unshift @::textdomains, 'drakconf' } @@ -1053,16 +1052,6 @@ my %options = ( 'expert_mode' => [ N("/_Options"), translate("/_Expert mode") ], ); -my %shared_translations = ( - "profiles" => N("/_Profiles"), - "delete" => N("/_Delete"), - "new" => N("/_New"), - ); - -# for profiles: -my $net = {}; -my @profiles; - my $mdk_rel = common::mandrake_release(); my ($notebook_global, $saved_pos_while_in_menu); @@ -1124,67 +1113,6 @@ my @menu_items = ( } @themes), [ N("/_Themes") . N("/_More themes"), undef, \&more_themes, undef, '' ] ), - [ $shared_translations{profiles}, undef, undef, undef, '' ], - [ $shared_translations{profiles} . $shared_translations{new}, undef, sub { - my $dialog = _create_dialog(N("New profile..."), { small => 1, transient => $window_global }); - my $entry_dialog = Gtk2::Entry->new; - gtkpack($dialog->vbox, - Gtk2::WrappedLabel->new(N("Name of the profile to create (the new profile is created as a copy of the current one):")), - $entry_dialog, - ); - gtkpack($dialog->action_area, - gtksignal_connect(Gtk2::Button->new(N("Cancel")), - clicked => sub { $dialog->destroy }), - gtksignal_connect(my $bok = Gtk2::Button->new(N("Ok")), clicked => sub { - my $prof = $entry_dialog->get_text; - # netprofile does not like spaces in profile names... - $prof =~ s/ /_/g; - # warn if already existing: - if (member($prof, @profiles)) { - err_dialog(N("Error"), N("The \"%s\" profile already exists!", $prof), - { transient => $dialog }); - return 1; - } - network::network::netprofile_add($net, $prof); - update_profiles(); - $dialog->destroy; - }), - ); - $bok->can_default(1); - $bok->grab_default; - $dialog->show_all; - Gtk2->main; - update_profiles(); - }, undef, '' ], - - [ $shared_translations{profiles} . $shared_translations{delete}, undef, sub { - return if !$window_global->realized && $net->{PROFILE} ne "default"; - 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::network::netprofile_list()); - 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 $net->{PROFILE}) { - err_dialog(N("Warning"), N("You can not delete the current profile")); - return 1; - } - $dialog->destroy; - Gtk2->main_quit; - network::network::netprofile_delete($profile2delete); - update_profiles(1); - }), - ); - $dialog->show_all; - Gtk2->main; - return; - }, undef, '' ], - - [ join('/', $shared_translations{profiles}, ""), undef, undef, undef, '' ], [ N("/_Help"), undef, undef, undef, '' ], [ N("/_Help") . N("/_Help"), undef, sub { fork_("drakhelp --id $help_on_context") }, undef, '', N("Help") ], [ N("/_Help") . N("/_Report Bug"), undef, sub { fork_("drakbug --report drakconf &") }, undef, '' ], @@ -1196,63 +1124,6 @@ my ($menu, $factory) = create_factory_menu($window_global, @menu_items); # to retrieve a path, one must prevent "accelerators completion": sub get_path { join('', map { my $i = $_; $i =~ s/_//g; $i } @_) } -# menus do not like "_" from profiles (whereas netprofile does not like spaces in profile names...) -sub profile2menu { - my ($profile) = @_; - $profile =~ s/_/ /g; - "/$profile"; -} - -sub enable_profile_entry { - my ($profile, $value) = @_; - eval { - $factory->get_widget(get_path("
", $shared_translations{profiles} . profile2menu($profile)))->set_active($value); - }; - print "error: $@\n" if $@; -} - - -# update profiles list -sub update_profiles { - my ($removing) = @_; - my $done; - $factory->delete_item(get_path("
", $shared_translations{profiles} . profile2menu($_))) foreach @profiles; - network::network::netprofile_read($net); - @profiles = network::network::netprofile_list(); - foreach my $prof (@profiles) { - $factory->create_item([ $shared_translations{profiles} . profile2menu($prof), undef, sub { - return unless $done; - if ($net->{PROFILE} eq $prof) { - $done = 0; - enable_profile_entry($prof, 1); - $done = 1; - return 0; - } - if (!warn_dialog(N("Warning"), - N("We are about to switch from the \"%s\" profile to the \"%s\" profile. - -Are you sure you want to do the switch?", $net->{PROFILE}, $prof), { transient => $window_global })) { - $done = 0; - enable_profile_entry($prof, 0); - $done = 1; - return; - } - # wait message is needed - $done = 0; - enable_profile_entry($net->{PROFILE}, 0); - network::network::netprofile_set($net, $prof); - enable_profile_entry($prof, 1) if !$removing; - $done = 1; - }, undef, '' ]); # Radio - } - $factory->get_widget(get_path("
", $shared_translations{profiles}, $shared_translations{delete}))->set_sensitive(@profiles > 1); - eval { $factory->get_widget(get_path("
", $shared_translations{profiles} . profile2menu($net->{PROFILE})))->set_active(1) }; - print "error is «$@»\n" if $@; - $done = 1; -} - -update_profiles(); - %check_boxes = map { $_ => $factory->get_widget("
" . get_path(@{$options{$_}})); } ('show_log', 'expert_mode', if_(0 && $isWiz, "wiz_expert")); -- cgit v1.2.1