diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-03-11 16:17:19 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-03-11 16:17:19 +0000 |
commit | 9269f08eed8f36f84432f315975b633b05cf3ba1 (patch) | |
tree | 86b6416140121d2357dc7146e000406c9ab26237 | |
parent | 7a2431213ad7bd3debb662dfac567eecc58b0ed6 (diff) | |
download | drakx-9269f08eed8f36f84432f315975b633b05cf3ba1.tar drakx-9269f08eed8f36f84432f315975b633b05cf3ba1.tar.gz drakx-9269f08eed8f36f84432f315975b633b05cf3ba1.tar.bz2 drakx-9269f08eed8f36f84432f315975b633b05cf3ba1.tar.xz drakx-9269f08eed8f36f84432f315975b633b05cf3ba1.zip |
(switch) factorize code to save PA settings
-rw-r--r-- | perl-install/harddrake/sound.pm | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm index 71bcb1e61..7a193281d 100644 --- a/perl-install/harddrake/sound.pm +++ b/perl-install/harddrake/sound.pm @@ -323,6 +323,13 @@ sub switch { my $is_5_1_in_pulseaudio_enabled = is_5_1_in_pulseaudio_enabled(); my $is_user_switching = is_user_switching_enabled(); + my $write_config = sub { + set_pulseaudio($is_pulseaudio_enabled); + set_pulseaudio_routing($is_pulseaudio_routing_enabled); + set_5_1_in_pulseaudio($is_5_1_in_pulseaudio_enabled); + set_user_switching($is_user_switching); + }; + my @common = ( get_any_driver_entry($in, $modules_conf, $driver, $device), { @@ -361,10 +368,7 @@ sub switch { }, \@common, )) { - set_pulseaudio($is_pulseaudio_enabled); - set_pulseaudio_routing($is_pulseaudio_routing_enabled); - set_5_1_in_pulseaudio($is_5_1_in_pulseaudio_enabled); - set_user_switching($is_user_switching); + $write_config->(); } } elsif ($in->ask_from_({ title => N("Sound configuration"), messages => @@ -400,10 +404,7 @@ To use alsa, one can either use: @common, ])) { - set_pulseaudio($is_pulseaudio_enabled); - set_pulseaudio_routing($is_pulseaudio_routing_enabled); - set_5_1_in_pulseaudio($is_5_1_in_pulseaudio_enabled); - set_user_switching($is_user_switching); + $write_config->();; return if $new_driver eq $device->{current_driver}; log::explanations("switching audio driver from '" . $device->{current_driver} . "' to '$new_driver'\n"); $in->ask_warn(N("Warning"), N("The old \"%s\" driver is blacklisted.\n |