~diwic/gnome-settings-daemon/what-did-you-plug-in

« back to all changes in this revision

Viewing changes to debian/patches/what-did-you-plug-in.patch

  • Committer: David Henningsson
  • Date: 2014-01-08 13:15:51 UTC
  • Revision ID: david.henningsson@canonical.com-20140108131551-1ikzah6zq4zl4suw
WIP, this is just to get the thing to compile

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Index: gnome-settings-daemon-3.8.6.1/plugins/media-keys/gvc/gvc-mixer-control.c
 
2
===================================================================
 
3
--- gnome-settings-daemon-3.8.6.1.orig/plugins/media-keys/gvc/gvc-mixer-control.c       2014-01-08 14:01:19.776910908 +0100
 
4
+++ gnome-settings-daemon-3.8.6.1/plugins/media-keys/gvc/gvc-mixer-control.c    2014-01-08 14:01:19.772910908 +0100
 
5
@@ -114,6 +114,7 @@
 
6
         INPUT_ADDED,
 
7
         OUTPUT_REMOVED,
 
8
         INPUT_REMOVED,
 
9
+        CARD_INFO,
 
10
         LAST_SIGNAL
 
11
 };
 
12
 
 
13
@@ -2150,6 +2151,10 @@
 
14
                 }
 
15
         }
 
16
         g_signal_emit (G_OBJECT (control),
 
17
+                       signals[CARD_INFO],
 
18
+                       0,
 
19
+                       info);
 
20
+        g_signal_emit (G_OBJECT (control),
 
21
                        signals[CARD_ADDED],
 
22
                        0,
 
23
                        info->index);
 
24
@@ -3206,6 +3211,14 @@
 
25
                               NULL, NULL,
 
26
                               g_cclosure_marshal_VOID__UINT,
 
27
                               G_TYPE_NONE, 1, G_TYPE_UINT);
 
28
+        signals [CARD_INFO] =
 
29
+                g_signal_new ("card-info",
 
30
+                              G_TYPE_FROM_CLASS (klass),
 
31
+                              G_SIGNAL_RUN_LAST,
 
32
+                              0,
 
33
+                              NULL, NULL,
 
34
+                              g_cclosure_marshal_VOID__POINTER,
 
35
+                              G_TYPE_NONE, 1, G_TYPE_POINTER);
 
36
         signals [CARD_ADDED] =
 
