aboutsummaryrefslogtreecommitdiff
path: root/src/media-player.vala
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-10-30 07:48:46 -0700
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-10-30 07:48:46 -0700
commit9fb9f5077869c6e30d305ec7cb21d0129567e10e (patch)
tree29e74c3aee915cc5c5956b305026abc3ee65b0c3 /src/media-player.vala
parentaaa6d3919ad7cfd3eebe24f387b52da2526edf7f (diff)
downloadayatana-indicator-sound-9fb9f5077869c6e30d305ec7cb21d0129567e10e.tar.gz
ayatana-indicator-sound-9fb9f5077869c6e30d305ec7cb21d0129567e10e.tar.bz2
ayatana-indicator-sound-9fb9f5077869c6e30d305ec7cb21d0129567e10e.zip
Make player menu item insensitive when player can't be raised
Diffstat (limited to 'src/media-player.vala')
-rw-r--r--src/media-player.vala10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/media-player.vala b/src/media-player.vala
index 49fe387..bdcea35 100644
--- a/src/media-player.vala
+++ b/src/media-player.vala
@@ -84,6 +84,12 @@ public class MediaPlayer: Object {
get; set;
}
+ public bool can_raise {
+ get {
+ return this.root != null ? this.root.CanRaise : true;
+ }
+ }
+
public signal void playlists_changed ();
/**
@@ -98,6 +104,8 @@ public class MediaPlayer: Object {
return_if_fail (this._dbus_name == null && this.proxy == null);
this.root = root;
+ this.notify_property ("can-raise");
+
this._dbus_name = dbus_name;
Bus.get_proxy.begin<MprisPlayer> (BusType.SESSION, dbus_name, "/org/mpris/MediaPlayer2",
DBusProxyFlags.GET_INVALIDATED_PROPERTIES, null, got_proxy);
@@ -111,9 +119,11 @@ public class MediaPlayer: Object {
* See also: attach()
*/
public void detach () {
+ this.root = null;
this.proxy = null;
this._dbus_name = null;
this.notify_property ("is-running");
+ this.notify_property ("can-raise");
this.state = "Paused";
this.current_track = null;
}