aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-02-21 13:05:14 -0600
committerTed Gould <ted@gould.cx>2014-02-21 13:05:14 -0600
commitacce82e25c48da98b5e298a70aa119b3f9e8a1f9 (patch)
treefeb3589509fc2864038078f8525e9ee29e0c7151 /src
parent0b76536b27f57db75a101e8ce7e3f75b7cddf57c (diff)
parentbc01d6ceef3dbc5119a0ac7b2fba1583f62c3d48 (diff)
downloadayatana-indicator-sound-acce82e25c48da98b5e298a70aa119b3f9e8a1f9.tar.gz
ayatana-indicator-sound-acce82e25c48da98b5e298a70aa119b3f9e8a1f9.tar.bz2
ayatana-indicator-sound-acce82e25c48da98b5e298a70aa119b3f9e8a1f9.zip
Grabbing the timestamp
Diffstat (limited to 'src')
-rw-r--r--src/accounts-service-user.vala15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala
index 19ca774..47189a5 100644
--- a/src/accounts-service-user.vala
+++ b/src/accounts-service-user.vala
@@ -20,6 +20,7 @@
[DBus (name = "com.canonical.indicator.sound.AccountsService")]
public interface AccountsServiceSoundSettings : Object {
// properties
+ public abstract uint64 timestamp {owned get; set;}
public abstract string player_name {owned get; set;}
public abstract Variant player_icon {owned get; set;}
public abstract bool running {owned get; set;}
@@ -34,6 +35,7 @@ public class AccountsServiceUser : Object {
Act.UserManager accounts_manager = Act.UserManager.get_default();
Act.User? user = null;
AccountsServiceSoundSettings? proxy = null;
+ uint timer = 0;
MediaPlayer? _player = null;
public MediaPlayer? player {
@@ -44,10 +46,18 @@ public class AccountsServiceUser : Object {
if (this.proxy == null)
return;
+ /* Always reset the timer */
+ if (this.timer != 0) {
+ GLib.Source.remove(this.timer);
+ this.timer = 0;
+ }
+
if (this._player == null) {
/* Clear it */
this.proxy.player_name = "";
+ this.proxy.timestamp = 0;
} else {
+ this.proxy.timestamp = GLib.get_monotonic_time();
this.proxy.player_name = this._player.name;
if (this._player.icon == null) {
var icon = new ThemedIcon.with_default_fallbacks ("application-default-icon");
@@ -70,6 +80,11 @@ public class AccountsServiceUser : Object {
this.proxy.album = "";
this.proxy.art_url = "";
}
+
+ this.timer = GLib.Timeout.add_seconds(5 * 60, () => {
+ this.proxy.timestamp = GLib.get_monotonic_time();
+ return true;
+ });
}
}
get {