From 066b6a521cbda456ffb8f25ff01e1dd7d127fdd2 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 6 Sep 2010 19:30:48 +0100 Subject: events from transport bar now are sent on button release --- src/play-button.c | 12 ++++++++---- src/play-button.h | 4 ++-- src/sound-service.c | 4 ++-- src/transport-widget.c | 24 ++++++++++++------------ 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/play-button.c b/src/play-button.c index a2eaf2e..0c2a59a 100644 --- a/src/play-button.c +++ b/src/play-button.c @@ -409,11 +409,12 @@ play_button_react_to_button_press(GtkWidget* button, PlayButtonEvent command) g_return_if_fail(IS_PLAY_BUTTON(button)); PlayButtonPrivate* priv = PLAY_BUTTON_GET_PRIVATE(button); priv->current_command = command; - + cairo_t *cr; cr = gdk_cairo_create (button->window); - GList* list = g_hash_table_lookup(priv->command_coordinates, GINT_TO_POINTER(command)); + GList* list = g_hash_table_lookup(priv->command_coordinates, + GINT_TO_POINTER(priv->current_command)); cairo_rectangle(cr, GPOINTER_TO_INT(g_list_nth_data(list, 0)), GPOINTER_TO_INT(g_list_nth_data(list, 1)), @@ -426,10 +427,12 @@ play_button_react_to_button_press(GtkWidget* button, PlayButtonEvent command) void -play_button_react_to_button_release(GtkWidget* button) +play_button_react_to_button_release(GtkWidget* button, PlayButtonEvent command) { g_return_if_fail(IS_PLAY_BUTTON(button)); PlayButtonPrivate* priv = PLAY_BUTTON_GET_PRIVATE(button); + priv->current_command = command; + cairo_t *cr; cr = gdk_cairo_create (button->window); @@ -437,7 +440,7 @@ play_button_react_to_button_release(GtkWidget* button) GINT_TO_POINTER(priv->current_command)); priv->current_command = TRANSPORT_NADA; - + cairo_rectangle(cr, GPOINTER_TO_INT(g_list_nth_data(list, 0)), GPOINTER_TO_INT(g_list_nth_data(list, 1)), @@ -456,6 +459,7 @@ play_button_toggle_play_pause(GtkWidget* button, PlayButtonState update) PlayButtonPrivate* priv = PLAY_BUTTON_GET_PRIVATE(button); priv->current_state = update; g_debug("PlayButton::toggle play state : %i", priv->current_state); + gtk_widget_queue_draw (GTK_WIDGET(button)); } diff --git a/src/play-button.h b/src/play-button.h index 727a489..6bacac7 100644 --- a/src/play-button.h +++ b/src/play-button.h @@ -56,8 +56,8 @@ struct _PlayButton { GType play_button_get_type (void); void play_button_set_style(GtkWidget* button, GtkStyle* style); PlayButtonEvent determine_button_event(GtkWidget* button, GdkEventButton* event); -void play_button_react_to_button_press(GtkWidget* button, PlayButtonEvent command); -void play_button_react_to_button_release(GtkWidget* button); +void play_button_react_to_button_press(GtkWidget* button, PlayButtonEvent command); +void play_button_react_to_button_release(GtkWidget* button, PlayButtonEvent command); void play_button_toggle_play_pause(GtkWidget* button, PlayButtonState update); GtkWidget* play_button_new(); diff --git a/src/sound-service.c b/src/sound-service.c index 12f067e..42ce116 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 702b472..4e7ea9c 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -136,22 +136,12 @@ transport_widget_button_press_event (GtkWidget *menuitem, GdkEventButton *event) { g_return_val_if_fail(IS_TRANSPORT_WIDGET(menuitem), FALSE); - TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE(TRANSPORT_WIDGET(menuitem)); - - GtkWidget *parent; - - parent = gtk_widget_get_parent (GTK_WIDGET (menuitem)); - + PlayButtonEvent result = determine_button_event(priv->play_button, event); if(result != TRANSPORT_NADA){ - GValue value = {0}; - g_value_init(&value, G_TYPE_INT); - g_debug("TransportWidget::menu_press_event - going to send value %i", (int)result); - g_value_set_int(&value, (int)result); play_button_react_to_button_press(priv->play_button, result); - dbusmenu_menuitem_handle_event (priv->twin_item, "Transport state change", &value, 0); } return TRUE; } @@ -164,8 +154,17 @@ transport_widget_button_release_event (GtkWidget *menuitem, g_debug("TransportWidget::menu_release_event"); g_return_val_if_fail(IS_TRANSPORT_WIDGET(menuitem), FALSE); TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE(TRANSPORT_WIDGET(menuitem)); - play_button_react_to_button_release(priv->play_button); + PlayButtonEvent result = determine_button_event(priv->play_button, event); + + if(result != TRANSPORT_NADA){ + GValue value = {0}; + g_value_init(&value, G_TYPE_INT); + g_debug("TransportWidget::menu_press_event - going to send value %i", (int)result); + g_value_set_int(&value, (int)result); + play_button_react_to_button_release(priv->play_button, result); + dbusmenu_menuitem_handle_event (priv->twin_item, "Transport state change", &value, 0); + } return TRUE; } @@ -187,6 +186,7 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property, int update_value = g_value_get_int(value); g_debug("transport_widget_update_state - with value %i", update_value); play_button_toggle_play_pause(priv->play_button, (PlayButtonState)update_value); + } } -- cgit v1.2.3 From 03142793ea7975e1e915cad125d19c37de508b27 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 6 Sep 2010 21:14:15 +0100 Subject: highlighted odd playback status issue --- src/mpris2-controller.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index dd6a312..cf5a39e 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -96,7 +96,7 @@ public class Mpris2Controller : GLib.Object public void property_changed_cb(string interface_source, HashTable changed_properties, string[] invalid ) { - debug("properties-changed for interface %s", interface_source); + debug("properties-changed for interface %s and owner %s", interface_source, this.owner.name.down()); if(changed_properties == null || interface_source.has_prefix(this.root_interface) == false){ warning("Property-changed hash is null or this is an interface that concerns us"); return; -- cgit v1.2.3 From 71f036ce6cbd106f3754d7008303d1b108433ae2 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 7 Sep 2010 09:21:07 +0100 Subject: tidy up --- src/sound-service.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sound-service.c b/src/sound-service.c index 42ce116..12f067e 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; } -- cgit v1.2.3 From 32442108b50ade909fa9076513139d73cde577a1 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 7 Sep 2010 10:04:07 +0100 Subject: button release outside of control now acts as it should do --- src/play-button.c | 9 ++++++++- src/sound-service.c | 4 ++-- src/transport-widget.c | 5 +++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/play-button.c b/src/play-button.c index 0c2a59a..84af260 100644 --- a/src/play-button.c +++ b/src/play-button.c @@ -431,7 +431,14 @@ play_button_react_to_button_release(GtkWidget* button, PlayButtonEvent command) { g_return_if_fail(IS_PLAY_BUTTON(button)); PlayButtonPrivate* priv = PLAY_BUTTON_GET_PRIVATE(button); - priv->current_command = command; + if(priv->current_command == TRANSPORT_NADA){ + g_debug("returning from the playbutton release because my previous command was nada"); + return; + } + else if(priv->current_command != TRANSPORT_NADA && + command != TRANSPORT_NADA){ + priv->current_command = command; + } cairo_t *cr; diff --git a/src/sound-service.c b/src/sound-service.c index 12f067e..42ce116 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 4e7ea9c..979f6fd 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -162,9 +162,10 @@ transport_widget_button_release_event (GtkWidget *menuitem, g_value_init(&value, G_TYPE_INT); g_debug("TransportWidget::menu_press_event - going to send value %i", (int)result); g_value_set_int(&value, (int)result); - play_button_react_to_button_release(priv->play_button, result); dbusmenu_menuitem_handle_event (priv->twin_item, "Transport state change", &value, 0); - } + } + play_button_react_to_button_release(priv->play_button, result); + return TRUE; } -- cgit v1.2.3 From 6f82956f269c047fe0b94a188c18ceed50bc74ea Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 7 Sep 2010 10:52:23 +0100 Subject: tidy up --- src/play-button.c | 1 - src/sound-service.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/play-button.c b/src/play-button.c index 84af260..ccc23cb 100644 --- a/src/play-button.c +++ b/src/play-button.c @@ -966,7 +966,6 @@ draw (GtkWidget* button, cairo_t *cr) } - /** * play_button_new: * @returns: a new #PlayButton. diff --git a/src/sound-service.c b/src/sound-service.c index 42ce116..12f067e 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; } -- cgit v1.2.3