aboutsummaryrefslogtreecommitdiff
path: root/src/service.vala
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-03-21 16:35:59 -0500
committerTed Gould <ted@gould.cx>2014-03-21 16:35:59 -0500
commit2cce3ce2625f4c75375b5bbb155cc2afea5a8c1c (patch)
tree0c592ebeab5fb6acf6d0e69de56c400c33f900f0 /src/service.vala
parent1680e2e1552575d66898de0e3d90be0bfa354b7a (diff)
parentd114c16f06803c8619d652b3a9dda31da3f1699a (diff)
downloadayatana-indicator-sound-2cce3ce2625f4c75375b5bbb155cc2afea5a8c1c.tar.gz
ayatana-indicator-sound-2cce3ce2625f4c75375b5bbb155cc2afea5a8c1c.tar.bz2
ayatana-indicator-sound-2cce3ce2625f4c75375b5bbb155cc2afea5a8c1c.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;