aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-03-16 12:11:27 +0000
committerConor Curran <conor.curran@canonical.com>2011-03-16 12:11:27 +0000
commit205489a9c85c3c3d5d2caa7f48850cf04f29a70d (patch)
tree880591392fbbf89cf1fd80c3f7b2d2df9ef65d61 /src
parentd0ef5f9435e10d39baea01c9d240e4149a80944c (diff)
downloadayatana-indicator-sound-205489a9c85c3c3d5d2caa7f48850cf04f29a70d.tar.gz
ayatana-indicator-sound-205489a9c85c3c3d5d2caa7f48850cf04f29a70d.tar.bz2
ayatana-indicator-sound-205489a9c85c3c3d5d2caa7f48850cf04f29a70d.zip
removed the restriction of not being able to use the key shortcuts on the slider if its muted@
Diffstat (limited to 'src')
-rw-r--r--src/indicator-sound.c43
-rw-r--r--src/sound-service.c2
-rw-r--r--src/voip-input-widget.c2
-rw-r--r--src/volume-widget.c3
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,