aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-02-21 16:47:28 -0600
committerTed Gould <ted@gould.cx>2014-02-21 16:47:28 -0600
commitb8e644e88161501bce35b6d866c58bcc147abd94 (patch)
treeadc71c84c86175fe752e668b10f7370c172ad5b2 /src
parentceab1b92d76d4cf28fecd0f1858a628ec85ff21e (diff)
downloadayatana-indicator-sound-b8e644e88161501bce35b6d866c58bcc147abd94.tar.gz
ayatana-indicator-sound-b8e644e88161501bce35b6d866c58bcc147abd94.tar.bz2
ayatana-indicator-sound-b8e644e88161501bce35b6d866c58bcc147abd94.zip
Check the timestamp as well
Diffstat (limited to 'src')
-rw-r--r--src/media-player-user.vala21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/media-player-user.vala b/src/media-player-user.vala
index ac73138..658b466 100644
--- a/src/media-player-user.vala
+++ b/src/media-player-user.vala
@@ -52,6 +52,19 @@ public abstract class MediaPlayerUser : MediaPlayer {
}
}
+ bool proxy_is_valid () {
+ if (this.proxy == null) {
+ return false;
+ }
+
+ /* More than 10 minutes old */
+ if (this.proxy.timestamp < GLib.get_monotonic_time() - 10 * 60 * 1000 * 1000) {
+ return false;
+ }
+
+ return true;
+ }
+
public override string id {
get { return username; }
}
@@ -59,7 +72,7 @@ public abstract class MediaPlayerUser : MediaPlayer {
string name_cache;
public override string name {
get {
- if (this.proxy != null) {
+ if (proxy_is_valid()) {
name_cache = this.proxy.player_name;
return name_cache;
} else {
@@ -70,7 +83,7 @@ public abstract class MediaPlayerUser : MediaPlayer {
string state_cache;
public override string state {
get {
- if (this.proxy != null) {
+ if (proxy_is_valid()) {
state_cache = this.proxy.state;
return state_cache;
} else {
@@ -82,7 +95,7 @@ public abstract class MediaPlayerUser : MediaPlayer {
Icon icon_cache;
public override Icon? icon {
get {
- if (this.proxy != null) {
+ if (proxy_is_valid()) {
icon_cache = Icon.deserialize(this.proxy.player_icon);
return icon_cache;
} else {
@@ -98,7 +111,7 @@ public abstract class MediaPlayerUser : MediaPlayer {
MediaPlayer.Track track_cache;
public override MediaPlayer.Track? current_track {
get {
- if (this.proxy != null) {
+ if (proxy_is_valid()) {
track_cache = new MediaPlayer.Track(
this.proxy.artist,
this.proxy.title,