37
                 g_signal_new ("card-added",
 
38
                               G_TYPE_FROM_CLASS (klass),
 
39
Index: gnome-settings-daemon-3.8.6.1/plugins/media-keys/what-did-you-plug-in/pa-backend.c
 
40
===================================================================
 
41
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
 
42
+++ gnome-settings-daemon-3.8.6.1/plugins/media-keys/what-did-you-plug-in/pa-backend.c  2014-01-08 14:01:19.772910908 +0100
 
43
@@ -0,0 +1,363 @@
 
44
+#include <stdlib.h>
 
45
+#include <stdio.h>
 
46
+#include <string.h>
 
47
+#include <alsa/asoundlib.h>
 
48
+#include <pulse/pulseaudio.h>
 
49
+#include <pulse/glib-mainloop.h>
 
50
+//#include <gtk/gtk.h>
 
51
+
 
52
+#include "pa-backend.h"
 
53
+
 
54
+struct pa_backend {
 
55
+//    pa_glib_mainloop *mainloop;
 
56
+//    pa_mainloop_api *ml_api;
 
57
+//    pa_defer_event *defer_event;
 
58
+    pa_context *context;
 
59
+    pa_backend_cb dialog_cb;
 
60
+    int headset_card;
 
61
+    bool headset_plugged_in;
 
62
+    bool has_headsetmic;
 
63
+    bool has_headphonemic;
 
64
+
 
65
+    const char *sink_port_name_to_set;
 
66
+    const char *source_port_name_to_set;
 
67
+};
 
68
+
 
69
+void pa_backend_set_context(pa_backend *p, const pa_context *c)
 
70
+{
 
71
+    p->context = c;
 
72
+}
 
73
+
 
74
+
 
75
+/*
 
76
+static void context_state_callback(pa_context *c, void *userdata) {
 
77
+    switch (pa_context_get_state(c)) {
 
78
+        case PA_CONTEXT_READY:
 
79
+            fprintf(stderr, "Connection established!\n");
 
80
+            gtk_main_quit();
 
81
+            break;
 
82
+
 
83
+        case PA_CONTEXT_TERMINATED:
 
84
+        case PA_CONTEXT_FAILED:
 
85
+            fprintf(stderr, "Connection failure: %s\n", pa_strerror(pa_context_errno(c)));
 
86
+            gtk_main_quit();
 
87
+            break;
 
88
+
 
89
+        default:
 
90
+            break;
 
91
+    }
 
92
+}
 
93
+*/
 
94
+static void call_dialog(pa_mainloop_api *a, pa_defer_event *e, void *userdata)
 
95
+{
 
96
+    pa_backend *p = userdata;
 
97
+
 
98
+    fprintf(stderr, "Deferred event\n");
 
99
+    a->defer_enable(e, 0);
 
100
+    if (!p->dialog_cb)
 
101
+        return;
 
102
+    if (p->headset_plugged_in)
 
103
+        p->dialog_cb(p->has_headsetmic, p->has_headphonemic);
 
104
+    else
 
105
+        p->dialog_cb(false, false);
 
106
+}
 
107
+
 
108
+pa_backend *pa_backend_new()
 
109
+{
 
110
+    pa_backend *p = calloc(1, sizeof(*p));
 
111
+
 
112
+    if (!p)
 
113
+        return NULL;
 
114
+
 
115
+    p->headset_card = -1;
 
116
+/*
 
117
+    if (!(p->mainloop = pa_glib_mainloop_new(NULL))) {
 
118
+        pa_backend_free(p);
 
119
+        return NULL;
 
120
+    }
 
121
+
 
122
+    p->ml_api = pa_glib_mainloop_get_api(p->mainloop);
 
123
+    if (!(p->context = pa_context_new(p->ml_api, "what-did-you-plug-in"))) {
 
124
+        pa_backend_free(p);
 
125
+        return NULL;
 
126
+    }
 
127
+
 
128
+    if (pa_context_connect(p->context, NULL, 0, NULL) < 0) {
 
129
+        fprintf(stderr, "pa_context_connect() failed: %s\n", pa_strerror(pa_context_errno(p->context)));
 
130
+        pa_backend_free(p);
 
131
+        return NULL;
 
132
+    }
 
133
+
 
134
+    fprintf(stderr, "Connecting to PulseAudio...\n");
 
135
+    pa_context_set_state_callback(p->context, context_state_callback, p);
 
136
+    gtk_main();
 
137
+    pa_context_set_state_callback(p->context, NULL, NULL);
 
138
+
 
139
+    if (pa_context_get_state(p->context) != PA_CONTEXT_READY) {
 
140
+        pa_backend_free(p);
 
141
+        return NULL;
 
142
+    }
 
143
+
 
144
+    p->defer_event = p->ml_api->defer_new(p->ml_api, call_dialog, p);
 
145
+    if (!p->defer_event) {
 
146
+        pa_backend_free(p);
 
147
+        return NULL;
 
148
+    }
 
149
+    p->ml_api->defer_enable(p->defer_event, 0);
 
150
+*/
 
151
+    return p;
 
152
+}
 
153
+
 
154
+typedef struct headset_ports {
 
155
+    const pa_card_port_info *headphones, *headsetmic, *headphonemic;
 
156
+} headset_ports;
 
157
+
 
158
+static headset_ports get_headset_ports(const pa_card_info *c)
 
159
+{
 
160
+    headset_ports h = {NULL, NULL, NULL};
 
161
+    int i;
 
162
+    for (i = 0; i < c->n_ports; i++) {
 
163
+        pa_card_port_info *p = c->ports[i];
 
164
+        if (!strcmp(p->name, "analog-output-headphones"))
 
165
+            h.headphones = p;
 
166
+        else if (!strcmp(p->name, "analog-input-microphone-headset"))
 
167
+            h.headsetmic = p;
 
168
+        else if (!strcmp(p->name, "analog-input-microphone"))
 
169
+            h.headphonemic = p;
 
170
+    }
 
171
+    return h;
 
172
+}
 
173
+
 
174
+static bool verify_alsa_card(int cardindex, bool *headsetmic, bool *headphonemic)
 
175
+{
 
176
+    char ctlstr[20];
 
177
+    snd_hctl_t *hctl;
 
178
+    snd_ctl_elem_id_t *id;
 
179
+    int err;
 
180
+
 
181
+    *headsetmic = false;
 
182
+    *headphonemic = false;
 
183
+
 
184
+    snprintf(ctlstr, sizeof(ctlstr), "hw:%i", cardindex);
 
185
+    if ((err = snd_hctl_open(&hctl, ctlstr, 0)) < 0) {
 
186
+        fprintf(stderr, "snd_hctl_open failed: %s", snd_strerror(err));
 
187
+        return false;
 
188
+    }
 
189
+
 
190
+    if ((err = snd_hctl_load(hctl)) < 0) {
 
191
+        fprintf(stderr, "snd_hctl_load failed: %s", snd_strerror(err));
 
192
+        snd_hctl_close(hctl);
 
193
+        return false;
 
194
+    }
 
195
+
 
196
+    snd_ctl_elem_id_alloca(&id);
 
197
+
 
198
+    snd_ctl_elem_id_clear(id);
 
199
+    snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_CARD);
 
200
+    snd_ctl_elem_id_set_name(id, "Headphone Mic Jack");
 
201
+    if (snd_hctl_find_elem(hctl, id))
 
202
+        *headphonemic = true;
 
203
+
 
204
+    snd_ctl_elem_id_clear(id);
 
205
+    snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_CARD);
 
