diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-02-18 15:38:45 +0000 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-02-18 15:38:45 +0000 |
commit | fca4da8d8a9dd24d8abdf2a92cf19a0c6d596e48 (patch) | |
tree | 51f3baaa19ed8ce927cf92812b8ad1d377bd94ff /src/voip-input-widget.c | |
parent | d8cc480485f8f46142298341ef5336a0572be5b4 (diff) | |
download | ayatana-indicator-sound-fca4da8d8a9dd24d8abdf2a92cf19a0c6d596e48.tar.gz ayatana-indicator-sound-fca4da8d8a9dd24d8abdf2a92cf19a0c6d596e48.tar.bz2 ayatana-indicator-sound-fca4da8d8a9dd24d8abdf2a92cf19a0c6d596e48.zip |
fully functional voip feature landed
Diffstat (limited to 'src/voip-input-widget.c')
-rw-r--r-- | src/voip-input-widget.c | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/src/voip-input-widget.c b/src/voip-input-widget.c index de06c7c..9b29feb 100644 --- a/src/voip-input-widget.c +++ b/src/voip-input-widget.c @@ -76,7 +76,6 @@ voip_input_widget_class_init (VoipInputWidgetClass *klass) static void voip_input_widget_init (VoipInputWidget *self) { - //g_debug("VoipInputWidget::voip_input_widget_init"); VoipInputWidgetPrivate * priv = VOIP_INPUT_WIDGET_GET_PRIVATE(self); priv->ido_voip_input_slider = ido_scale_menu_item_new_with_range ("VOLUME", IDO_RANGE_STYLE_DEFAULT, 0, 0, 100, 1); @@ -122,8 +121,8 @@ voip_input_widget_finalize (GObject *object) } static void -voip_input_widget_property_update( DbusmenuMenuitem* item, gchar* property, - GVariant* value, gpointer userdata) +voip_input_widget_property_update (DbusmenuMenuitem* item, gchar* property, + GVariant* value, gpointer userdata) { g_return_if_fail (IS_VOIP_INPUT_WIDGET (userdata)); VoipInputWidget* mitem = VOIP_INPUT_WIDGET(userdata); @@ -138,6 +137,24 @@ voip_input_widget_property_update( DbusmenuMenuitem* item, gchar* property, gtk_range_set_value(range, update); } } + if(g_ascii_strcasecmp(DBUSMENU_VOIP_INPUT_MENUITEM_MUTE, property) == 0){ + if(priv->grabbed == FALSE){ + GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_voip_input_slider); + GtkRange *range = (GtkRange*)slider; + gint update = g_variant_get_int32 (value); + gdouble level; + if (update == 1){ + level = 0; + } + else{ + level = g_variant_get_double (dbusmenu_menuitem_property_get_variant (priv->twin_item, + DBUSMENU_VOIP_INPUT_MENUITEM_LEVEL)); + } + gtk_range_set_value(range, level); + + g_debug ("voip-item-widget - update mute with value %i", update); + } + } } static void @@ -155,6 +172,12 @@ voip_input_widget_set_twin_item (VoipInputWidget* self, GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_voip_input_slider); GtkRange *range = (GtkRange*)slider; gtk_range_set_value(range, initial_level); + + gint mute = g_variant_get_int32 (dbusmenu_menuitem_property_get_variant (priv->twin_item, + DBUSMENU_VOIP_INPUT_MENUITEM_MUTE)); + if (mute == 1){ + gtk_range_set_value (range, 0.0); + } } static gboolean @@ -170,10 +193,12 @@ voip_input_widget_change_value_cb (GtkRange *range, } -/* - We only want this callback to catch mouse icon press events - which set the slider to 0 or 100. Ignore all other events. -*/ +/** + * We only want this callback to catch mouse icon press events which set the + * slider to 0 or 100. Ignore all other events including the new Mute behaviour + * (slider to go to 0 on mute without setting the level to 0 and return to + * previous level on unmute) + **/ static gboolean voip_input_widget_value_changed_cb(GtkRange *range, gpointer user_data) { @@ -183,7 +208,9 @@ voip_input_widget_value_changed_cb(GtkRange *range, gpointer user_data) GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_voip_input_slider); gdouble current_value = CLAMP(gtk_range_get_value(GTK_RANGE(slider)), 0, 100); - if(current_value == 0 || current_value == 100){ + gint mute = g_variant_get_int32 (dbusmenu_menuitem_property_get_variant (priv->twin_item, + DBUSMENU_VOIP_INPUT_MENUITEM_MUTE)); + if ((current_value == 0 && mute != 1) || current_value == 100 ){ voip_input_widget_update(mitem, current_value); } return FALSE; |