summaryrefslogtreecommitdiffstats
path: root/audio/sink.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@indt.org.br>2008-07-30 17:57:50 -0300
committerLuiz Augusto von Dentz <luiz.dentz@indt.org.br>2008-07-30 17:57:50 -0300
commitd0c561820ca05cafc8a7d20e3250953b48aa5214 (patch)
treef653006e6617f4f89c9bc60d4451df323bf1a08c /audio/sink.c
parent990b22de8763ca1b23a6c2911dcd3ca30592ac3f (diff)
Remove use of g_dbus_unregister_all_interfaces.
Diffstat (limited to 'audio/sink.c')
-rw-r--r--audio/sink.c46
1 files changed, 31 insertions, 15 deletions
diff --git a/audio/sink.c b/audio/sink.c
index 0aa14542..f3b7c55f 100644
--- a/audio/sink.c
+++ b/audio/sink.c
@@ -494,21 +494,7 @@ static GDBusSignalTable sink_signals[] = {
{ NULL, NULL }
};
-struct sink *sink_init(struct audio_device *dev)
-{
- if (!g_dbus_register_interface(dev->conn, dev->path,
- AUDIO_SINK_INTERFACE,
- sink_methods, sink_signals, NULL,
- dev, NULL))
- return NULL;
-
- info("Registered interface %s on path %s",
- AUDIO_SINK_INTERFACE, dev->path);
-
- return g_new0(struct sink, 1);
-}
-
-void sink_free(struct audio_device *dev)
+static void sink_free(struct audio_device *dev)
{
struct sink *sink = dev->sink;
@@ -529,6 +515,36 @@ void sink_free(struct audio_device *dev)
dev->sink = NULL;
}
+static void path_unregister(void *data)
+{
+ struct audio_device *dev = data;
+
+ info("Unregistered interface %s on path %s",
+ AUDIO_SINK_INTERFACE, dev->path);
+
+ sink_free(dev);
+}
+
+void sink_unregister(struct audio_device *dev)
+{
+ g_dbus_unregister_interface(dev->conn, dev->path,
+ AUDIO_SINK_INTERFACE);
+}
+
+struct sink *sink_init(struct audio_device *dev)
+{
+ if (!g_dbus_register_interface(dev->conn, dev->path,
+ AUDIO_SINK_INTERFACE,
+ sink_methods, sink_signals, NULL,
+ dev, path_unregister))
+ return NULL;
+
+ info("Registered interface %s on path %s",
+ AUDIO_SINK_INTERFACE, dev->path);
+
+ return g_new0(struct sink, 1);
+}
+
gboolean sink_is_active(struct audio_device *dev)
{
struct sink *sink = dev->sink;