From 89a949038a591fae3b55b2a7865a5d93057accf8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 12 Feb 2014 16:17:32 -0600 Subject: Need the accounts service GIR file --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index 06acb09..eb0dad6 100644 --- a/debian/control +++ b/debian/control @@ -8,6 +8,7 @@ Build-Depends: debhelper (>= 9.0), dbus, dbus-test-runner, dh-translations, + gir1.2-accountsservice-1.0, gnome-common, autotools-dev, valac (>= 0.20), -- cgit v1.2.3 From 3c019c7c7593ed3c7f1050b1499c53f590cc0e5e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 12 Feb 2014 17:03:33 -0600 Subject: Would have thought that was implied --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index eb0dad6..f9b535a 100644 --- a/debian/control +++ b/debian/control @@ -14,6 +14,7 @@ Build-Depends: debhelper (>= 9.0), valac (>= 0.20), libaccountsservice-dev, libdbustest1-dev, + libgirepository1.0-dev, libglib2.0-dev (>= 2.22.3), libgtest-dev, liburl-dispatcher1-dev, -- cgit v1.2.3 From 10757562302a8b757d10d3106513e440914a0a84 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 13 Feb 2014 09:58:21 -0600 Subject: The mocker of choice --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index f9b535a..84d3727 100644 --- a/debian/control +++ b/debian/control @@ -23,6 +23,7 @@ Build-Depends: debhelper (>= 9.0), libnotify-dev, libgee-dev, libxml2-dev, + python3-dbusmock, Standards-Version: 3.9.4 Homepage: https://launchpad.net/indicator-sound # If you aren't a member of ~indicator-applet-developers but need to upload -- cgit v1.2.3 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 --- data/com.canonical.indicator.sound.AccountsService.xml | 3 +++ src/accounts-service-user.vala | 3 +++ 2 files changed, 6 insertions(+) diff --git a/data/com.canonical.indicator.sound.AccountsService.xml b/data/com.canonical.indicator.sound.AccountsService.xml index 1651a43..fb7e96f 100644 --- a/data/com.canonical.indicator.sound.AccountsService.xml +++ b/data/com.canonical.indicator.sound.AccountsService.xml @@ -12,6 +12,9 @@ + + + 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(+) 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 From bc01d6ceef3dbc5119a0ac7b2fba1583f62c3d48 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 21 Feb 2014 13:00:34 -0600 Subject: Adding the timeout to the mock --- tests/accounts-service-user.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/accounts-service-user.cc b/tests/accounts-service-user.cc index 65806e3..a52b3a0 100644 --- a/tests/accounts-service-user.cc +++ b/tests/accounts-service-user.cc @@ -67,6 +67,9 @@ class AccountsServiceUserTest : public ::testing::Test g_variant_new_string(g_get_user_name()), NULL); DbusTestDbusMockObject * soundobj = dbus_test_dbus_mock_get_object(mock, "/user", "com.canonical.indicator.sound.AccountsService", NULL); + dbus_test_dbus_mock_object_add_property(mock, soundobj, + "Timeout", G_VARIANT_TYPE_UINT64, + g_variant_new_uint64(0), NULL); dbus_test_dbus_mock_object_add_property(mock, soundobj, "PlayerName", G_VARIANT_TYPE_STRING, g_variant_new_string(""), NULL); -- cgit v1.2.3