aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-10-29 18:33:46 -0700
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-10-29 18:33:46 -0700
commitaaa6d3919ad7cfd3eebe24f387b52da2526edf7f (patch)
tree3456d0e5eefa0b5e55a9764d3e4ed12320c3a9e6
parent781447c5a0d82c625ddd8e6fb2ab01eae720d330 (diff)
downloadayatana-indicator-sound-aaa6d3919ad7cfd3eebe24f387b52da2526edf7f.tar.gz
ayatana-indicator-sound-aaa6d3919ad7cfd3eebe24f387b52da2526edf7f.tar.bz2
ayatana-indicator-sound-aaa6d3919ad7cfd3eebe24f387b52da2526edf7f.zip
Call Raise() when activating a player menu item
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/media-player-list.vala2
-rw-r--r--src/media-player.vala15
3 files changed, 13 insertions, 6 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 572befd..c11ec51 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -32,6 +32,7 @@ vala_add(indicator-sound-service
volume-control
media-player
media-player-list
+ mpris2-interfaces
)
vala_add(indicator-sound-service
main.vala
@@ -62,6 +63,7 @@ vala_add(indicator-sound-service
sound-menu.vala
DEPENDS
media-player
+ mpris2-interfaces
)
vala_finish(indicator-sound-service
diff --git a/src/media-player-list.vala b/src/media-player-list.vala
index 62badc2..75c7bb4 100644
--- a/src/media-player-list.vala
+++ b/src/media-player-list.vala
@@ -118,7 +118,7 @@ public class MediaPlayerList {
var player = this.insert (mpris2_root.DesktopEntry);
if (player != null)
- player.attach (name);
+ player.attach (mpris2_root, name);
}
catch (Error e) {
warning ("unable to create mpris proxy for '%s': %s", name, e.message);
diff --git a/src/media-player.vala b/src/media-player.vala
index 7e0d2a7..49fe387 100644
--- a/src/media-player.vala
+++ b/src/media-player.vala
@@ -94,9 +94,10 @@ public class MediaPlayer: Object {
*
* This method does not block. If it is successful, "is-running" will be set to %TRUE.
*/
- public void attach (string dbus_name) {
+ public void attach (MprisRoot root, string dbus_name) {
return_if_fail (this._dbus_name == null && this.proxy == null);
+ this.root = root;
this._dbus_name = dbus_name;
Bus.get_proxy.begin<MprisPlayer> (BusType.SESSION, dbus_name, "/org/mpris/MediaPlayer2",
DBusProxyFlags.GET_INVALIDATED_PROPERTIES, null, got_proxy);
@@ -125,14 +126,17 @@ public class MediaPlayer: Object {
*/
public void activate () {
try {
- this.appinfo.launch (null, null);
+ if (this.proxy == null) {
+ this.appinfo.launch (null, null);
+ this.state = "Launching";
+ }
+ else if (this.root != null && this.root.CanRaise) {
+ this.root.Raise ();
+ }
}
catch (Error e) {
warning ("unable to activate %s: %s", appinfo.get_name (), e.message);
}
-
- if (this.proxy == null)
- this.state = "Launching";
}
/**
@@ -188,6 +192,7 @@ public class MediaPlayer: Object {
MprisPlaylists ?playlists_proxy;
string _dbus_name;
bool play_when_attached = false;
+ MprisRoot root;
PlaylistDetails[] playlists = null;
void got_proxy (Object? obj, AsyncResult res) {