diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-10-30 07:48:46 -0700 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-10-30 07:48:46 -0700 |
commit | 9fb9f5077869c6e30d305ec7cb21d0129567e10e (patch) | |
tree | 29e74c3aee915cc5c5956b305026abc3ee65b0c3 /src | |
parent | aaa6d3919ad7cfd3eebe24f387b52da2526edf7f (diff) | |
download | ayatana-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')
-rw-r--r-- | src/media-player.vala | 10 | ||||
-rw-r--r-- | src/service.vala | 4 |
2 files changed, 13 insertions, 1 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; } diff --git a/src/service.vala b/src/service.vala index 9a82e8b..14d4893 100644 --- a/src/service.vala +++ b/src/service.vala @@ -266,8 +266,10 @@ public class IndicatorSound.Service { bool update_player_actions () { foreach (var player in this.players) { SimpleAction? action = this.actions.lookup_action (player.id) as SimpleAction; - if (action != null) + if (action != null) { action.set_state (this.action_state_for_player (player)); + action.set_enabled (player.can_raise); + } } this.player_action_update_id = 0; |