206
+    snd_ctl_elem_id_set_name(id, "Headset Mic Phantom Jack");
 
207
+    if (snd_hctl_find_elem(hctl, id))
 
208
+        *headsetmic = true;
 
209
+
 
210
+    if (*headphonemic) {
 
211
+        snd_ctl_elem_id_clear(id);
 
212
+        snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_CARD);
 
213
+        snd_ctl_elem_id_set_name(id, "Headset Mic Jack");
 
214
+        if (snd_hctl_find_elem(hctl, id))
 
215
+            *headsetmic = true;
 
216
+    }
 
217
+
 
218
+    snd_hctl_close(hctl);
 
219
+    return *headsetmic || *headphonemic;
 
220
+}
 
221
+
 
222
+void pa_backend_card_changed(pa_backend *p, const pa_card_info *i)
 
223
+{
 
224
+    headset_ports h;
 
225
+    bool start_dialog = false, stop_dialog = false;
 
226
+
 
227
+    h = get_headset_ports(i);
 
228
+
 
229
+    if (!h.headphones || (!h.headsetmic && !h.headphonemic))
 
230
+        return; /* Not a headset jack */
 
231
+
 
232
+    if (p->headset_card != (int) i->index) {
 
233
+        int cardindex = 0;
 
234
+        bool hsmic, hpmic;
 
235
+        const char *s = pa_proplist_gets(i->proplist, "alsa.card");
 
236
+        if (!s)
 
237
+            return;
 
238
+        cardindex = strtol(s, NULL, 10);
 
239
+        if (cardindex == 0 && strcmp(s, "0"))
 
240
+            return;
 
241
+
 
242
+        fprintf(stderr, "%s: has headphones %d headsetmic %d headphonemic %d\n", i->name, h.headphones ? 1 : 0, h.headsetmic ? 1 : 0, h.headphonemic ? 1 : 0);
 
243
+        if (!verify_alsa_card(cardindex, &hsmic, &hpmic))
 
244
+            return;
 
245
+        fprintf(stderr, "Alsa: headset mic %d, headphone mic %d\n", hsmic, hpmic);
 
246
+
 
247
+        p->headset_card = (int) i->index;
 
248
+        p->has_headsetmic = hsmic && h.headsetmic;
 
249
+        p->has_headphonemic = hpmic && h.headphonemic;
 
250
+    }
 
251
+    else {
 
252
+        start_dialog = p->dialog_cb && (h.headphones->available != PA_PORT_AVAILABLE_NO) &&
 
253
+            !p->headset_plugged_in;
 
254
+        stop_dialog = p->dialog_cb && (h.headphones->available == PA_PORT_AVAILABLE_NO) &&
 
255
+            p->headset_plugged_in;
 
256
+    }
 
257
+
 
258
+    fprintf(stderr, "was plugged in %d, is plugged in %d\n", (int) p->headset_plugged_in, (int) (h.headphones->available != PA_PORT_AVAILABLE_NO));
 
259
+
 
260
+    p->headset_plugged_in = h.headphones->available != PA_PORT_AVAILABLE_NO;
 
261
+
 
262
+    if (start_dialog)
 
263
+        p->dialog_cb(p->has_headsetmic, p->has_headphonemic);
 
264
+    else if (stop_dialog)
 
265
+        p->dialog_cb(false, false);
 
266
+}
 
