aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-02-07 12:00:50 +0000
committerConor Curran <conor.curran@canonical.com>2011-02-07 12:00:50 +0000
commit373460533ffcd4217b96ed1e95672f7e73141824 (patch)
tree11af83f88f605073706ee41a5a8e9712a6c9d79c
parent04aeb610a1b29aa3c3a43385434b011d93a1bf03 (diff)
downloadayatana-indicator-sound-373460533ffcd4217b96ed1e95672f7e73141824.tar.gz
ayatana-indicator-sound-373460533ffcd4217b96ed1e95672f7e73141824.tar.bz2
ayatana-indicator-sound-373460533ffcd4217b96ed1e95672f7e73141824.zip
filter the number of signals sent, only send a signal when the state changes
-rw-r--r--src/active-sink.c15
1 files changed, 10 insertions, 5 deletions
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