From 329fda69862c649131c22fbac7e410c2af3603ae Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 25 Jan 2011 10:30:58 -0600 Subject: --- 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 98f1881..defcb94 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -40,8 +40,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) { if (mainloop != NULL) { g_debug("Service shutdown !"); - close_pulse_activites(); - g_main_loop_quit(mainloop); + //close_pulse_activites(); + //g_main_loop_quit(mainloop); } return; } -- cgit v1.2.3 From d45fd344a30bc917c45aa07458e8961ba3018f69 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 25 Jan 2011 14:55:25 -0600 Subject: spotify crasher fixed --- src/mpris2-controller.vala | 62 ++++++++++++++++++++++++++++---------------- src/sound-service.c | 4 +-- src/transport-menu-item.vala | 3 ++- 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index fc61c12..1c9258c 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -93,6 +93,16 @@ public class Mpris2Controller : GLib.Object if ( playlist_v != null && this.owner.use_playlists == true ){ this.fetch_active_playlist(); } + Variant? playlist_count_v = changed_properties.lookup("PlaylistCount"); + if ( playlist_count_v != null && this.owner.use_playlists == true ){ + this.fetch_playlists(); + this.fetch_active_playlist(); + } + Variant? playlist_orderings_v = changed_properties.lookup("Orderings"); + if ( playlist_orderings_v != null && this.owner.use_playlists == true ){ + this.fetch_playlists(); + this.fetch_active_playlist(); + } } private bool ensure_correct_playback_status(){ @@ -107,16 +117,21 @@ public class Mpris2Controller : GLib.Object GLib.HashTable changed_updates = this.player.Metadata; Variant? artist_v = this.player.Metadata.lookup("xesam:artist"); if(artist_v != null){ - string[] artists = (string[])this.player.Metadata.lookup("xesam:artist"); - string display_artists = string.joinv(", ", artists); + Variant? v_artists = this.player.Metadata.lookup("xesam:artist"); + debug("artists is of type %s", v_artists.get_type_string ()); + string display_artists; + if(v_artists.get_type_string() == "s"){ + debug("SPOTIFY YOU BASTARD"); + display_artists = v_artists.get_string(); + } + else{ + debug ("conforms with the spec" ); + string[] artists = v_artists.dup_strv(); + display_artists = string.joinv(", ", artists); + } changed_updates.replace("xesam:artist", display_artists); debug("artist : %s", (string)changed_updates.lookup("xesam:artist")); } - Variant? length_v = this.player.Metadata.lookup("mpris:length"); - if(length_v != null){ - int64 duration = this.player.Metadata.lookup("mpris:length").get_int64(); - changed_updates.replace("mpris:length", duration/1000000); - } return changed_updates; } @@ -161,7 +176,20 @@ public class Mpris2Controller : GLib.Object } } - public void fetch_playlists() + + public bool connected() + { + return (this.player != null && this.mpris2_root != null); + } + + public void expose() + { + if(this.connected() == true){ + this.mpris2_root.Raise.begin(); + } + } + + public bool fetch_playlists() { PlaylistDetails[] current_playlists = this.playlists.GetPlaylists(0, 10, @@ -176,29 +204,17 @@ public class Mpris2Controller : GLib.Object warning(" Playlists are on but its returning no current_playlists" ); this.owner.use_playlists = false; } - return; + return false; } - private void fetch_active_playlist() + private bool fetch_active_playlist() { if (this.playlists.ActivePlaylist.valid == false){ debug("We don't have an active playlist"); } PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem; playlists_item.update_active_playlist ( this.playlists.ActivePlaylist.details ); - } - - - public bool connected() - { - return (this.player != null && this.mpris2_root != null); - } - - public void expose() - { - if(this.connected() == true){ - this.mpris2_root.Raise.begin(); - } + return false; } public void activate_playlist (ObjectPath path) diff --git a/src/sound-service.c b/src/sound-service.c index defcb94..98f1881 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -40,8 +40,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) { if (mainloop != NULL) { g_debug("Service shutdown !"); - //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 e93f0bb..b8f55b5 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -44,7 +44,8 @@ public class TransportMenuitem : PlayerItem { debug("UPDATING THE TRANSPORT DBUSMENUITEM PLAY STATE WITH VALUE %i", (int)update); - this.property_set_int(MENUITEM_PLAY_STATE, update); + int temp = (int)update; + this.property_set_int(MENUITEM_PLAY_STATE, temp); } public override void handle_event(string name, -- cgit v1.2.3 From f19af83dd99f095ad5ebe317000ac5bf2031a038 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 25 Jan 2011 15:14:22 -0600 Subject: tidy up --- src/mpris2-controller.vala | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 1c9258c..a7b3de1 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -121,12 +121,11 @@ public class Mpris2Controller : GLib.Object debug("artists is of type %s", v_artists.get_type_string ()); string display_artists; if(v_artists.get_type_string() == "s"){ - debug("SPOTIFY YOU BASTARD"); + debug("SPOTIFY is that you ?"); display_artists = v_artists.get_string(); } else{ - debug ("conforms with the spec" ); - string[] artists = v_artists.dup_strv(); + string[] artists = v_artists.dup_strv(); display_artists = string.joinv(", ", artists); } changed_updates.replace("xesam:artist", display_artists); @@ -189,7 +188,7 @@ public class Mpris2Controller : GLib.Object } } - public bool fetch_playlists() + public void fetch_playlists() { PlaylistDetails[] current_playlists = this.playlists.GetPlaylists(0, 10, @@ -204,17 +203,15 @@ public class Mpris2Controller : GLib.Object warning(" Playlists are on but its returning no current_playlists" ); this.owner.use_playlists = false; } - return false; } - private bool fetch_active_playlist() + private void fetch_active_playlist() { if (this.playlists.ActivePlaylist.valid == false){ debug("We don't have an active playlist"); } PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem; playlists_item.update_active_playlist ( this.playlists.ActivePlaylist.details ); - return false; } public void activate_playlist (ObjectPath path) -- cgit v1.2.3