aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/accounts-service-user.vala39
-rw-r--r--src/service.vala33
-rw-r--r--src/volume-control.vala1
3 files changed, 58 insertions, 15 deletions
diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala
index ad2cef3..4dd7e6f 100644
--- a/src/accounts-service-user.vala
+++ b/src/accounts-service-user.vala
@@ -43,9 +43,18 @@ public class AccountsServiceUser : Object {
}
if (this._player == null) {
+ debug("Clearing player data in accounts service");
+
/* Clear it */
this.proxy.player_name = "";
this.proxy.timestamp = 0;
+ this.proxy.title = "";
+ this.proxy.artist = "";
+ this.proxy.album = "";
+ this.proxy.art_url = "";
+
+ var icon = new ThemedIcon.with_default_fallbacks ("application-default-icon");
+ this.proxy.player_icon = icon.serialize();
} else {
this.proxy.timestamp = GLib.get_monotonic_time();
this.proxy.player_name = this._player.name;
@@ -85,11 +94,24 @@ public class AccountsServiceUser : Object {
public AccountsServiceUser () {
user = accounts_manager.get_user(GLib.Environment.get_user_name());
- user.notify["is-loaded"].connect(() => {
- debug("User loaded");
+ user.notify["is-loaded"].connect(() => user_loaded_changed());
+ user_loaded_changed();
- this.proxy = null;
+ Bus.get_proxy.begin<GreeterBroadcast> (
+ BusType.SYSTEM,
+ "com.canonical.Unity.Greeter.Broadcast",
+ "/com/canonical/Unity/Greeter/Broadcast",
+ DBusProxyFlags.NONE,
+ null,
+ greeter_proxy_new);
+ }
+ void user_loaded_changed () {
+ debug("User loaded changed");
+
+ this.proxy = null;
+
+ if (this.user.is_loaded) {
Bus.get_proxy.begin<AccountsServiceSoundSettings> (
BusType.SYSTEM,
"org.freedesktop.Accounts",
@@ -97,18 +119,11 @@ public class AccountsServiceUser : Object {
DBusProxyFlags.GET_INVALIDATED_PROPERTIES,
null,
new_proxy);
- });
-
- Bus.get_proxy.begin<GreeterBroadcast> (
- BusType.SYSTEM,
- "com.canonical.Unity.Greeter.Broadcast",
- "/com/canonical/Unity/Greeter/Broadcast",
- DBusProxyFlags.NONE,
- null,
- greeter_proxy_new);
+ }
}
~AccountsServiceUser () {
+ debug("Account Service Object Finalizing");
this.player = null;
if (this.timer != 0) {
diff --git a/src/service.vala b/src/service.vala
index 1617887..0e32bfe 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -67,20 +67,39 @@ public class IndicatorSound.Service: Object {
sharedsettings.bind ("allow-amplified-volume", this, "allow-amplified-volume", SettingsBindFlags.GET);
}
+ ~Service() {
+ if (this.sound_was_blocked_timeout_id > 0) {
+ Source.remove (this.sound_was_blocked_timeout_id);
+ this.sound_was_blocked_timeout_id = 0;
+ }
+ }
+
void build_accountsservice () {
+ clear_acts_player();
this.accounts_service = null;
/* If we're not exporting, don't build anything */
if (!this.settings.get_boolean("greeter-export")) {
+ debug("Accounts service export disabled due to user setting");
return;
}
/* If we're on the greeter, don't export */
if (GLib.Environment.get_user_name() == "lightdm") {
+ debug("Accounts service export disabled due to being used on the greeter");
return;
}
this.accounts_service = new AccountsServiceUser();
+
+ this.eventually_update_player_actions();
+ }
+
+ void clear_acts_player () {
+ /* NOTE: This is a bit of a hack to ensure that accounts service doesn't
+ continue to export the player by keeping a ref in the timer */
+ if (this.accounts_service != null)
+ this.accounts_service.player = null;
}
public int run () {
@@ -93,8 +112,17 @@ public class IndicatorSound.Service: Object {
this.bus_acquired, null, this.name_lost);
this.loop = new MainLoop (null, false);
+
+ GLib.Unix.signal_add(GLib.ProcessSignal.TERM, () => {
+ debug("SIGTERM recieved, stopping our mainloop");
+ this.loop.quit();
+ return false;
+ });
+
this.loop.run ();
+ clear_acts_player();
+
return 0;
}
@@ -381,9 +409,8 @@ public class IndicatorSound.Service: Object {
}
}
- if (clear_accounts_player && accounts_service != null) {
- accounts_service.player = null;
- }
+ if (clear_accounts_player)
+ clear_acts_player();
this.player_action_update_id = 0;
return false;
diff --git a/src/volume-control.vala b/src/volume-control.vala
index 8f21b60..03cac0b 100644
--- a/src/volume-control.vala
+++ b/src/volume-control.vala
@@ -56,6 +56,7 @@ public class VolumeControl : Object
{
if (_reconnect_timer != 0) {
Source.remove (_reconnect_timer);
+ _reconnect_timer = 0;
}
}