From 6974a81bd969f97fb685ea021af4d1406fa13679 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 21 Feb 2014 12:11:02 -0600 Subject: Make sure to timestamp our updates --- src/accounts-service-user.vala | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala index 19ca774..2062dc8 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;} @@ -47,7 +48,9 @@ public class AccountsServiceUser : Object { 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"); -- cgit v1.2.3 From b8c9c3690d44e20e5cf2fb1322644d1bfdcf9084 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 21 Feb 2014 12:19:12 -0600 Subject: Keep our timestamp up-to-date if we have a player --- src/accounts-service-user.vala | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala index 2062dc8..47189a5 100644 --- a/src/accounts-service-user.vala +++ b/src/accounts-service-user.vala @@ -35,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 { @@ -45,6 +46,12 @@ 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 = ""; @@ -73,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 { -- cgit v1.2.3