From 205489a9c85c3c3d5d2caa7f48850cf04f29a70d Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 16 Mar 2011 12:11:27 +0000 Subject: removed the restriction of not being able to use the key shortcuts on the slider if its muted@ --- src/indicator-sound.c | 43 +++++++++++++++++++++++++++++++++---------- src/sound-service.c | 2 ++ src/voip-input-widget.c | 2 ++ src/volume-widget.c | 3 ++- 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/src/indicator-sound.c b/src/indicator-sound.c index a7d3808..22ecebe 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,38 @@ 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; +*/ + gdouble current_value = 0; + gdouble new_value = 0; 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){ + 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; + } + switch (event->keyval) { case GDK_Right: digested = TRUE; @@ -514,7 +537,7 @@ 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) { + if (new_value != current_value) { //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); } diff --git a/src/sound-service.c b/src/sound-service.c index cfc0b7e..9f44624 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -39,8 +39,10 @@ service_shutdown (IndicatorService *service, gpointer user_data) { if (mainloop != NULL) { g_debug("Service shutdown !"); +/* close_pulse_activites(); g_main_loop_quit(mainloop); +*/ } return; } diff --git a/src/voip-input-widget.c b/src/voip-input-widget.c index aec0c96..6878361 100644 --- a/src/voip-input-widget.c +++ b/src/voip-input-widget.c @@ -80,6 +80,8 @@ voip_input_widget_init (VoipInputWidget *self) priv->ido_voip_input_slider = ido_scale_menu_item_new_with_range ("VOLUME", IDO_RANGE_STYLE_DEFAULT, 0, 0, 100, 1); g_object_ref (priv->ido_voip_input_slider); + ido_scale_menu_item_set_primary_label (IDO_SCALE_MENU_ITEM(priv->ido_voip_input_slider), "VOIP"); + ido_scale_menu_item_set_style (IDO_SCALE_MENU_ITEM (priv->ido_voip_input_slider), IDO_SCALE_MENU_ITEM_STYLE_IMAGE); g_object_set(priv->ido_voip_input_slider, "reverse-scroll-events", TRUE, NULL); diff --git a/src/volume-widget.c b/src/volume-widget.c index 55e81b3..f638bd4 100644 --- a/src/volume-widget.c +++ b/src/volume-widget.c @@ -83,7 +83,8 @@ volume_widget_init (VolumeWidget *self) priv->ido_volume_slider = ido_scale_menu_item_new_with_range ("VOLUME", IDO_RANGE_STYLE_DEFAULT, 0, 0, 100, 1); g_object_ref (priv->ido_volume_slider); - ido_scale_menu_item_set_style (IDO_SCALE_MENU_ITEM (priv->ido_volume_slider), IDO_SCALE_MENU_ITEM_STYLE_IMAGE); + ido_scale_menu_item_set_primary_label (IDO_SCALE_MENU_ITEM(priv->ido_volume_slider), "VOLUME"); + ido_scale_menu_item_set_style (IDO_SCALE_MENU_ITEM (priv->ido_volume_slider), IDO_SCALE_MENU_ITEM_STYLE_IMAGE); g_object_set(priv->ido_volume_slider, "reverse-scroll-events", TRUE, NULL); g_signal_connect (priv->ido_volume_slider, -- cgit v1.2.3 From a893dae8a5ab7f5f02e8eb1d1db626c135b3383d Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 16 Mar 2011 12:38:04 +0000 Subject: keyhandling for the voip slider now working and voip slider now activated when app role is also production --- src/indicator-sound.c | 25 +++++++++++++------------ src/pulseaudio-mgr.c | 2 +- src/sound-service.c | 2 -- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 22ecebe..7d74a42 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -484,19 +484,15 @@ 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; - } -*/ - gdouble current_value = 0; - gdouble new_value = 0; - const gdouble five_percent = 5; - GtkWidget *menuitem; menuitem = GTK_MENU_SHELL (widget)->active_menu_item; 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)); @@ -514,6 +510,7 @@ key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data) 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) { @@ -537,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) { - //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) { diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c index 8811bcf..95f4c06 100644 --- a/src/pulseaudio-mgr.c +++ b/src/pulseaudio-mgr.c @@ -483,7 +483,7 @@ pm_sink_input_info_callback (pa_context *c, g_debug ("Sink input info has media role property"); const char* value = pa_proplist_gets (info->proplist, PA_PROP_MEDIA_ROLE); g_debug ("prop role = %s", value); - if (g_strcmp0 (value, "phone") == 0) { + if (g_strcmp0 (value, "phone") == 0 || g_strcmp0 (value, "production") == 0) { g_debug ("And yes its a VOIP app ... sink input index = %i", info->index); device_activate_voip_item (a_sink, (gint)info->index, (gint)info->client); // TODO to start with we will assume our source is the same as what this 'client' diff --git a/src/sound-service.c b/src/sound-service.c index 9f44624..cfc0b7e 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -39,10 +39,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) { if (mainloop != NULL) { g_debug("Service shutdown !"); -/* close_pulse_activites(); g_main_loop_quit(mainloop); -*/ } return; } -- cgit v1.2.3