From a33f50636cea5d6c1972d1772a59cbb4a0c951b5 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 26 Oct 2010 17:03:20 -0400 Subject: initial transport state fixed --- src/mpris2-controller.vala | 6 +++--- src/player-controller.vala | 5 ++--- src/sound-service.c | 4 ++-- src/transport-menu-item.vala | 2 ++ src/transport-widget.c | 8 ++++++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index f355d28..f440c13 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -84,7 +84,7 @@ public class Mpris2Controller : GLib.Object this.properties_interface = (FreeDesktopProperties) connection.get_object("org.freedesktop.Properties.PropertiesChanged", "/org/mpris/MediaPlayer2"); this.properties_interface.PropertiesChanged += property_changed_cb; - + } catch (DBus.Error e) { error("Problems connecting to the session bus - %s", e.message); } @@ -150,8 +150,8 @@ public class Mpris2Controller : GLib.Object } else{ update = determine_play_state(this.player.PlaybackStatus); - } - (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(update); + } + (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(update); GLib.HashTable cleaned_metadata = this.clean_metadata(); this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata, MetadataMenuitem.attributes_format()); diff --git a/src/player-controller.vala b/src/player-controller.vala index ad8e989..f9cbe71 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -178,9 +178,8 @@ public class PlayerController : GLib.Object if(this.mpris_bridge.connected() == true){ this.update_state(state.CONNECTED); TitleMenuitem title = this.custom_items[widget_order.TITLE] as TitleMenuitem; - title.toggle_active_triangle(true); - TransportMenuitem transport = this.custom_items[widget_order.TRANSPORT] as TransportMenuitem; - transport.change_play_state(TransportMenuitem.state.PAUSED); + title.toggle_active_triangle(true); + this.mpris_bridge.initial_update(); } else{ this.update_state(state.DISCONNECTED); diff --git a/src/sound-service.c b/src/sound-service.c index f19379d..51f5f37 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-menu-item.vala b/src/transport-menu-item.vala index 7faadb5..839abf0 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -42,6 +42,8 @@ public class TransportMenuitem : PlayerItem public void change_play_state(state update) { + debug("UPDATING THE TRANSPORT DBUSMENUITEM PLAY STATE WITH VALUE %i", + (int)update); this.property_set_int(MENUITEM_PLAY_STATE, update); } diff --git a/src/transport-widget.c b/src/transport-widget.c index e7f0b4d..c16e791 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -1272,6 +1272,11 @@ transport_widget_set_twin_item(TransportWidget* self, priv->twin_item = twin_item; g_signal_connect(G_OBJECT(priv->twin_item), "property-changed", G_CALLBACK(transport_widget_property_update), self); + gint initial_state = dbusmenu_menuitem_property_get_int( twin_item, + DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE ); + g_debug("TRANSPORT WIDGET - INITIAL UPDATE = %i", initial_state); + transport_widget_toggle_play_pause( self, + (TransportWidgetState)initial_state); } /** @@ -1290,8 +1295,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); - transport_widget_toggle_play_pause(bar, - (TransportWidgetState)update_value); + transport_widget_toggle_play_pause(bar, (TransportWidgetState)update_value); } } -- cgit v1.2.3