Merge lp:~ted/indicator-sound/greeter-control into lp:indicator-sound/14.04

Proposed by Ted Gould
Status: Merged
Approved by: Charles Kerr
Approved revision: 463
Merged at revision: 434
Proposed branch: lp:~ted/indicator-sound/greeter-control
Merge into: lp:indicator-sound/14.04
Prerequisite: lp:~ted/indicator-sound/account-service-player
Diff against target: 253 lines (+142/-3)
5 files modified
debian/control (+2/-0)
src/CMakeLists.txt (+5/-0)
src/accounts-service-user.vala (+42/-0)
src/greeter-broadcast.vala (+34/-0)
src/media-player-user.vala (+59/-3)
To merge this branch: bzr merge lp:~ted/indicator-sound/greeter-control
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+209338@code.launchpad.net

Commit message

Allow the phone greeter player to control the running player in the session.

Description of the change

Puts both the sender and the listener of the greeter broadcast into both sides of the indicator-sound world. One emits the event through the reflector and the other receives it. Needs this branch to work:

https://code.launchpad.net/~ted/unity-greeter-session-broadcast/sound-control/+merge/208894

To post a comment you must log in.
459. By Ted Gould

Try to get session broadcast if we can

460. By Ted Gould

Grab accounts service too

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

 * Is Recommends sufficient for accountsservice? Surely it's a Depends now...?

 * In GreeterBroadcast, RequestApplicationStart(), RequestHomeShown(), StartApplication(),
   ShowHome() appear to be unused. Is there another branch waiting to be stacked on top
   of this one? Otherwise, these unused methods/signals should be removed

 * In accounts-service-user, probably ought to Warn() if username != g_get_user_name()
   instead of returning silently... if that argument's wrong, something's gone wrong
   in MediaPlayerListGreeter

461. By Ted Gould

Don't build proxy for unused functions

Revision history for this message
Ted Gould (ted) wrote :

 * Is Recommends sufficient for accountsservice? Surely it's a Depends now...?

I left it as a recommends just because we wouldn't *die* without it. I'd go either way, I figured the only thing we *needed* was the lib which gets pulled in by linking.

* In GreeterBroadcast, RequestApplicationStart(), RequestHomeShown(), StartApplication(),
   ShowHome() appear to be unused. Is there another branch waiting to be stacked on top
   of this one? Otherwise, these unused methods/signals should be removed

Fixed. r461. I commented them in case someone wanted to steal this Vala code in the future.

 * In accounts-service-user, probably ought to Warn() if username != g_get_user_name()
   instead of returning silently... if that argument's wrong, something's gone wrong
   in MediaPlayerListGreeter

Those are the signals that come off the system bus, so those events can be targeted at another user session that is also running at the same time. So it can be normal that we'd get ones that aren't for us.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
462. By Ted Gould

Sync to latest account-service-player

Revision history for this message
Ted Gould (ted) wrote :

Failing because it needs a newer dbus-test-runner, updated the dep.

463. By Ted Gould

Merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ted Gould (ted) wrote :

Jenkins failing because it needs to get the dbus-test-runner branch to land at the same time.

Revision history for this message
Charles Kerr (charlesk) :
review: Approve
464. By Ted Gould

Update to trunk and export updates

465. By Ted Gould

