aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-sound.c
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-03-03 17:23:08 +0000
committerConor Curran <conor.curran@canonical.com>2010-03-03 17:23:08 +0000
commiteb3df565591fb7474aa5290db83ca601a7edd1ee (patch)
tree9422fad243a361081a01335ce45867eb6ba0b42a /src/indicator-sound.c
parent87478982de012b8322090f40a747ab42f7dd838c (diff)
downloadayatana-indicator-sound-eb3df565591fb7474aa5290db83ca601a7edd1ee.tar.gz
ayatana-indicator-sound-eb3df565591fb7474aa5290db83ca601a7edd1ee.tar.bz2
ayatana-indicator-sound-eb3df565591fb7474aa5290db83ca601a7edd1ee.zip
fixes the key listener problems
Diffstat (limited to 'src/indicator-sound.c')
-rw-r--r--src/indicator-sound.c86
1 files changed, 44 insertions, 42 deletions
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index 49c02fa..63d48aa 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -441,51 +441,53 @@ static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer dat
const gdouble five_percent = 5;
GtkWidget *menuitem;
- menuitem = gtk_menu_get_active (GTK_MENU (widget));
- g_print (g_type_name (menuitem));
-
- switch(event->keyval)
- {
- case GDK_Right:
- digested = TRUE;
- if(event->state & GDK_CONTROL_MASK)
- {
- new_value = 100;
- }
- else
- {
- new_value = current_value + five_percent;
- }
- break;
- case GDK_Left:
- digested = TRUE;
- if(event->state & GDK_CONTROL_MASK)
- {
- new_value = 0;
- }
- else
+ menuitem = GTK_MENU_SHELL (widget)->active_menu_item;
+/* g_print ("object (%p) name should be %s", menuitem, G_OBJECT_TYPE_NAME(menuitem));*/
+ if(IDO_IS_SCALE_MENU_ITEM(menuitem) == TRUE)
+ {
+ switch(event->keyval)
{
+ case GDK_Right:
+ digested = TRUE;
+ if(event->state & GDK_CONTROL_MASK)
+ {
+ new_value = 100;
+ }
+ else
+ {
+ new_value = current_value + five_percent;
+ }
+ break;
+ case GDK_Left:
+ digested = TRUE;
+ if(event->state & GDK_CONTROL_MASK)
+ {
+ new_value = 0;
+ }
+ else
+ {
+ new_value = current_value - five_percent;
+ }
+ break;
+ case GDK_plus:
+ digested = TRUE;
+ new_value = current_value + five_percent;
+ break;
+ case GDK_minus:
+ digested = TRUE;
new_value = current_value - five_percent;
+ break;
+ default:
+ break;
+ }
+
+ new_value = CLAMP(new_value, 0, 100);
+ if(new_value != current_value && current_state != STATE_MUTED)
+ {
+ g_debug("Attempting to set the range from the key listener to %f", new_value);
+ gtk_range_set_value(range, new_value);
}
- break;
- case GDK_plus:
- digested = TRUE;
- new_value = current_value + five_percent;
- break;
- case GDK_minus:
- digested = TRUE;
- new_value = current_value - five_percent;
- break;
- default:
- break;
- }
-
- new_value = CLAMP(new_value, 0, 100);
- if(new_value != current_value && current_state != STATE_MUTED)
- {
- g_debug("Attempting to set the range from the key listener to %f", new_value);
- gtk_range_set_value(range, new_value);
- }
+ }
return digested;
}