File 0006-hdajackretask-Fix-killing-PulseAudio-on-newer-PulseA.patch of Package alsa-tools

From 772fbde91c00c8f9517e67e2f5401d28e9aa88d4 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Thu, 13 Jun 2013 16:26:43 +0200
Subject: [PATCH] hdajackretask: Fix killing PulseAudio on newer PulseAudio
 versions

The standard configuration directory for PulseAudio has changed,
I think since 3.0. Adjust the directory lookup mechanism to match.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
 hdajackretask/apply-changes.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/hdajackretask/apply-changes.c b/hdajackretask/apply-changes.c
index eda404e..840f649 100644
--- a/hdajackretask/apply-changes.c
+++ b/hdajackretask/apply-changes.c
@@ -97,7 +97,20 @@ gboolean run_sudo_script(const gchar* script_name, GError** err)
 
 static gchar* get_pulseaudio_client_conf()
 {
-    return g_strdup_printf("%s/.pulse/client.conf", g_get_home_dir());
+    /* Reference: See src/pulsecore/core-util.c in pulseaudio */
+    gchar* fname;
+    gchar* dir = g_strdup_printf("%s/.pulse", g_get_home_dir());
+    if (access(dir, F_OK) < 0) {
+	const gchar* xch = g_getenv("XDG_CONFIG_HOME");
+	g_free(dir);
+	if (xch)
+	    dir = g_strdup_printf("%s/pulse", xch);
+	else
+	    dir = g_strdup_printf("%s/.config/pulse", g_get_home_dir());
+    }
+    fname = g_strdup_printf("%s/client.conf", dir);
+    g_free(dir);
+    return fname;
 }
 
 static gboolean kill_pulseaudio(gboolean* was_killed, int card, GError** err)
-- 
1.8.3
openSUSE Build Service is sponsored by