Updating to latest export

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2014-03-21 21:36:35 +0000
+++ debian/control 2014-03-21 21:36:35 +0000
@@ -39,6 +39,8 @@
39 pulseaudio,39 pulseaudio,
40 gsettings-ubuntu-schemas (>= 0.0.1+14.04.20140224),40 gsettings-ubuntu-schemas (>= 0.0.1+14.04.20140224),
41Recommends: unity-control-center | gnome-control-center | ubuntu-system-settings | pavucontrol,41Recommends: unity-control-center | gnome-control-center | ubuntu-system-settings | pavucontrol,
42 unity-greeter-session-broadcast,
43 accountsservice,
42Description: System sound indicator.44Description: System sound indicator.
43 System sound indicator which provides easy control of the PulseAudio sound 45 System sound indicator which provides easy control of the PulseAudio sound
44 daemon.46 daemon.
4547
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2014-03-21 21:36:35 +0000
+++ src/CMakeLists.txt 2014-03-21 21:36:35 +0000
@@ -64,6 +64,7 @@
64 DEPENDS64 DEPENDS
65 media-player65 media-player
66 accounts-service-sound-settings66 accounts-service-sound-settings
67 greeter-broadcast
67)68)
68vala_add(indicator-sound-service69vala_add(indicator-sound-service
69 media-player-list.vala70 media-player-list.vala
@@ -102,10 +103,14 @@
102 media-player103 media-player
103 mpris2-interfaces104 mpris2-interfaces
104 accounts-service-sound-settings105 accounts-service-sound-settings
106 greeter-broadcast
105)107)
106vala_add(indicator-sound-service108vala_add(indicator-sound-service
107 accounts-service-sound-settings.vala109 accounts-service-sound-settings.vala
108)110)
111vala_add(indicator-sound-service
112 greeter-broadcast.vala
113)
109114
110vala_finish(indicator-sound-service115vala_finish(indicator-sound-service
111 SOURCES116 SOURCES
112117
=== modified file 'src/accounts-service-user.vala'
--- src/accounts-service-user.vala 2014-03-21 21:36:35 +0000
+++ src/accounts-service-user.vala 2014-03-21 21:36:35 +0000
@@ -23,6 +23,7 @@
23 AccountsServiceSoundSettings? proxy = null;23 AccountsServiceSoundSettings? proxy = null;
24 uint timer = 0;24 uint timer = 0;
25 MediaPlayer? _player = null;25 MediaPlayer? _player = null;
26 GreeterBroadcast? greeter = null;
2627
27 public MediaPlayer? player {28 public MediaPlayer? player {
28 set {29 set {
@@ -95,6 +96,14 @@
95 user = accounts_manager.get_user(GLib.Environment.get_user_name());96 user = accounts_manager.get_user(GLib.Environment.get_user_name());
96 user.notify["is-loaded"].connect(() => user_loaded_changed());97 user.notify["is-loaded"].connect(() => user_loaded_changed());
97 user_loaded_changed();98 user_loaded_changed();
99
100 Bus.get_proxy.begin<GreeterBroadcast> (
101 BusType.SYSTEM,
102 "com.canonical.Unity.Greeter.Broadcast",
103 "/com/canonical/Unity/Greeter/Broadcast",
104 DBusProxyFlags.NONE,
105 null,
106 greeter_proxy_new);
98 }107 }
99108
100 void user_loaded_changed () {109 void user_loaded_changed () {
@@ -132,4 +141,37 @@
132 warning("Unable to get proxy to user sound settings: %s", e.message);141 warning("Unable to get proxy to user sound settings: %s", e.message);
133 }142 }
134 }143 }
144
145 void greeter_proxy_new (GLib.Object? obj, AsyncResult res) {
146 try {
147 this.greeter = Bus.get_proxy.end (res);
148
149 this.greeter.SoundPlayPause.connect((username) => {
150 if (username != GLib.Environment.get_user_name())
151 return;
152 if (this._player == null)
153 return;
154 this._player.play_pause();
155 });
156
157 this.greeter.SoundNext.connect((username) => {
158 if (username != GLib.Environment.get_user_name())
159 return;
160 if (this._player == null)
161 return;
162 this._player.next();
163 });
164
165 this.greeter.SoundPrev.connect((username) => {
166 if (username != GLib.Environment.get_user_name())
167 return;
168 if (this._player == null)
169 return;
170 this._player.previous();
171 });
172 } catch (Error e) {
173 this.greeter = null;
174 warning("Unable to get greeter proxy: %s", e.message);
175 }
176 }
135}177}
136178
=== added file 'src/greeter-broadcast.vala'
--- src/greeter-broadcast.vala 1970-01-01 00:00:00 +0000
+++ src/greeter-broadcast.vala 2014-03-21 21:36:35 +0000
@@ -0,0 +1,34 @@
1/*
2 * Copyright 2014 © Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Ted Gould <ted@canonical.com>
18 */
19
20[DBus (name = "com.canonical.Unity.Greeter.Broadcast")]
21public interface GreeterBroadcast : Object {
22 // methods
23 // unused public abstract async void RequestApplicationStart(string name, string appid) throws IOError;
24 // unused public abstract async void RequestHomeShown(string name) throws IOError;
25 public abstract async void RequestSoundPlayPause(string name) throws IOError;
26 public abstract async void RequestSoundNext(string name) throws IOError;
27 public abstract async void RequestSoundPrev(string name) throws IOError;
28 // signals
29 // unused public signal void StartApplication(string username, string appid);
30 // unused public signal void ShowHome(string username);
31 public signal void SoundPlayPause(string username);
32 public signal void SoundNext(string username);
33 public signal void SoundPrev(string username);
34}
035
=== modified file 'src/media-player-user.vala'
--- src/media-player-user.vala 2014-03-21 21:36:35 +0000
+++ src/media-player-user.vala 2014-03-21 21:36:35 +0000
@@ -22,6 +22,7 @@
22 string username;22 string username;
23 Act.User? actuser = null;23 Act.User? actuser = null;
24 AccountsServiceSoundSettings? proxy = null;24 AccountsServiceSoundSettings? proxy = null;
25 GreeterBroadcast? greeter = null;
2526
26 HashTable<string, bool> properties_queued = new HashTable<string, bool>(str_hash, str_equal);27 HashTable<string, bool> properties_queued = new HashTable<string, bool>(str_hash, str_equal);
27 uint properties_timeout = 0;28 uint properties_timeout = 0;
@@ -45,6 +46,14 @@
45 null,46 null,
46 new_proxy);47 new_proxy);
47 });48 });
49
50 Bus.get_proxy.begin<GreeterBroadcast> (
51 BusType.SYSTEM,
52 "com.canonical.Unity.Greeter.Broadcast",
53 "/com/canonical/Unity/Greeter/Broadcast",
54 DBusProxyFlags.NONE,
55 null,
56 greeter_proxy_new);
48 }57 }
4958
50 ~MediaPlayerUser () {59 ~MediaPlayerUser () {
@@ -152,6 +161,7 @@
152 get {161 get {
153 if (proxy_is_valid()) {162 if (proxy_is_valid()) {
154 name_cache = this.proxy.player_name;163 name_cache = this.proxy.player_name;
164 debug("Player Name: %s", name_cache);
155 return name_cache;165 return name_cache;
156 } else {166 } else {
157 return "";167 return "";
@@ -163,6 +173,7 @@
163 get {173 get {
164 if (proxy_is_valid()) {174 if (proxy_is_valid()) {
165 state_cache = this.proxy.state;175 state_cache = this.proxy.state;
176 debug("State: %s", state_cache);
166 return state_cache;177 return state_cache;
167 } else {178 } else {
168 return "";179 return "";
@@ -209,18 +220,63 @@
209 set { }220 set { }
210 }221 }
211222
223 void greeter_proxy_new (GLib.Object? obj, AsyncResult res) {
224 try {
225 this.greeter = Bus.get_proxy.end (res);
226 } catch (Error e) {
227 this.greeter = null;
228 warning("Unable to get greeter proxy: %s", e.message);
229 }
230 }
231
212 /* Control functions through unity-greeter-session-broadcast */232 /* Control functions through unity-greeter-session-broadcast */
213 public override void activate () {233 public override void activate () {
214 /* TODO: */234 /* TODO: */
215 }235 }
216 public override void play_pause () {236 public override void play_pause () {
217 /* TODO: */237 debug("Play Pause for user: %s", this.username);
238
239 if (this.greeter != null) {
240 this.greeter.RequestSoundPlayPause.begin(this.username, (obj, res) => {
241 try {
242 (obj as GreeterBroadcast).RequestSoundPlayPause.end(res);
243 } catch (Error e) {
244 warning("Unable to send play pause: %s", e.message);
245 }
246 });
247 } else {
248 warning("No unity-greeter-session-broadcast to send play-pause");
249 }
218 }250 }
219 public override void next () {251 public override void next () {
220 /* TODO: */252 debug("Next for user: %s", this.username);
253
254 if (this.greeter != null) {
255 this.greeter.RequestSoundNext.begin(this.username, (obj, res) => {
256 try {
257 (obj as GreeterBroadcast).RequestSoundNext.end(res);
258 } catch (Error e) {
259 warning("Unable to send next: %s", e.message);
260 }
261 });
262 } else {
263 warning("No unity-greeter-session-broadcast to send next");
264 }
221 }265 }
222 public override void previous () {266 public override void previous () {
223 /* TODO: */267 debug("Previous for user: %s", this.username);
268
269 if (this.greeter != null) {
270 this.greeter.RequestSoundPrev.begin(this.username, (obj, res) => {
271 try {
272 (obj as GreeterBroadcast).RequestSoundPrev.end(res);
273 } catch (Error e) {
274 warning("Unable to send previous: %s", e.message);
275 }
276 });
277 } else {
278 warning("No unity-greeter-session-broadcast to send previous");
279 }
224 }280 }
225281
226 /* Play list functions are all null as we don't support the282 /* Play list functions are all null as we don't support the

Subscribers

People subscribed via source and target branches