Merge lp:~cjcurran/indicator-sound/title-changing into lp:~indicator-applet-developers/indicator-sound/trunk_3

Proposed by Conor Curran
Status: Merged
Merged at revision: 124
Proposed branch: lp:~cjcurran/indicator-sound/title-changing
Merge into: lp:~indicator-applet-developers/indicator-sound/trunk_3
Diff against target: 104 lines (+30/-10)
3 files modified
src/mpris2-controller.vala (+15/-5)
src/sound-service-dbus.c (+3/-3)
src/title-menu-item.vala (+12/-2)
To merge this branch: bzr merge lp:~cjcurran/indicator-sound/title-changing
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+48171@code.launchpad.net

This proposal supersedes a proposal from 2011-02-01.

Description of the change

Allows players to dynamically change the title on the player item.
This is a requirement for ubuntu one streaming client

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote : Posted in a previous version of this proposal

65 + public void alter_label (string new_title)
66 + {
67 + if (new_title != null) return;
68 + this.property_set(MENUITEM_NAME, new_title);
69 + }

This method is a no-op unless new_title == NULL, in which case it sets the MENUITEM_NAME property to null... That doesn't look right?

review: Needs Fixing
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

I'm a happy camper now :-)

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-27 23:08:08 +0000
3+++ src/mpris2-controller.vala 2011-02-01 14:47:02 +0000
4@@ -103,6 +103,11 @@
5 this.fetch_playlists.begin();
6 this.fetch_active_playlist();
7 }
8+ Variant? identity_v = changed_properties.lookup("Identity");
9+ if (identity_v != null){
10+ TitleMenuitem title = this.owner.custom_items[PlayerController.widget_order.TITLE] as TitleMenuitem;
11+ title.alter_label (this.mpris2_root.Identity);
12+ }
13 }
14
15 private bool ensure_correct_playback_status(){
16@@ -144,15 +149,20 @@
17 public void initial_update()
18 {
19 TransportMenuitem.state update;
20+
21 if(this.player.PlaybackStatus == null){
22 update = TransportMenuitem.state.PAUSED;
23 }
24-
25- update = determine_play_state(null);
26-
27- (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(TransportMenuitem.state.PAUSED);
28+ else{
29+ update = determine_play_state (this.player.PlaybackStatus);
30+ }
31+ if (this.mpris2_root.Identity != null){
32+ TitleMenuitem title = this.owner.custom_items[PlayerController.widget_order.TITLE] as TitleMenuitem;
33+ title.alter_label (this.mpris2_root.Identity);
34+ }
35+ (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state (update);
36 GLib.HashTable<string, Value?>? cleaned_metadata = this.clean_metadata();
37- this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata,
38+ this.owner.custom_items[PlayerController.widget_order.METADATA].update (cleaned_metadata,
39 MetadataMenuitem.attributes_format());
40
41 if ( this.owner.use_playlists == true ){
42
43=== modified file 'src/sound-service-dbus.c'
44--- src/sound-service-dbus.c 2011-02-01 15:50:29 +0000
45+++ src/sound-service-dbus.c 2011-02-01 14:47:02 +0000
46@@ -452,7 +452,7 @@
47 g_debug ("we have this already blacklisted, no need to do anything");
48 g_variant_builder_clear (&builder);
49 g_object_unref (our_settings);
50- g_object_unref (the_black_list);
51+ g_variant_unref (the_black_list);
52 return result;
53 }
54 }
55@@ -475,7 +475,7 @@
56 g_debug ("it was not blacklisted ?, no need to do anything");
57 g_variant_builder_clear (&builder);
58 g_object_unref (our_settings);
59- g_object_unref (the_black_list);
60+ g_variant_unref (the_black_list);
61 return result;
62 }
63
64@@ -497,7 +497,7 @@
65 value);
66
67 g_object_unref (our_settings);
68- g_object_unref (the_black_list);
69+ g_variant_unref (the_black_list);
70
71 return result;
72 }
73
74=== modified file 'src/title-menu-item.vala'
75--- src/title-menu-item.vala 2011-01-10 12:57:35 +0000
76+++ src/title-menu-item.vala 2011-02-01 14:47:02 +0000
77@@ -26,8 +26,12 @@
78 public TitleMenuitem(PlayerController parent)
79 {
80 Object(item_type: MENUITEM_TYPE, owner: parent);
81- this.property_set(MENUITEM_NAME, parent.app_info.get_name());
82- this.property_set(MENUITEM_ICON, parent.icon_name);
83+ }
84+
85+ construct
86+ {
87+ this.property_set(MENUITEM_NAME, this.owner.app_info.get_name());
88+ this.property_set(MENUITEM_ICON, this.owner.icon_name);
89 this.property_set_bool(MENUITEM_RUNNING, false);
90 }
91
92@@ -42,6 +46,12 @@
93 }
94 }
95
96+ public void alter_label (string new_title)
97+ {
98+ if (new_title == null) return;
99+ this.property_set(MENUITEM_NAME, new_title);
100+ }
101+
102 public void toggle_active_triangle(bool update)
103 {
104 this.property_set_bool(MENUITEM_RUNNING, update);

Subscribers

People subscribed via source and target branches