aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-03-16 13:16:17 +0000
committerConor Curran <conor.curran@canonical.com>2011-03-16 13:16:17 +0000
commit58facf2f0db4e60a78f101c6d6273b4331981deb (patch)
tree908eff545add881018d8318d8e187c757a13865c
parentd0ef5f9435e10d39baea01c9d240e4149a80944c (diff)
parenta893dae8a5ab7f5f02e8eb1d1db626c135b3383d (diff)
downloadayatana-indicator-sound-58facf2f0db4e60a78f101c6d6273b4331981deb.tar.gz
ayatana-indicator-sound-58facf2f0db4e60a78f101c6d6273b4331981deb.tar.bz2
ayatana-indicator-sound-58facf2f0db4e60a78f101c6d6273b4331981deb.zip
key shortcuts now working on voip slider
-rw-r--r--src/indicator-sound.c56
-rw-r--r--src/pulseaudio-mgr.c2
-rw-r--r--src/voip-input-widget.c2
-rw-r--r--src/volume-widget.c3
4 files changed, 45 insertions, 18 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) {
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/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,