diff options
author | Ken VanDine <ken.vandine@canonical.com> | 2011-03-17 14:08:16 -0400 |
---|---|---|
committer | Ken VanDine <ken.vandine@canonical.com> | 2011-03-17 14:08:16 -0400 |
commit | 7619eab48daaa739fb3418237c693b7b463182f0 (patch) | |
tree | 0f87b54f1425f9228c950d906eba75173fa19f6a /src/indicator-sound.c | |
parent | a65cff5ec2d7625408d58fe6b23ddb40d7f63ee2 (diff) | |
parent | 6de8affd0a17ab7729ac7647d8e84e58a158601a (diff) | |
download | ayatana-indicator-sound-7619eab48daaa739fb3418237c693b7b463182f0.tar.gz ayatana-indicator-sound-7619eab48daaa739fb3418237c693b7b463182f0.tar.bz2 ayatana-indicator-sound-7619eab48daaa739fb3418237c693b7b463182f0.zip |
Import upstream version 0.6.4
Diffstat (limited to 'src/indicator-sound.c')
-rw-r--r-- | src/indicator-sound.c | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/src/indicator-sound.c b/src/indicator-sound.c index a7d3808..7d74a42 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -45,6 +45,7 @@ typedef struct _IndicatorSoundPrivate IndicatorSoundPrivate; struct _IndicatorSoundPrivate { GtkWidget* volume_widget; + GtkWidget* voip_widget; GList* transport_widgets_list; GDBusProxy *dbus_proxy; SoundStateManager* state_manager; @@ -443,11 +444,16 @@ new_voip_slider_widget (DbusmenuMenuitem * newitem, { g_debug("indicator-sound: new_voip_slider_widget"); GtkWidget* voip_widget = NULL; + IndicatorObject *io = NULL; g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); + io = g_object_get_data (G_OBJECT (client), "indicator"); + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io)); + voip_widget = voip_input_widget_new (newitem); + priv->voip_widget = voip_widget; GtkWidget* ido_slider_widget = voip_input_widget_get_ido_slider(VOIP_INPUT_WIDGET(voip_widget)); @@ -478,21 +484,35 @@ key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data) IndicatorSound *indicator = INDICATOR_SOUND (data); IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator); - if(priv->volume_widget == NULL){ - return FALSE; - } - - GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); - GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)slider_widget); - GtkRange* range = (GtkRange*)slider; - g_return_val_if_fail(GTK_IS_RANGE(range), FALSE); - gdouble current_value = gtk_range_get_value(range); - gdouble new_value = current_value; - const gdouble five_percent = 5; GtkWidget *menuitem; - menuitem = GTK_MENU_SHELL (widget)->active_menu_item; - if (IDO_IS_SCALE_MENU_ITEM(menuitem) == TRUE) { + + if (IDO_IS_SCALE_MENU_ITEM(menuitem) == TRUE){ + gdouble current_value = 0; + gdouble new_value = 0; + const gdouble five_percent = 5; + gboolean is_voip_slider = FALSE; + + if (g_ascii_strcasecmp (ido_scale_menu_item_get_primary_label (IDO_SCALE_MENU_ITEM(menuitem)), "VOLUME") == 0) { + g_debug ("vOLUME SLIDER KEY PRESS"); + GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); + GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)slider_widget); + GtkRange* range = (GtkRange*)slider; + g_return_val_if_fail(GTK_IS_RANGE(range), FALSE); + current_value = gtk_range_get_value(range); + new_value = current_value; + } + else if (g_ascii_strcasecmp (ido_scale_menu_item_get_primary_label (IDO_SCALE_MENU_ITEM(menuitem)), "VOIP") == 0) { + g_debug ("VOIP SLIDER KEY PRESS"); + GtkWidget* slider_widget = voip_input_widget_get_ido_slider(VOIP_INPUT_WIDGET(priv->voip_widget)); + GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)slider_widget); + GtkRange* range = (GtkRange*)slider; + g_return_val_if_fail(GTK_IS_RANGE(range), FALSE); + current_value = gtk_range_get_value(range); + new_value = current_value; + is_voip_slider = TRUE; + } + switch (event->keyval) { case GDK_Right: digested = TRUE; @@ -514,9 +534,13 @@ key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data) break; } new_value = CLAMP(new_value, 0, 100); - if (new_value != current_value && sound_state_manager_get_current_state (priv->state_manager) != MUTED) { - //g_debug("Attempting to set the range from the key listener to %f", new_value); - volume_widget_update(VOLUME_WIDGET(priv->volume_widget), new_value); + if (new_value != current_value){ + if (is_voip_slider == TRUE){ + voip_input_widget_update (VOIP_INPUT_WIDGET(priv->voip_widget), new_value); + } + else{ + volume_widget_update (VOLUME_WIDGET(priv->volume_widget), new_value); + } } } else if (IS_TRANSPORT_WIDGET(menuitem) == TRUE) { |