summaryrefslogtreecommitdiffstats
path: root/perl-install/harddrake
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-03-11 15:20:06 +0000
committerThierry Vignaud <tv@mandriva.org>2008-03-11 15:20:06 +0000
commit78044da52194ee0604a02659b58063e666de9c9c (patch)
treec933867e40a207d79e38c567324bd556c62997c6 /perl-install/harddrake
parent62e2b00cfa8aa15068216cd980b7bd5e2904b44d (diff)
downloaddrakx-backup-do-not-use-78044da52194ee0604a02659b58063e666de9c9c.tar
drakx-backup-do-not-use-78044da52194ee0604a02659b58063e666de9c9c.tar.gz
drakx-backup-do-not-use-78044da52194ee0604a02659b58063e666de9c9c.tar.bz2
drakx-backup-do-not-use-78044da52194ee0604a02659b58063e666de9c9c.tar.xz
drakx-backup-do-not-use-78044da52194ee0604a02659b58063e666de9c9c.zip
(is_user_switching_enabled,set_user_switching,switch) add support to
enable/disable user switching (#37826)
Diffstat (limited to 'perl-install/harddrake')
-rw-r--r--perl-install/harddrake/sound.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm
index c210f76ae..12d0879fd 100644
--- a/perl-install/harddrake/sound.pm
+++ b/perl-install/harddrake/sound.pm
@@ -183,6 +183,25 @@ my $blacklisted = 0;
my $config_file = '/etc/sysconfig/pulseaudio';
+sub is_user_switching_enabled() {
+ my $output = run_program::get_stdout('polkit-action', '--action',
+ 'org.freedesktop.hal.device-access.sound');
+ my ($val) = $output =~ /default_inactive: (.*)/;
+ to_bool($val eq 'no');
+}
+
+sub set_user_switching {
+ my ($val) = @_;
+ if ($val) {
+ run_program::get_stdout('polkit-action', '--reset-defaults',
+ 'org.freedesktop.hal.device-access.sound');
+ } else {
+ run_program::get_stdout('polkit-action', '--set-defaults-inactive',
+ 'org.freedesktop.hal.device-access.sound', 'yes');
+ }
+}
+
+
sub is_pulseaudio_enabled() {
my %h = getVarsFromSh($config_file);
$h{PULSE_SERVER_TYPE} eq 'personal';
@@ -256,6 +275,7 @@ sub switch {
my %des = modules::category2modules_and_description('multimedia/sound');
my $is_pulseaudio_enabled = is_pulseaudio_enabled();
+ my $is_user_switching = is_user_switching_enabled();
my @common = (
get_any_driver_entry($in, $modules_conf, $driver, $device),
@@ -263,6 +283,10 @@ sub switch {
text => N("Enable PulseAudio"),
type => 'bool', val => \$is_pulseaudio_enabled,
},
+ {
+ text => N("Enable user switching for audio applications"),
+ type => 'bool', val => \$is_user_switching,
+ },
);
if ($new_driver eq 'unknown') {
@@ -274,6 +298,7 @@ sub switch {
\@common,
)) {
set_pulseaudio($is_pulseaudio_enabled);
+ set_user_switching($is_user_switching);
}
} elsif ($in->ask_from_({ title => N("Sound configuration"),
messages =>
@@ -315,6 +340,7 @@ To use alsa, one can either use:
]))
{
set_pulseaudio($is_pulseaudio_enabled);
+ set_user_switching($is_user_switching);
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