summaryrefslogtreecommitdiffstats
path: root/audio/headset.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/headset.c
parent990b22de8763ca1b23a6c2911dcd3ca30592ac3f (diff)
Remove use of g_dbus_unregister_all_interfaces.
Diffstat (limited to 'audio/headset.c')
-rw-r--r--audio/headset.c64
1 files changed, 40 insertions, 24 deletions
diff --git a/audio/headset.c b/audio/headset.c
index 7faab78c..61b1745f 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -1456,6 +1456,45 @@ void headset_update(struct audio_device *dev, sdp_record_t *record, uint16_t svc
headset_set_channel(headset, record, svc);
}
+static void headset_free(struct audio_device *dev)
+{
+ struct headset *hs = dev->headset;
+
+ if (hs->dc_timer) {
+ g_source_remove(hs->dc_timer);
+ hs->dc_timer = 0;
+ }
+
+ if (hs->sco) {
+ g_io_channel_close(hs->sco);
+ g_io_channel_unref(hs->sco);
+ }
+
+ if (hs->rfcomm) {
+ g_io_channel_close(hs->rfcomm);
+ g_io_channel_unref(hs->rfcomm);
+ }
+
+ g_free(hs);
+ dev->headset = NULL;
+}
+
+static void path_unregister(void *data)
+{
+ struct audio_device *dev = data;
+
+ info("Unregistered interface %s on path %s",
+ AUDIO_HEADSET_INTERFACE, dev->path);
+
+ headset_free(dev);
+}
+
+void headset_unregister(struct audio_device *dev)
+{
+ g_dbus_unregister_interface(dev->conn, dev->path,
+ AUDIO_HEADSET_INTERFACE);
+}
+
struct headset *headset_init(struct audio_device *dev, sdp_record_t *record,
uint16_t svc)
{
@@ -1493,7 +1532,7 @@ register_iface:
if (!g_dbus_register_interface(dev->conn, dev->path,
AUDIO_HEADSET_INTERFACE,
headset_methods, headset_signals, NULL,
- dev, NULL)) {
+ dev, path_unregister)) {
g_free(hs);
return NULL;
}
@@ -1614,29 +1653,6 @@ uint32_t headset_config_init(GKeyFile *config)
return ag_features;
}
-void headset_free(struct audio_device *dev)
-{
- struct headset *hs = dev->headset;
-
- if (hs->dc_timer) {
- g_source_remove(hs->dc_timer);
- hs->dc_timer = 0;
- }
-
- if (hs->sco) {
- g_io_channel_close(hs->sco);
- g_io_channel_unref(hs->sco);
- }
-
- if (hs->rfcomm) {
- g_io_channel_close(hs->rfcomm);
- g_io_channel_unref(hs->rfcomm);
- }
-
- g_free(hs);
- dev->headset = NULL;
-}
-
static gboolean hs_dc_timeout(struct audio_device *dev)
{
headset_set_state(dev, HEADSET_STATE_DISCONNECTED);