From 3e04d944626ba4caee8a4d74a683c6c967e935ca Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Tue, 13 Aug 2013 12:43:29 +0200
Subject: [PATCH 203/204] card: Add hook before profile changes

This is useful to modules that want to do things just before a
profile becomes inactive.
---
 src/pulsecore/card.c |    2 ++
 src/pulsecore/core.h |    1 +
 2 files changed, 3 insertions(+)

diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
index 7cf45df..b58dfa7 100644
--- a/src/pulsecore/card.c
+++ b/src/pulsecore/card.c
@@ -272,6 +272,8 @@ int pa_card_set_profile(pa_card *c, const char *name, pa_bool_t save) {
         return 0;
     }
 
+    pa_hook_fire(&c->core->hooks[PA_CORE_HOOK_CARD_PROFILE_CHANGING], profile);
+
     if ((r = c->set_profile(c, profile)) < 0)
         return r;
 
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index a8cff5c..904b610 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -115,6 +115,7 @@ typedef enum pa_core_hook {
     PA_CORE_HOOK_CARD_PUT,
     PA_CORE_HOOK_CARD_UNLINK,
     PA_CORE_HOOK_CARD_PROFILE_CHANGED,
+    PA_CORE_HOOK_CARD_PROFILE_CHANGING,
     PA_CORE_HOOK_CARD_PROFILE_ADDED,
     PA_CORE_HOOK_CARD_PROFILE_AVAILABLE_CHANGED,
     PA_CORE_HOOK_PORT_AVAILABLE_CHANGED,
-- 
1.7.9.5

