From 373460533ffcd4217b96ed1e95672f7e73141824 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 7 Feb 2011 12:00:50 +0000 Subject: filter the number of signals sent, only send a signal when the state changes --- src/active-sink.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/active-sink.c b/src/active-sink.c index 62aa8d2..762511d 100644 --- a/src/active-sink.c +++ b/src/active-sink.c @@ -140,9 +140,12 @@ active_sink_volume_update (ActiveSink* self, gdouble percent) { ActiveSinkPrivate* priv = ACTIVE_SINK_GET_PRIVATE (self); slider_menu_item_update (priv->volume_slider_menuitem, percent); - priv->current_sound_state = active_sink_get_state_from_volume (self); - sound_service_dbus_update_sound_state (priv->service, - priv->current_sound_state); + SoundState state = active_sink_get_state_from_volume (self); + if (priv->current_sound_state != state){ + priv->current_sound_state = state; + sound_service_dbus_update_sound_state (priv->service, + priv->current_sound_state); + } } // From the UI @@ -172,8 +175,10 @@ active_sink_mute_update (ActiveSink* self, gboolean muted) if (muted == TRUE){ state = MUTED; } - priv->current_sound_state = state; - sound_service_dbus_update_sound_state (priv->service, state); + if (priv->current_sound_state != state){ + priv->current_sound_state = state; + sound_service_dbus_update_sound_state (priv->service, state); + } } void -- cgit v1.2.3