aboutsummaryrefslogtreecommitdiff
path: root/src/service.vala
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-03-21 14:34:52 -0500
committerTed Gould <ted@gould.cx>2014-03-21 14:34:52 -0500
commitd114c16f06803c8619d652b3a9dda31da3f1699a (patch)
tree6b51a460d49a87ed1f57c1792a1f232547dce443 /src/service.vala
parent831571ad497d790701d82305c57d8e69188a62ee (diff)
parentaee881c058971adcbe676d0d24d4924a0f38ef67 (diff)
downloadayatana-indicator-sound-d114c16f06803c8619d652b3a9dda31da3f1699a.tar.gz
ayatana-indicator-sound-d114c16f06803c8619d652b3a9dda31da3f1699a.tar.bz2
ayatana-indicator-sound-d114c16f06803c8619d652b3a9dda31da3f1699a.zip
Updating to latest export
Diffstat (limited to 'src/service.vala')
-rw-r--r--src/service.vala33
1 files changed, 30 insertions, 3 deletions
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;