diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-02-10 01:00:27 +0000 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-02-10 01:00:27 +0000 |
commit | 43bcb8cdaeed6260b0b707573e21fec554fd5991 (patch) | |
tree | a7d62f7c10a328a960f13f0248336e2ba82cfeda /src | |
parent | b117e1edcf717da7d0d0cd890a85cc86366df931 (diff) | |
download | ayatana-indicator-sound-43bcb8cdaeed6260b0b707573e21fec554fd5991.tar.gz ayatana-indicator-sound-43bcb8cdaeed6260b0b707573e21fec554fd5991.tar.bz2 ayatana-indicator-sound-43bcb8cdaeed6260b0b707573e21fec554fd5991.zip |
silly/nasty scaling bug caught
Diffstat (limited to 'src')
-rw-r--r-- | src/common-defs.h | 2 | ||||
-rw-r--r-- | src/indicator-sound.c | 15 | ||||
-rw-r--r-- | src/pulse-manager.c | 8 |
3 files changed, 14 insertions, 11 deletions
diff --git a/src/common-defs.h b/src/common-defs.h index 4009773..896caba 100644 --- a/src/common-defs.h +++ b/src/common-defs.h @@ -1,7 +1,7 @@ /* constants used for signals on the dbus. This file is shared between client and server implementation */ #define SIGNAL_SINK_INPUT_WHILE_MUTED "SinkInputWhileMuted" #define SIGNAL_SINK_VOLUME_UPDATE "SinkVolumeUpdate" -//#define SIGNAL_SINK_MUTE_UPDATE "SinkMuteUpdate" +#define SIGNAL_SINK_MUTE_UPDATE "SinkMuteUpdate" // DBUS items #define DBUSMENU_SLIDER_MENUITEM_TYPE "x-canonical-ido-slider-item" diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 10ce2ca..7adaaef 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -93,6 +93,7 @@ static DBusGProxy *sound_dbus_proxy = NULL; static void connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer userdata); static void catch_signal_sink_input_while_muted(DBusGProxy * proxy, gint sink_index, gboolean value, gpointer userdata); static void catch_signal_sink_volume_update(DBusGProxy * proxy, gdouble volume_percent, gpointer userdata); +static void catch_signal_sink_mute_update(DBusGProxy *proxy, gboolean mute_value, gpointer userdata); /****Volume States 'members' ***/ static const gint STATE_MUTED = 0; @@ -191,6 +192,9 @@ connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer u dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_INPUT_WHILE_MUTED, G_CALLBACK(catch_signal_sink_input_while_muted), NULL, NULL); dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_VOLUME_UPDATE, G_TYPE_DOUBLE, G_TYPE_INVALID); dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_VOLUME_UPDATE, G_CALLBACK(catch_signal_sink_volume_update), NULL, NULL); + dbus_g_proxy_add_signal(sound_dbus_proxy, SIGNAL_SINK_MUTE_UPDATE, G_TYPE_BOOLEAN, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(sound_dbus_proxy, SIGNAL_SINK_MUTE_UPDATE, G_CALLBACK(catch_signal_sink_mute_update), NULL, NULL); + gdouble *volume_percent_input; volume_percent_input = g_new0(gdouble, 1); org_ayatana_indicator_sound_get_sink_volume(sound_dbus_proxy, volume_percent_input, &error); @@ -218,15 +222,20 @@ static void catch_signal_sink_input_while_muted(DBusGProxy * proxy, gint sink_in g_debug("signal caught - sink input while muted with index %i and value %i", sink_index, value); } -static void catch_signal_sink_volume_update(DBusGProxy * proxy, gdouble volume_percent, gpointer userdata) +static void catch_signal_sink_volume_update(DBusGProxy *proxy, gdouble volume_percent, gpointer userdata) { g_debug("signal caught - update sink volume with value : %f", volume_percent); - GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)volume_slider); - GtkRange* range = (GtkRange*)slider; + GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)volume_slider); + GtkRange *range = (GtkRange*)slider; gtk_range_set_value(range, volume_percent); determine_state_from_volume(volume_percent); } +static void catch_signal_sink_mute_update(DBusGProxy *proxy, gboolean mute_value, gpointer userdata) +{ + g_debug("signal caught - sink mute update with mute_value %i", mute_value); +} + static void indicator_sound_dispose (GObject *object) diff --git a/src/pulse-manager.c b/src/pulse-manager.c index 858ae7b..11fd34f 100644 --- a/src/pulse-manager.c +++ b/src/pulse-manager.c @@ -276,11 +276,8 @@ static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, v GList *keys = g_hash_table_get_keys(sink_hash); gint position = g_list_index(keys, GINT_TO_POINTER(info->index)); -/* gboolean update_ui_vol = FALSE;*/ if(position >= 0) // => index is within the keys of the hash. { - // TODO : update sinks hash with new details and if default send over dbus the update. in reverse order. - //gint sink_index = GPOINTER_TO_INT(g_list_nth_data(keys, position)); sink_info *s = g_hash_table_lookup(sink_hash, GINT_TO_POINTER(info->index)); g_debug("attempting to update sink with name %s", s->name); s->name = g_strdup(info->name); @@ -288,9 +285,6 @@ static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, v s->icon_name = g_strdup(pa_proplist_gets(info->proplist, PA_PROP_DEVICE_ICON_NAME)); s->active_port = (info->active_port != NULL); s->mute = !!info->mute; -/* int equal = pa_cvolume_equal(&s->volume, &info->volume);*/ -/* update_ui_vol = (equal != 0); */ -/* g_debug("Are the volumes the same %i", equal); */ s->volume = info->volume; s->base_volume = info->base_volume; s->channel_map = info->channel_map; @@ -303,7 +297,7 @@ static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, v g_debug("When using base volume => volume = %f", volume_percent); g_debug("about to update ui with linear volume of %f", pa_sw_volume_to_linear(vol)); sound_service_dbus_update_sink_volume(dbus_service, pa_sw_volume_to_linear(vol)); - + sound_service_dbus_update_sink_mute(dbus_service, s->mute); update_mute_ui(s->mute); } else{ |