diff options
author | Robert Tari <robert@tari.in> | 2023-11-08 17:03:13 +0100 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2023-11-10 12:31:31 +0100 |
commit | bd14f03770f218803a3fd41676b4e75f406c4b77 (patch) | |
tree | 341d4155a49c2c659c6c3835fbcc3d522a475c2b /src/accounts-service-access.vala | |
parent | c4825f9ee389b32a9381be6106977870a963561c (diff) | |
download | ayatana-indicator-sound-bd14f03770f218803a3fd41676b4e75f406c4b77.tar.gz ayatana-indicator-sound-bd14f03770f218803a3fd41676b4e75f406c4b77.tar.bz2 ayatana-indicator-sound-bd14f03770f218803a3fd41676b4e75f406c4b77.zip |
Fix AccountsService integration
Diffstat (limited to 'src/accounts-service-access.vala')
-rw-r--r-- | src/accounts-service-access.vala | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/accounts-service-access.vala b/src/accounts-service-access.vala index 7f01b7c..1b66370 100644 --- a/src/accounts-service-access.vala +++ b/src/accounts-service-access.vala @@ -1,6 +1,6 @@ /* * Copyright 2016 Canonical Ltd. - * Copyright 2021 Robert Tari + * Copyright 2021-2023 Robert Tari * * 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 @@ -23,17 +23,17 @@ using PulseAudio; using Notify; using Gee; -[DBus (name="org.ayatana.Greeter.List")] -interface GreeterListInterfaceAccess : Object +[DBus (name="org.ayatana.greeter")] +interface GreeterInterfaceAccess : Object { - public abstract async string get_active_entry () throws GLib.DBusError, GLib.IOError; - public signal void entry_selected (string entry_name); + public abstract async string GetUser () throws GLib.DBusError, GLib.IOError; + public signal void UserChanged (string user); } public class AccountsServiceAccess : Object { private DBusProxy _user_proxy; - private GreeterListInterfaceAccess _greeter_proxy; + private GreeterInterfaceAccess _greeter_proxy; private double _volume = 0.0; private string _last_running_player = ""; private bool _mute = false; @@ -129,7 +129,7 @@ public class AccountsServiceAccess : Object { try { - username = yield _greeter_proxy.get_active_entry (); + username = yield _greeter_proxy.GetUser (); if (username == "" || username == null) { @@ -167,9 +167,16 @@ public class AccountsServiceAccess : Object if (user_path_variant.check_format_string ("(o)", true)) { user_path_variant.get ("(o)", out user_path); -#if LOMIRI_FEATURES_ENABLED - _user_proxy = yield new DBusProxy.for_bus (BusType.SYSTEM, DBusProxyFlags.GET_INVALIDATED_PROPERTIES, null, "org.freedesktop.Accounts", user_path, "com.lomiri.AccountsService.Sound"); -#endif + bool bLomiri = AyatanaCommon.utils_is_lomiri (); + + if (bLomiri) + { + _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.indicator.sound.AccountsService"); + } } else { @@ -223,7 +230,7 @@ public class AccountsServiceAccess : Object { try { - _greeter_proxy = yield Bus.get_proxy (BusType.SESSION, "org.ayatana.Greeter", "/list"); + _greeter_proxy = yield Bus.get_proxy (BusType.SESSION, "org.ayatana.greeter", "/org/ayatana/greeter"); } catch (GLib.Error e) { @@ -232,7 +239,7 @@ public class AccountsServiceAccess : Object return; } - _greeter_proxy.entry_selected.connect (greeter_user_changed); + _greeter_proxy.UserChanged.connect (greeter_user_changed); yield setup_user_proxy (); } else |