267
+/*
 
268
+bool pa_backend_has_headset_jack(pa_backend *p)
 
269
+{
 
270
+    pa_operation *o;
 
271
+
 
272
+    p->headset_card = -1;
 
273
+    o = pa_context_get_card_info_list(p->context, card_info_cb, p);
 
274
+
 
275
+    if (o) {
 
276
+        while (pa_operation_get_state(o) == PA_OPERATION_RUNNING)
 
277
+            gtk_main();
 
278
+        pa_operation_unref(o);
 
279
+    }
 
280
+
 
281
+    return p->headset_card != -1;
 
282
+}
 
283
+
 
284
+static void event_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata)
 
285
+{
 
286
+    pa_operation *o;
 
287
+    pa_backend *p = userdata;
 
288
+    if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) != PA_SUBSCRIPTION_EVENT_CHANGE)
 
289
+        return;
 
290
+    if (idx != p->headset_card)
 
291
+        return;
 
292
+
 
293
+    o = pa_context_get_card_info_by_index(c, idx, card_info_cb, p);
 
294
+    if (o)
 
295
+        pa_operation_unref(o);
 
296
+}
 
297
+
 
298
+void pa_backend_start_listening(pa_backend *p, pa_backend_cb cb)
 
299
+{
 
300
+    pa_operation *o;
 
301
+    p->dialog_cb = cb;
 
302
+    pa_context_set_subscribe_callback(p->context, event_cb, p);
 
303
+    o = pa_context_subscribe(p->context, PA_SUBSCRIPTION_MASK_CARD, NULL, p);
 
304
+    if (o)
 
305
+        pa_operation_unref(o);
 
306
+}
 
307
+*/
 
308
+
 
309
+static void sink_info_cb(pa_context *c, const pa_sink_info *i, int eol, void *userdata)
 
310
+{
 
311
+    pa_backend *p = userdata;
 
312
+    pa_operation *o;
 
313
+    int j;
 
314
+    const char *s = p->sink_port_name_to_set;
 
315
+
 
316
+    if (eol) {
 
317
+        return;
 
318
+    }
 
319
+
 
320
+    if (i->card != p->headset_card)
 
321
+        return;
 
322
+
 
323
+    if (i->active_port && !strcmp(i->active_port->name, s))
 
324
+        return;
 
325
+
 
326
+    for (j = 0; j < i->n_ports; j++)
 
327
+        if (!strcmp(i->ports[j]->name, s))
 
328
+            break;
 
329
+
 
330
+    if (j >= i->n_ports)
 
331
+        return;
 
332
+
 
333
+    o = pa_context_set_sink_port_by_index(c, i->index, s, NULL, NULL);
 
334
+    if (o)
 
335
+        pa_operation_unref(o);
 
336
+}
 
337
+
 
338
+static void source_info_cb(pa_context *c, const pa_source_info *i, int eol, void *userdata)
 
339
+{
 
340
+    pa_backend *p = userdata;
 
341
+    pa_operation *o;
 
342
+    int j;
 
343
+    const char *s = p->source_port_name_to_set;
 
344
+
 
345
+    if (eol) {
 
346
+        return;
 
347
+    }
 
348
+
 
349
+    if (i->card != p->headset_card)
 
350
+        return;
 
351
+
 
352
+    if (i->active_port && !strcmp(i->active_port->name, s))
 
353
+        return;
 
354
+
 
355
+    for (j = 0; j < i->n_ports; j++)
 
356
+        if (!strcmp(i->ports[j]->name, s))
 
357
+            break;
 
358
+
 
359
+    if (j >= i->n_ports)
 
360
+        return;
 
361
+
 
362
+    o = pa_context_set_source_port_by_index(c, i->index, s, NULL, NULL);
 
363
+    if (o)
 
364
+        pa_operation_unref(o);
 
365
+}
 
366
+
 
367
+
 
368
+void pa_backend_set_port(pa_backend *p, const char *portname, bool is_output)
 
369
+{
 
370
+    pa_operation *o;
 
371
+
 
372
+    if (is_output) {
 
373
+        p->sink_port_name_to_set = portname;
 
374
+        o = pa_context_get_sink_info_list(p->context, sink_info_cb, p);
 
375
+    }
 
376
+    else {
 
377
+        p->source_port_name_to_set = portname;
 
378
+        o = pa_context_get_source_info_list(p->context, source_info_cb, p);
 
379
+    }
 
380
+
 
381
+    if (o) {
 
382
+        pa_operation_unref(o);
 
383
+    }
 
384
+}
 
