diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-12-07 12:10:26 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-12-07 12:10:26 +0100 |
commit | a162229fb1d77a1616dd7fed2b17ad6cbe038b12 (patch) | |
tree | 17a164d3467028819d04a4443723b8b6d43568ef | |
parent | d08b85f6382bda49d4b2830602369d5f9f76db89 (diff) | |
download | ayatana-indicator-sound-a162229fb1d77a1616dd7fed2b17ad6cbe038b12.tar.gz ayatana-indicator-sound-a162229fb1d77a1616dd7fed2b17ad6cbe038b12.tar.bz2 ayatana-indicator-sound-a162229fb1d77a1616dd7fed2b17ad6cbe038b12.zip |
Revert "com.ubuntu.touch: Drop system sound setting access and privacy settings access for now. Can be re-added later, if required."
This reverts commit 2a1a7325adc6d0bbb57d7ed4bcef90e1285e1eb5.
-rw-r--r-- | po/POTFILES.in | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/accounts-service-privacy-settings.vala | 25 | ||||
-rw-r--r-- | src/accounts-service-system-sound-settings.vala | 24 | ||||
-rw-r--r-- | src/accounts-service-user.vala | 60 |
5 files changed, 119 insertions, 0 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in index 8e016b1..486fc39 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -6,7 +6,9 @@ include/unity/gmenuharness/MatchUtils.h include/unity/gmenuharness/MenuItemMatcher.h include/unity/gmenuharness/MenuMatcher.h src/accounts-service-access.vala +src/accounts-service-privacy-settings.vala src/accounts-service-sound-settings.vala +src/accounts-service-system-sound-settings.vala src/accounts-service-user.vala src/bus-watch-namespace.c src/bus-watch-namespace.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3e2805e..c1254dc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -214,12 +214,20 @@ vala_add(ayatana-indicator-sound-service media-player mpris2-interfaces accounts-service-sound-settings + accounts-service-privacy-settings + accounts-service-system-sound-settings greeter-broadcast ) vala_add(ayatana-indicator-sound-service accounts-service-sound-settings.vala ) vala_add(ayatana-indicator-sound-service + accounts-service-privacy-settings.vala +) +vala_add(ayatana-indicator-sound-service + accounts-service-system-sound-settings.vala +) +vala_add(ayatana-indicator-sound-service greeter-broadcast.vala ) diff --git a/src/accounts-service-privacy-settings.vala b/src/accounts-service-privacy-settings.vala new file mode 100644 index 0000000..cf6b267 --- /dev/null +++ b/src/accounts-service-privacy-settings.vala @@ -0,0 +1,25 @@ +/* + * Copyright 2014 © Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Authors: + * Ted Gould <ted@canonical.com> + */ + +[DBus (name = "com.ubuntu.touch.AccountsService.SecurityPrivacy")] +public interface AccountsServicePrivacySettings : Object { + // properties + public abstract bool stats_welcome_screen {owned get; set;} + public abstract bool messages_welcome_screen {owned get; set;} +} diff --git a/src/accounts-service-system-sound-settings.vala b/src/accounts-service-system-sound-settings.vala new file mode 100644 index 0000000..3b01561 --- /dev/null +++ b/src/accounts-service-system-sound-settings.vala @@ -0,0 +1,24 @@ +/* + * Copyright 2014 © Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Authors: + * Ted Gould <ted@canonical.com> + */ + +[DBus (name = "com.ubuntu.touch.AccountsService.Sound")] +public interface AccountsServiceSystemSoundSettings : Object { + // properties + public abstract bool silent_mode {owned get; set;} +} diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala index 496b67c..535f6c7 100644 --- a/src/accounts-service-user.vala +++ b/src/accounts-service-user.vala @@ -21,6 +21,8 @@ public class AccountsServiceUser : Object { Act.UserManager accounts_manager = Act.UserManager.get_default(); Act.User? user = null; AccountsServiceSoundSettings? proxy = null; + AccountsServicePrivacySettings? privacyproxy = null; + AccountsServiceSystemSoundSettings? syssoundproxy = null; uint timer = 0; MediaPlayer? _player = null; GreeterBroadcast? greeter = null; @@ -34,6 +36,8 @@ public class AccountsServiceUser : Object { } set { _silentMode = value; + if (syssoundproxy != null) + syssoundproxy.silent_mode = value; } } @@ -137,6 +141,22 @@ public class AccountsServiceUser : Object { DBusProxyFlags.GET_INVALIDATED_PROPERTIES, null, new_sound_proxy); + + Bus.get_proxy.begin<AccountsServicePrivacySettings> ( + BusType.SYSTEM, + "org.freedesktop.Accounts", + user.get_object_path(), + DBusProxyFlags.GET_INVALIDATED_PROPERTIES, + null, + new_privacy_proxy); + + Bus.get_proxy.begin<AccountsServiceSystemSoundSettings> ( + BusType.SYSTEM, + "org.freedesktop.Accounts", + user.get_object_path(), + DBusProxyFlags.GET_INVALIDATED_PROPERTIES, + null, + new_system_sound_proxy); } } @@ -160,6 +180,46 @@ public class AccountsServiceUser : Object { } } + void new_privacy_proxy (GLib.Object? obj, AsyncResult res) { + try { + this.privacyproxy = Bus.get_proxy.end (res); + + (this.privacyproxy as DBusProxy).g_properties_changed.connect((proxy, changed, invalid) => { + var welcomeval = changed.lookup_value("MessagesWelcomeScreen", VariantType.BOOLEAN); + if (welcomeval != null) { + debug("Messages on welcome screen changed"); + this.showDataOnGreeter = welcomeval.get_boolean(); + } + }); + + this.showDataOnGreeter = this.privacyproxy.messages_welcome_screen; + } catch (Error e) { + this.privacyproxy = null; + warning("Unable to get proxy to user privacy settings: %s", e.message); + } + } + + void new_system_sound_proxy (GLib.Object? obj, AsyncResult res) { + try { + this.syssoundproxy = Bus.get_proxy.end (res); + + (this.syssoundproxy as DBusProxy).g_properties_changed.connect((proxy, changed, invalid) => { + var silentvar = changed.lookup_value("SilentMode", VariantType.BOOLEAN); + if (silentvar != null) { + debug("Silent Mode changed"); + this._silentMode = silentvar.get_boolean(); + this.notify_property("silentMode"); + } + }); + + this._silentMode = this.syssoundproxy.silent_mode; + this.notify_property("silentMode"); + } catch (Error e) { + this.syssoundproxy = null; + warning("Unable to get proxy to system sound settings: %s", e.message); + } + } + void greeter_proxy_new (GLib.Object? obj, AsyncResult res) { try { this.greeter = Bus.get_proxy.end (res); |