diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-11-15 17:18:19 +0000 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-11-15 17:18:19 +0000 |
commit | eaee3afe6312a04ce41daed8d380ac5e49616ed6 (patch) | |
tree | 63102d9a835f95b9a4314f1af2c75a17577a92d0 /src | |
parent | 41284d027bd0c0eeff0e83e10b365f98a6977f59 (diff) | |
download | ayatana-indicator-sound-eaee3afe6312a04ce41daed8d380ac5e49616ed6.tar.gz ayatana-indicator-sound-eaee3afe6312a04ce41daed8d380ac5e49616ed6.tar.bz2 ayatana-indicator-sound-eaee3afe6312a04ce41daed8d380ac5e49616ed6.zip |
key handling all set up
Diffstat (limited to 'src')
-rw-r--r-- | src/indicator-sound.c | 3 | ||||
-rw-r--r-- | src/sound-service.c | 4 | ||||
-rw-r--r-- | src/transport-widget.c | 43 | ||||
-rw-r--r-- | src/transport-widget.h | 1 |
4 files changed, 42 insertions, 9 deletions
diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 53a4876..b39d064 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -715,7 +715,7 @@ key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data) volume_widget_update(VOLUME_WIDGET(priv->volume_widget), new_value); } } - if (IS_TRANSPORT_WIDGET(menuitem) == TRUE) { + else if (IS_TRANSPORT_WIDGET(menuitem) == TRUE) { switch (event->keyval) { case GDK_Right: transport_widget_react_to_key_event ( TRANSPORT_WIDGET ( priv->transport_widget ), @@ -761,7 +761,6 @@ indicator_sound_scroll (IndicatorObject *io, gint delta, IndicatorScrollDirectio if (device_available == FALSE || current_state == STATE_MUTED) return; - IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io)); GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); diff --git a/src/sound-service.c b/src/sound-service.c index 51f5f37..f19379d 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -41,8 +41,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); //TODO: uncomment for release !! - //close_pulse_activites(); - //g_main_loop_quit(mainloop); + close_pulse_activites(); + g_main_loop_quit(mainloop); } return; } diff --git a/src/transport-widget.c b/src/transport-widget.c index 3329acc..63fec4b 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -77,6 +77,7 @@ struct _TransportWidgetPrivate TransportWidgetState current_state; GHashTable* command_coordinates; DbusmenuMenuitem* twin_item; + gboolean has_focus; }; #define TRANSPORT_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRANSPORT_WIDGET_TYPE, TransportWidgetPrivate)) @@ -114,6 +115,9 @@ static void transport_widget_react_to_button_release ( TransportWidget* button, TransportWidgetEvent command); static void transport_widget_toggle_play_pause ( TransportWidget* button, TransportWidgetState update); +static void transport_widget_select (GtkItem* menu, gpointer Userdata); +static void transport_widget_deselect (GtkItem* menu, gpointer Userdata); + /// Init functions ////////////////////////////////////////////////////////// @@ -139,6 +143,7 @@ transport_widget_init (TransportWidget *self) TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(self); priv->current_command = TRANSPORT_NADA; priv->current_state = PAUSE; + priv->has_focus = FALSE; priv->command_coordinates = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, @@ -171,12 +176,20 @@ transport_widget_init (TransportWidget *self) g_hash_table_insert(priv->command_coordinates, GINT_TO_POINTER(TRANSPORT_NEXT), next_list); - gtk_widget_set_size_request(GTK_WIDGET(self), 200, 43); g_signal_connect (G_OBJECT(self), "notify", G_CALLBACK (transport_widget_notify), - NULL); + NULL); + g_signal_connect (GTK_ITEM(self), + "select", + G_CALLBACK (transport_widget_select), + NULL); + g_signal_connect (GTK_ITEM(self), + "deselect", + G_CALLBACK (transport_widget_deselect), + NULL); + } static void @@ -249,7 +262,6 @@ transport_widget_button_press_event (GtkWidget *menuitem, { g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE ); TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) ); - TransportWidgetEvent result = transport_widget_determine_button_event ( TRANSPORT_WIDGET(menuitem), event); if(result != TRANSPORT_NADA){ @@ -282,12 +294,27 @@ transport_widget_button_release_event (GtkWidget *menuitem, &value, 0 ); } - transport_widget_react_to_button_release ( transport, result ); return TRUE; } +static void +transport_widget_select (GtkItem* item, gpointer Userdata) +{ + TransportWidget* transport = TRANSPORT_WIDGET(item); + TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport ); + priv->has_focus = TRUE; +} + +static void +transport_widget_deselect (GtkItem* item, gpointer Userdata) +{ + TransportWidget* transport = TRANSPORT_WIDGET(item); + TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport ); + priv->has_focus = FALSE; +} + void transport_widget_react_to_key_event ( TransportWidget* transport, TransportWidgetEvent transport_event ) @@ -308,6 +335,14 @@ transport_widget_react_to_key_event ( TransportWidget* transport, transport_event ); } +void +transport_widget_focus_update ( TransportWidget* transport, gboolean focus ) +{ + TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport ); + priv->has_focus = focus; + g_debug("new focus update = %i", focus); +} + static TransportWidgetEvent transport_widget_determine_button_event( TransportWidget* button, GdkEventButton* event ) diff --git a/src/transport-widget.h b/src/transport-widget.h index 470b1cd..58a224c 100644 --- a/src/transport-widget.h +++ b/src/transport-widget.h @@ -68,7 +68,6 @@ GType transport_widget_get_type (void); GtkWidget* transport_widget_new ( DbusmenuMenuitem *item ); void transport_widget_react_to_key_event ( TransportWidget* widget, TransportWidgetEvent transport_event ); - G_END_DECLS #endif |