diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-11-15 13:17:22 +0000 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-11-15 13:17:22 +0000 |
commit | 41284d027bd0c0eeff0e83e10b365f98a6977f59 (patch) | |
tree | 5bf386df9dfcd316deafdfd218ec8c34aa599d30 /src/indicator-sound.c | |
parent | 5fd2c5e12a059ab8c59306676d18dfc56c818077 (diff) | |
download | ayatana-indicator-sound-41284d027bd0c0eeff0e83e10b365f98a6977f59.tar.gz ayatana-indicator-sound-41284d027bd0c0eeff0e83e10b365f98a6977f59.tar.bz2 ayatana-indicator-sound-41284d027bd0c0eeff0e83e10b365f98a6977f59.zip |
keyboard handling for the transport controls underway
Diffstat (limited to 'src/indicator-sound.c')
-rw-r--r-- | src/indicator-sound.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 13f1529..53a4876 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -47,6 +47,7 @@ typedef struct _IndicatorSoundPrivate IndicatorSoundPrivate; struct _IndicatorSoundPrivate { GtkWidget* volume_widget; + GtkWidget* transport_widget; }; #define INDICATOR_SOUND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_SOUND_TYPE, IndicatorSoundPrivate)) @@ -241,11 +242,16 @@ new_transport_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbus //g_debug("indicator-sound: new_transport_bar() called "); GtkWidget* bar = NULL; + IndicatorObject *io = NULL; g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); bar = transport_widget_new(newitem); + io = g_object_get_data (G_OBJECT (client), "indicator"); + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io)); + priv->transport_widget = bar; + GtkMenuItem *menu_transport_bar = GTK_MENU_ITEM(bar); gtk_widget_show_all(bar); @@ -706,9 +712,34 @@ key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data) 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); - volume_widget_update(VOLUME_WIDGET(priv->volume_widget), new_value); + volume_widget_update(VOLUME_WIDGET(priv->volume_widget), new_value); } } + if (IS_TRANSPORT_WIDGET(menuitem) == TRUE) { + switch (event->keyval) { + case GDK_Right: + transport_widget_react_to_key_event ( TRANSPORT_WIDGET ( priv->transport_widget ), + TRANSPORT_NEXT ); + digested = TRUE; + break; + case GDK_Left: + transport_widget_react_to_key_event ( TRANSPORT_WIDGET ( priv->transport_widget ), + TRANSPORT_PREVIOUS ); + digested = TRUE; + break; + case GDK_KEY_space: + transport_widget_react_to_key_event ( TRANSPORT_WIDGET ( priv->transport_widget ), + TRANSPORT_PLAY_PAUSE ); + digested = TRUE; + break; + case GDK_Up: + case GDK_Down: + digested = FALSE; + break; + default: + break; + } + } return digested; } |