aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Cimitan <andrea.cimitan@canonical.com>2010-11-16 02:17:44 +0100
committerAndrea Cimitan <andrea.cimitan@canonical.com>2010-11-16 02:17:44 +0100
commit510a01f7c97b726cd9ee46ffa30d3b0383b36146 (patch)
tree3c8a8cde441abfee25a98716e82febb228c3e30e /src
parent31bc33331673b761ba7d6e28bbb87da6b2e6e51a (diff)
parenteaee3afe6312a04ce41daed8d380ac5e49616ed6 (diff)
downloadayatana-indicator-sound-510a01f7c97b726cd9ee46ffa30d3b0383b36146.tar.gz
ayatana-indicator-sound-510a01f7c97b726cd9ee46ffa30d3b0383b36146.tar.bz2
ayatana-indicator-sound-510a01f7c97b726cd9ee46ffa30d3b0383b36146.zip
merge from lp:~cjcurran/indicator-sound/keyboard-handling-for-natty
Diffstat (limited to 'src')
-rw-r--r--src/indicator-sound.c3
-rw-r--r--src/sound-service.c4
-rw-r--r--src/transport-widget.c43
-rw-r--r--src/transport-widget.h1
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 cbe9154..dc79221 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -80,6 +80,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))
@@ -117,6 +118,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 //////////////////////////////////////////////////////////
@@ -142,6 +146,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,
@@ -174,12 +179,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
@@ -252,7 +265,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){
@@ -285,12 +297,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 )
@@ -311,6 +338,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