385
+
 
386
+
 
387
+void pa_backend_free(pa_backend *p)
 
388
+{
 
389
+    if (!p)
 
390
+        return;
 
391
+/*
 
392
+    if (p->defer_event) {
 
393
+        p->ml_api->defer_free(p->defer_event);
 
394
+    }
 
395
+
 
396
+    if (p->context) {
 
397
+        pa_context_disconnect(p->context);
 
398
+        pa_context_unref(p->context);
 
399
+    }
 
400
+
 
401
+    if (p->mainloop)
 
402
+        pa_glib_mainloop_free(p->mainloop);
 
403
+*/
 
404
+    free(p);
 
405
+}
 
406
+
 
407
Index: gnome-settings-daemon-3.8.6.1/plugins/media-keys/what-did-you-plug-in/pa-backend.h
 
408
===================================================================
 
409
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
 
410
+++ gnome-settings-daemon-3.8.6.1/plugins/media-keys/what-did-you-plug-in/pa-backend.h  2014-01-08 14:01:19.772910908 +0100
 
411
@@ -0,0 +1,26 @@
 
412
+#ifndef __PA_BACKEND_H__
 
413
+#define __PA_BACKEND_H__
 
414
+
 
415
+#include <stdbool.h>
 
416
+#include <pulse/pulseaudio.h>
 
417
+
 
418
+typedef struct pa_backend pa_backend;
 
419
+
 
420
+typedef void (*pa_backend_cb)(bool headsetmic, bool headphonemic);
 
421
+
 
422
+pa_backend *pa_backend_new();
 
423
+
 
424
+//bool pa_backend_has_headset_jack(pa_backend *p);
 
425
+
 
426
+void pa_backend_free(pa_backend *p);
 
427
+
 
428
+void pa_backend_card_changed(pa_backend *p, const pa_card_info *i);
 
429
+
 
430
+void pa_backend_set_context(pa_backend *p, const pa_context *c);
 
431
+
 
432
+//void pa_backend_start_listening(pa_backend *p, pa_backend_cb cb);
 
433
+
 
434
+void pa_backend_set_port(pa_backend *p, const char *portname, bool is_output);
 
435
+
 
436
+
 
437
+#endif
 
438
Index: gnome-settings-daemon-3.8.6.1/plugins/media-keys/Makefile.am
 
439
===================================================================
 
440
--- gnome-settings-daemon-3.8.6.1.orig/plugins/media-keys/Makefile.am   2014-01-08 14:01:19.776910908 +0100
 
441
+++ gnome-settings-daemon-3.8.6.1/plugins/media-keys/Makefile.am        2014-01-08 14:02:00.232910193 +0100
 
442
@@ -29,6 +29,7 @@
 
443
                      $(srcdir)/org.gnome.ShellKeyGrabber.xml
 
444
 
 
445
 libmedia_keys_la_SOURCES =             \
 
446
+       what-did-you-plug-in/pa-backend.c \
 
447
        gsd-media-keys-plugin.c         \
 
448
        gsd-media-keys-manager.h        \
 
449
        gsd-media-keys-manager.c        \
 
450
@@ -44,6 +45,7 @@
 
451
        -I$(top_srcdir)/gnome-settings-daemon                   \
 
452
        -I$(top_srcdir)/plugins/common                          \
 
453
        -I$(top_srcdir)/plugins/media-keys/gvc                  \
 
454
+       -I$(top_srcdir)/plugins/media-keys/what-did-you-plug-in \
 
455
        -DBINDIR=\"$(bindir)\"                                  \
 
456
        -DPIXMAPDIR=\""$(pkgdatadir)"\"                         \
 
457
        -DGTKBUILDERDIR=\""$(pkgdatadir)"\"                     \
 
458
@@ -87,6 +89,7 @@
 
459
        -I$(top_srcdir)/gnome-settings-daemon                   \
 
460
        -I$(top_srcdir)/plugins/common                          \
 
461
        -I$(top_srcdir)/plugins/media-keys/gvc                  \
 
462
+       -I$(top_srcdir)/plugins/media-keys/what-did-you-plug-in \
 
463
        -DBINDIR=\"$(bindir)\"                                  \
 
464
        -DPIXMAPDIR=\""$(pkgdatadir)"\"                         \
 
465
        -DGTKBUILDERDIR=\""$(pkgdatadir)"\"                     \
 
