From 006c044b3063c905a5c7aa8c31e91a4545acedae Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 20 Mar 2014 11:35:45 -0500 Subject: Connect to the setting for exporting to the greeter to the creation of the accounts service user --- src/service.vala | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/service.vala b/src/service.vala index 6835896..7f4982f 100644 --- a/src/service.vala +++ b/src/service.vala @@ -46,9 +46,9 @@ public class IndicatorSound.Service: Object { this.volume_control.bind_property ("active-mic", menu, "show-mic-volume", BindingFlags.SYNC_CREATE); }); - if (GLib.Environment.get_user_name() != "lightdm") { - accounts_service = new AccountsServiceUser(); - } + /* Setup handling for the greeter-export setting */ + this.settings.changed["greeter-export"].connect( () => this.build_accountsservice() ); + build_accountsservice(); this.sync_preferred_players (); this.settings.changed["interested-media-players"].connect ( () => { @@ -66,6 +66,22 @@ public class IndicatorSound.Service: Object { sharedsettings.bind ("allow-amplified-volume", this, "allow-amplified-volume", SettingsBindFlags.GET); } + void build_accountsservice () { + this.accounts_service = null; + + /* If we're not exporting, don't build anything */ + if (!this.settings.get_boolean("greeter-export")) { + return; + } + + /* If we're on the greeter, don't export */ + if (GLib.Environment.get_user_name() == "lightdm") { + return; + } + + this.accounts_service = new AccountsServiceUser(); + } + public int run () { if (this.loop != null) { warning ("service is already running"); -- cgit v1.2.3