aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/accounts-service-access.vala33
2 files changed, 17 insertions, 21 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f74e488..7479518 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -26,10 +26,6 @@ else()
set (HAS_LOMIRI_ACCTSERVICE_SYSTEMSOUND_SETTINGS OFF)
endif()
-if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml")
- set (VALA_DEFINE_ACCTSERVICE_SOUND_SETTINGS "--define=HAS_LOMIRI_ACCTSERVICE_SOUND_SETTINGS")
-endif()
-
vapi_gen(accounts-service
LIBRARY
accounts-service
@@ -61,7 +57,6 @@ vala_init(ayatana-indicator-sound-service
--pkg=bus-watcher
${VALA_DEFINE_LOMIRI_SOUND_SCHEMA}
${VALA_DEFINE_ACCTSERVICE_PRIVACY_SETTINGS}
- ${VALA_DEFINE_ACCTSERVICE_SOUND_SETTINGS}
${VALA_DEFINE_ACCTSERVICE_SYSTEMSOUND_SETTINGS}
)
diff --git a/src/accounts-service-access.vala b/src/accounts-service-access.vala
index 19a27c6..1c55ff2 100644
--- a/src/accounts-service-access.vala
+++ b/src/accounts-service-access.vala
@@ -143,10 +143,8 @@ public class AccountsServiceAccess : Object
string user_path;
if (user_path_variant.check_format_string ("(o)", true)) {
user_path_variant.get ("(o)", out user_path);
-#if HAS_LOMIRI_ACCTSERVICE_SOUND_SETTINGS
+#if HAS_LOMIRI_SOUND_SCHEMA
_user_proxy = yield new DBusProxy.for_bus (BusType.SYSTEM, DBusProxyFlags.GET_INVALIDATED_PROPERTIES, null, "org.freedesktop.Accounts", user_path, "com.lomiri.AccountsService.Sound");
-#else
- _user_proxy = yield new DBusProxy.for_bus (BusType.SYSTEM, DBusProxyFlags.GET_INVALIDATED_PROPERTIES, null, "org.freedesktop.Accounts", user_path, "org.ayatana.AccountsService.Sound");
#endif
} else {
warning ("Unable to find user name after calling FindUserByName. Expected type: %s and obtained %s", "(o)", user_path_variant.get_type_string () );
@@ -157,20 +155,23 @@ public class AccountsServiceAccess : Object
return;
}
- // Get current values and listen for changes
- _user_proxy.g_properties_changed.connect (accountsservice_props_changed_cb);
- try {
- var props_variant = yield _user_proxy.get_connection ().call (_user_proxy.get_name (), _user_proxy.get_object_path (), "org.freedesktop.DBus.Properties", "GetAll", new Variant ("(s)", _user_proxy.get_interface_name ()), null, DBusCallFlags.NONE, -1);
- if (props_variant.check_format_string ("(@a{sv})", true)) {
- Variant props;
- props_variant.get ("(@a{sv})", out props);
- accountsservice_props_changed_cb(_user_proxy, props, null);
- } else {
- warning ("Unable to get accounts service properties after calling GetAll. Expected type: %s and obtained %s", "(@a{sv})", props_variant.get_type_string () );
- return;
+ if (_user_proxy != null)
+ {
+ // Get current values and listen for changes
+ _user_proxy.g_properties_changed.connect (accountsservice_props_changed_cb);
+ try {
+ var props_variant = yield _user_proxy.get_connection ().call (_user_proxy.get_name (), _user_proxy.get_object_path (), "org.freedesktop.DBus.Properties", "GetAll", new Variant ("(s)", _user_proxy.get_interface_name ()), null, DBusCallFlags.NONE, -1);
+ if (props_variant.check_format_string ("(@a{sv})", true)) {
+ Variant props;
+ props_variant.get ("(@a{sv})", out props);
+ accountsservice_props_changed_cb(_user_proxy, props, null);
+ } else {
+ warning ("Unable to get accounts service properties after calling GetAll. Expected type: %s and obtained %s", "(@a{sv})", props_variant.get_type_string () );
+ return;
+ }
+ } catch (GLib.Error e) {
+ debug("Unable to get properties for user %s at first try: %s", username, e.message);
}
- } catch (GLib.Error e) {
- debug("Unable to get properties for user %s at first try: %s", username, e.message);
}
}