466
Index: gnome-settings-daemon-3.8.6.1/plugins/media-keys/gsd-media-keys-manager.c
 
467
===================================================================
 
468
--- gnome-settings-daemon-3.8.6.1.orig/plugins/media-keys/gsd-media-keys-manager.c      2014-01-08 14:01:19.776910908 +0100
 
469
+++ gnome-settings-daemon-3.8.6.1/plugins/media-keys/gsd-media-keys-manager.c   2014-01-08 14:01:19.772910908 +0100
 
470
@@ -61,6 +61,7 @@
 
471
 #include <pulse/pulseaudio.h>
 
472
 #include "gvc-mixer-control.h"
 
473
 #include "gvc-mixer-sink.h"
 
474
+#include "pa-backend.h"
 
475
 
 
476
 #include <libnotify/notify.h>
 
477
 
 
478
@@ -213,6 +214,8 @@
 
479
         /* Legacy keygrabber stuff */
 
480
         guint           have_legacy_keygrabber;
 
481
 
 
482
+        /* What did you plug in dialog */
 
483
+        pa_backend      *wdypi_pa_backend;
 
484
 };
 
485
 
 
486
 static void     gsd_media_keys_manager_class_init  (GsdMediaKeysManagerClass *klass);
 
487
@@ -2683,6 +2686,14 @@
 
488
 }
 
489
 
 
490
 static void
 
491
+on_control_card_info_updated (GvcMixerControl     *control,
 
492
+                              gpointer            card_info,
 
493
+                              GsdMediaKeysManager *manager)
 
494
+{
 
495
+        pa_backend_card_changed (manager->priv->wdypi_pa_backend, card_info);
 
496
+}
 
497
+
 
498
+static void
 
499
 initialize_volume_handler (GsdMediaKeysManager *manager)
 
500
 {
 
501
         /* initialise Volume handler
 
502
@@ -2695,6 +2706,8 @@
 
503
 
 
504
         manager->priv->volume = gvc_mixer_control_new ("GNOME Volume Control Media Keys");
 
505
 
 
506
+        manager->priv->wdypi_pa_backend = pa_backend_new();
 
507
+
 
508
         g_signal_connect (manager->priv->volume,
 
509
                           "state-changed",
 
510
                           G_CALLBACK (on_control_state_changed),
 
511
@@ -2711,6 +2724,10 @@
 
512
                           "stream-removed",
 
513
                           G_CALLBACK (on_control_stream_removed),
 
514
                           manager);
 
515
+        g_signal_connect (manager->priv->volume,
 
516
+                          "card-info",
 
517
+                          G_CALLBACK (on_control_card_info_updated),
 
518
+                          manager);
 
519
 
 
520
         gvc_mixer_control_open (manager->priv->volume);
 
521
 
 
522
@@ -3035,6 +3052,11 @@
 
523
                 gdk_error_trap_pop_ignored ();
 
524
         }
 
525
 
 
526
+        if (manager->priv->wdypi_pa_backend) {
 
527
+                pa_backend_free (manager->priv->wdypi_pa_backend);
 
528
+                manager->priv->wdypi_pa_backend = NULL;
 
529
+        }
 
530
+
 
531
         if (priv->grab_cancellable != NULL) {
 
532
                 g_cancellable_cancel (priv->grab_cancellable);
 
533
                 g_clear_object (&priv->grab_cancellable);
 
534
Index: gnome-settings-daemon-3.8.6.1/configure.ac
 
535
===================================================================
 
536
--- gnome-settings-daemon-3.8.6.1.orig/configure.ac     2014-01-08 14:01:19.776910908 +0100
 
537
+++ gnome-settings-daemon-3.8.6.1/configure.ac  2014-01-08 14:01:19.772910908 +0100
 
538
@@ -213,7 +213,7 @@
 
539
 dnl - media-keys plugin stuff
 
540
 dnl ---------------------------------------------------------------------------
 
541
 
 
542
-PKG_CHECK_MODULES(MEDIA_KEYS, [gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra-gtk3 libnotify])
 
543
+PKG_CHECK_MODULES(MEDIA_KEYS, [gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra-gtk3 libnotify alsa])
 
544
 PKG_CHECK_MODULES(GVC, [gobject-2.0 libpulse >= $PA_REQUIRED_VERSION libpulse-mainloop-glib >= $PA_REQUIRED_VERSION])
 
545
 AM_CONDITIONAL(HAVE_INTROSPECTION, false)
 
546