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 | |
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')
-rw-r--r-- | src/accounts-service-access.vala | 31 | ||||
-rw-r--r-- | src/accounts-service-sound-settings.vala | 4 | ||||
-rw-r--r-- | src/media-player-list-greeter.vala | 18 | ||||
-rw-r--r-- | src/volume-control-pulse.vala | 12 |
4 files changed, 43 insertions, 22 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 diff --git a/src/accounts-service-sound-settings.vala b/src/accounts-service-sound-settings.vala index dcba7ea..54c6ad6 100644 --- a/src/accounts-service-sound-settings.vala +++ b/src/accounts-service-sound-settings.vala @@ -1,5 +1,6 @@ /* * Copyright 2014 Canonical Ltd. + * Copyright 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 @@ -15,6 +16,7 @@ * * Authors: * Ted Gould <ted@canonical.com> + * Robert Tari <robert@tari.in> */ [DBus (name = "org.ayatana.indicator.sound.AccountsService")] @@ -29,4 +31,6 @@ public interface AccountsServiceSoundSettings : Object { public abstract string artist {owned get; set;} public abstract string album {owned get; set;} public abstract string art_url {owned get; set;} + public abstract double volume {owned get; set;} + public abstract bool mute {owned get; set;} } diff --git a/src/media-player-list-greeter.vala b/src/media-player-list-greeter.vala index 83e1d3f..8965cba 100644 --- a/src/media-player-list-greeter.vala +++ b/src/media-player-list-greeter.vala @@ -1,6 +1,6 @@ /* * Copyright 2014 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 @@ -19,10 +19,10 @@ * Robert Tari <robert@tari.in> */ -[DBus (name="org.ayatana.Greeter.List")] +[DBus (name="org.ayatana.greeter")] public interface AyatanaGreeterList : 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 MediaPlayerListGreeter : MediaPlayerList { @@ -33,8 +33,8 @@ public class MediaPlayerListGreeter : MediaPlayerList { public MediaPlayerListGreeter () { Bus.get_proxy.begin<AyatanaGreeterList> ( BusType.SESSION, - "org.ayatana.Greeter", - "/list", + "org.ayatana.greeter", + "/org/ayatana/greeter", DBusProxyFlags.NONE, null, new_proxy); @@ -44,14 +44,14 @@ public class MediaPlayerListGreeter : MediaPlayerList { try { this.proxy = Bus.get_proxy.end(res); - this.proxy.entry_selected.connect(active_user_changed); - this.proxy.get_active_entry.begin ((obj, res) => { + this.proxy.UserChanged.connect(active_user_changed); + this.proxy.GetUser.begin ((obj, res) => { try { var list = (obj as AyatanaGreeterList); if (list != null) { - var value = list.get_active_entry.end(res); + var value = list.GetUser.end(res); active_user_changed(value); } } catch (Error e) { diff --git a/src/volume-control-pulse.vala b/src/volume-control-pulse.vala index 706b0fe..460b098 100644 --- a/src/volume-control-pulse.vala +++ b/src/volume-control-pulse.vala @@ -1,6 +1,6 @@ /* * Copyright 2013 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 @@ -78,6 +78,16 @@ public class VolumeControlPulse : VolumeControl start_account_service_volume_timer(); } }); + + this._accounts_service_access.notify["mute"].connect(() => { + + if (_mute != this._accounts_service_access.mute) + { + set_mute_internal (this._accounts_service_access.mute); + start_account_service_volume_timer(); + } + }); + this.reconnect_to_pulse (); } |