Merge lp:~cjcurran/indicator-sound/reread-mpris-playlists into lp:~indicator-applet-developers/indicator-sound/trunk_3

Proposed by Conor Curran
Status: Merged
Merged at revision: 117
Proposed branch: lp:~cjcurran/indicator-sound/reread-mpris-playlists
Merge into: lp:~indicator-applet-developers/indicator-sound/trunk_3
Diff against target: 110 lines (+36/-22)
2 files modified
src/mpris2-controller.vala (+34/-21)
src/transport-menu-item.vala (+2/-1)
To merge this branch: bzr merge lp:~cjcurran/indicator-sound/reread-mpris-playlists
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+47401@code.launchpad.net

Description of the change

Fixes bugs attached.

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/mpris2-controller.vala'
2--- src/mpris2-controller.vala 2011-01-09 15:30:29 +0000
3+++ src/mpris2-controller.vala 2011-01-25 15:17:53 +0000
4@@ -93,6 +93,16 @@
5 if ( playlist_v != null && this.owner.use_playlists == true ){
6 this.fetch_active_playlist();
7 }
8+ Variant? playlist_count_v = changed_properties.lookup("PlaylistCount");
9+ if ( playlist_count_v != null && this.owner.use_playlists == true ){
10+ this.fetch_playlists();
11+ this.fetch_active_playlist();
12+ }
13+ Variant? playlist_orderings_v = changed_properties.lookup("Orderings");
14+ if ( playlist_orderings_v != null && this.owner.use_playlists == true ){
15+ this.fetch_playlists();
16+ this.fetch_active_playlist();
17+ }
18 }
19
20 private bool ensure_correct_playback_status(){
21@@ -107,16 +117,20 @@
22 GLib.HashTable<string, Variant?> changed_updates = this.player.Metadata;
23 Variant? artist_v = this.player.Metadata.lookup("xesam:artist");
24 if(artist_v != null){
25- string[] artists = (string[])this.player.Metadata.lookup("xesam:artist");
26- string display_artists = string.joinv(", ", artists);
27+ Variant? v_artists = this.player.Metadata.lookup("xesam:artist");
28+ debug("artists is of type %s", v_artists.get_type_string ());
29+ string display_artists;
30+ if(v_artists.get_type_string() == "s"){
31+ debug("SPOTIFY is that you ?");
32+ display_artists = v_artists.get_string();
33+ }
34+ else{
35+ string[] artists = v_artists.dup_strv();
36+ display_artists = string.joinv(", ", artists);
37+ }
38 changed_updates.replace("xesam:artist", display_artists);
39 debug("artist : %s", (string)changed_updates.lookup("xesam:artist"));
40 }
41- Variant? length_v = this.player.Metadata.lookup("mpris:length");
42- if(length_v != null){
43- int64 duration = this.player.Metadata.lookup("mpris:length").get_int64();
44- changed_updates.replace("mpris:length", duration/1000000);
45- }
46 return changed_updates;
47 }
48
49@@ -161,6 +175,19 @@
50 }
51 }
52
53+
54+ public bool connected()
55+ {
56+ return (this.player != null && this.mpris2_root != null);
57+ }
58+
59+ public void expose()
60+ {
61+ if(this.connected() == true){
62+ this.mpris2_root.Raise.begin();
63+ }
64+ }
65+
66 public void fetch_playlists()
67 {
68 PlaylistDetails[] current_playlists = this.playlists.GetPlaylists(0,
69@@ -176,7 +203,6 @@
70 warning(" Playlists are on but its returning no current_playlists" );
71 this.owner.use_playlists = false;
72 }
73- return;
74 }
75
76 private void fetch_active_playlist()
77@@ -188,19 +214,6 @@
78 playlists_item.update_active_playlist ( this.playlists.ActivePlaylist.details );
79 }
80
81-
82- public bool connected()
83- {
84- return (this.player != null && this.mpris2_root != null);
85- }
86-
87- public void expose()
88- {
89- if(this.connected() == true){
90- this.mpris2_root.Raise.begin();
91- }
92- }
93-
94 public void activate_playlist (ObjectPath path)
95 {
96 try{
97
98=== modified file 'src/transport-menu-item.vala'
99--- src/transport-menu-item.vala 2011-01-11 15:13:20 +0000
100+++ src/transport-menu-item.vala 2011-01-25 15:17:53 +0000
101@@ -44,7 +44,8 @@
102 {
103 debug("UPDATING THE TRANSPORT DBUSMENUITEM PLAY STATE WITH VALUE %i",
104 (int)update);
105- this.property_set_int(MENUITEM_PLAY_STATE, update);
106+ int temp = (int)update;
107+ this.property_set_int(MENUITEM_PLAY_STATE, temp);
108 }
109
110 public override void handle_event(string name,

Subscribers

People subscribed via source and target branches