summaryrefslogtreecommitdiffstats
path: root/src/modules/module-device-manager.c
diff options
context:
space:
mode:
authorColin Guthrie <cguthrie@mandriva.org>2009-09-27 16:55:31 +0100
committerColin Guthrie <cguthrie@mandriva.org>2009-10-01 09:08:32 +0100
commit8977abdc840989975d79d041ffcaf48804d7a52b (patch)
treeb5ea87289c74b6fc3c70182c67cf091dd5fbbdc4 /src/modules/module-device-manager.c
parentbbf67019df9a16fa27594054c0df222acd408b12 (diff)
device-manager: Don't notify clients on every subscription (it happens all the time).
Also compare the entries fully before saving.
Diffstat (limited to 'src/modules/module-device-manager.c')
-rw-r--r--src/modules/module-device-manager.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c
index 0764ad02..89fb4609 100644
--- a/src/modules/module-device-manager.c
+++ b/src/modules/module-device-manager.c
@@ -323,10 +323,18 @@ static void trigger_save(struct userdata *u) {
}
static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) {
- /** @todo: Compare the priority lists too */
- if (strncmp(a->description, b->description, sizeof(a->description)))
+
+ pa_assert(a);
+ pa_assert(b);
+
+ if (strncmp(a->description, b->description, sizeof(a->description))
+ || strncmp(a->icon, b->icon, sizeof(a->icon)))
return FALSE;
+ for (int i=0; i < NUM_ROLES; ++i)
+ if (a->priority[i] != b->priority[i])
+ return FALSE;
+
return TRUE;
}
@@ -699,10 +707,6 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
pa_xfree(old);
pa_xfree(name);
- /* Even if the entries are equal, the availability or otherwise
- of the sink/source may have changed so we notify clients all the same */
- notify_subscribers(u);
-
return;
}
@@ -857,6 +861,8 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, PA_GCC_UNUSED pa_sink
pa_assert(u->core == c);
pa_assert(u->on_hotplug);
+ notify_subscribers(u);
+
return route_sink_inputs(u, NULL);
}
@@ -866,6 +872,8 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, PA_GCC_UNUSED pa_so
pa_assert(u->core == c);
pa_assert(u->on_hotplug);
+ notify_subscribers(u);
+
return route_source_outputs(u, NULL);
}
@@ -880,6 +888,8 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, str
if (c->state == PA_CORE_SHUTDOWN)
return PA_HOOK_OK;
+ notify_subscribers(u);
+
return route_sink_inputs(u, sink);
}
@@ -894,6 +904,8 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc
if (c->state == PA_CORE_SHUTDOWN)
return PA_HOOK_OK;
+ notify_subscribers(u);
+
return route_source_outputs(u, source);
}