diff options
author | Robert Tari <robert@tari.in> | 2021-11-10 11:19:39 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-11-12 13:13:10 +0100 |
commit | 611fb696d239afec803bd2fdfdcbc1b475ff3a26 (patch) | |
tree | f7131a27f3a989d1294740466fed4f33af84cd6e | |
parent | 27963fd99ac38eee2477ec6ae6e8d2882959994a (diff) | |
download | ayatana-indicator-sound-611fb696d239afec803bd2fdfdcbc1b475ff3a26.tar.gz ayatana-indicator-sound-611fb696d239afec803bd2fdfdcbc1b475ff3a26.tar.bz2 ayatana-indicator-sound-611fb696d239afec803bd2fdfdcbc1b475ff3a26.zip |
Drop org.ayatana.AccountsService.Sound
-rw-r--r-- | data/50-org.ayatana.AccountsService.Sound.pkla | 13 | ||||
-rw-r--r-- | data/CMakeLists.txt | 30 | ||||
-rw-r--r-- | data/org.ayatana.AccountsService.Sound.policy | 24 | ||||
-rw-r--r-- | data/org.ayatana.AccountsService.Sound.xml | 27 | ||||
-rw-r--r-- | src/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/accounts-service-access.vala | 33 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/dbus-types/CMakeLists.txt | 14 | ||||
-rw-r--r-- | tests/dbus-types/org.ayatana.AccountsService.Sound.xml | 9 | ||||
-rw-r--r-- | tests/integration/CMakeLists.txt | 4 | ||||
-rw-r--r-- | tests/integration/utils/dbus-pulse-volume.cpp | 9 | ||||
-rw-r--r-- | tests/service-mocks/CMakeLists.txt | 4 | ||||
-rw-r--r-- | tests/service-mocks/accounts-mock/AccountsDefs.h | 10 | ||||
-rw-r--r-- | tests/service-mocks/accounts-mock/CMakeLists.txt | 8 | ||||
-rw-r--r-- | tests/service-mocks/accounts-mock/org.ayatana.AccountsService.Sound.Mock.xml | 7 | ||||
-rw-r--r-- | tests/service-mocks/media-player-mpris-mock/CMakeLists.txt | 4 | ||||
-rw-r--r-- | tests/service-mocks/media-player-mpris-mock/MediaPlayerMprisDefs.h | 10 |
17 files changed, 43 insertions, 170 deletions
diff --git a/data/50-org.ayatana.AccountsService.Sound.pkla b/data/50-org.ayatana.AccountsService.Sound.pkla deleted file mode 100644 index ac58f75..0000000 --- a/data/50-org.ayatana.AccountsService.Sound.pkla +++ /dev/null @@ -1,13 +0,0 @@ -[Allow greeter to set fields] -Identity=unix-user:lightdm -Action=org.ayatana.AccountsService.GreeterChangeAny -ResultAny=no -ResultInactive=yes -ResultActive=yes - -[Allow greeter to read fields] -Identity=unix-user:lightdm -Action=org.ayatana.AccountsService.GreeterReadAny -ResultAny=yes -ResultInactive=yes -ResultActive=yes diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index f2873d9..ee9d97f 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -93,33 +93,3 @@ DESTINATION "${POLKIT_DATA_DIR}/actions" install(FILES 50-org.ayatana.indicator.sound.AccountsService.pkla DESTINATION "${POLKIT_LIB_DIR}/localauthority/10-vendor.d" ) - -####################################### -# Accounts Service Iface: Greeter Sound -####################################### - -if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml") - - # Nothing to do here... - # Using files from Lomiri specific package 'lomiri-schemas'. - -else() - - install(FILES org.ayatana.AccountsService.Sound.xml - DESTINATION "${DBUS_IFACE_DIR}" - ) - - # Create accountsservice symlink for above dbus interface - install(CODE " - execute_process(COMMAND mkdir -p \"\$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\") - execute_process(COMMAND ln -sf ../../dbus-1/interfaces/org.ayatana.AccountsService.Sound.xml \"\$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\") - ") - - install(FILES org.ayatana.AccountsService.Sound.policy - DESTINATION "${POLKIT_DATA_DIR}/actions" - ) - - install(FILES 50-org.ayatana.AccountsService.Sound.pkla - DESTINATION "${POLKIT_LIB_DIR}/localauthority/10-vendor.d" - ) -endif() diff --git a/data/org.ayatana.AccountsService.Sound.policy b/data/org.ayatana.AccountsService.Sound.policy deleted file mode 100644 index 7140498..0000000 --- a/data/org.ayatana.AccountsService.Sound.policy +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<policyconfig> - <!-- Same as org.freedesktop.accounts.user-administration, but we override - settings for the lightdm user in a pkla file. --> - <action id="org.ayatana.AccountsService.GreeterChangeAny"> - <defaults> - <allow_any>no</allow_any> - <allow_inactive>no</allow_inactive> - <allow_active>auth_admin_keep</allow_active> - </defaults> - </action> - - <!-- Normally anyone can read these, but for a little bit extra lock down, - disallow all access, but we'll let the lightdm user read them via the - pkla override. --> - <action id="org.ayatana.AccountsService.GreeterReadAny"> - <defaults> - <allow_any>no</allow_any> - <allow_inactive>no</allow_inactive> - <allow_active>no</allow_active> - </defaults> - </action> -</policyconfig> diff --git a/data/org.ayatana.AccountsService.Sound.xml b/data/org.ayatana.AccountsService.Sound.xml deleted file mode 100644 index bfbdd09..0000000 --- a/data/org.ayatana.AccountsService.Sound.xml +++ /dev/null @@ -1,27 +0,0 @@ -<node> - <interface name="org.ayatana.AccountsService.Sound"> - - <annotation name="org.freedesktop.Accounts.VendorExtension" value="true"/> - - <annotation name="org.freedesktop.Accounts.Authentication.ChangeAny" - value="org.ayatana.AccountsService.GreeterChangeAny"/> - - <annotation name="org.freedesktop.Accounts.Authentication.ReadAny" - value="org.ayatana.AccountsService.GreeterReadAny"/> - - <property name="Volume" type="d" access="readwrite"> - <annotation name="org.freedesktop.Accounts.DefaultValue" value="-1.0"/> - </property> - - <!-- Muted is all sound, SilentMode is only non-user-initiated sounds --> - <property name="Muted" type="b" access="readwrite"> - <annotation name="org.freedesktop.Accounts.DefaultValue" value="false"/> - </property> - - <property name="LastRunningPlayer" type="s" access="readwrite"> - <annotation name="org.freedesktop.Accounts.DefaultValue.String" - value=""/> - </property> - - </interface> -</node> 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); } } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 30b0e13..d0c0ac6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -322,7 +322,7 @@ add_test(indicator-test indicator-test ) -if(LOMIRI_API_FOUND) +if (LOMIRI_API_FOUND AND EXISTS "/usr/share/glib-2.0/schemas/com.lomiri.sound.gschema.xml") add_subdirectory(integration) endif() add_subdirectory(dbus-types) diff --git a/tests/dbus-types/CMakeLists.txt b/tests/dbus-types/CMakeLists.txt index cbe382a..1b6faed 100644 --- a/tests/dbus-types/CMakeLists.txt +++ b/tests/dbus-types/CMakeLists.txt @@ -15,14 +15,10 @@ set_source_files_properties(${dbusinterface_accounts_xml} PROPERTIES CLASSNAME AccountsInterface) if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml") - set(dbusinterface_accountssound_xml "com.lomiri.AccountsService.Sound.xml") -else() - set(dbusinterface_accountssound_xml "org.ayatana.AccountsService.Sound.xml") + set_source_files_properties("com.lomiri.AccountsService.Sound.xml" PROPERTIES + CLASSNAME AccountsSoundInterface) endif() -set_source_files_properties(${dbusinterface_accountssound_xml} PROPERTIES - CLASSNAME AccountsSoundInterface) - set(dbusinterface_properties_xml "org.freedesktop.DBus.Properties.xml") set_source_files_properties(${dbusinterface_properties_xml} PROPERTIES CLASSNAME DBusPropertiesInterface @@ -41,7 +37,11 @@ set_source_files_properties(${dbusinterface_notifications_xml} PROPERTIES qt5_add_dbus_interface(interface_files ${dbusinterface_streamrestore_xml} stream_restore_interface) qt5_add_dbus_interface(interface_files ${dbusinterface_properties_xml} dbus_properties_interface) qt5_add_dbus_interface(interface_files ${dbusinterface_accounts_xml} dbus_accounts_interface) -qt5_add_dbus_interface(interface_files ${dbusinterface_accountssound_xml} dbus_accountssound_interface) + +if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml") + qt5_add_dbus_interface("com.lomiri.AccountsService.Sound.xml" dbus_accountssound_interface) +endif() + qt5_add_dbus_interface(interface_files ${dbusinterface_actions_xml} dbus_menus_interface) qt5_add_dbus_interface(interface_files ${dbusinterface_notifications_xml} dbus_notifications_interface) diff --git a/tests/dbus-types/org.ayatana.AccountsService.Sound.xml b/tests/dbus-types/org.ayatana.AccountsService.Sound.xml deleted file mode 100644 index aa05cf3..0000000 --- a/tests/dbus-types/org.ayatana.AccountsService.Sound.xml +++ /dev/null @@ -1,9 +0,0 @@ -<node> - <interface name="org.ayatana.AccountsService.Sound"> - <method name="Set"> - <arg direction="in" type="s" name="interface" /> - <arg direction="in" type="s" name="property" /> - <arg direction="out" type="o" name="path" /> - </method> - </interface> -</node> diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt index a21ce0e..164ab8b 100644 --- a/tests/integration/CMakeLists.txt +++ b/tests/integration/CMakeLists.txt @@ -38,10 +38,6 @@ add_definitions(-DSOUND_SERVICE_BIN="${CMAKE_BINARY_DIR}/src/ayatana-indicator-s -DTEST_HOME="${TEST_HOME}" ) -if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml") - add_definitions(-DHAS_LOMIRI_ACCTSERVICE_SOUND_SETTINGS) -endif() - set(GLIB_REQUIRED_VERSION 2.26) pkg_check_modules( diff --git a/tests/integration/utils/dbus-pulse-volume.cpp b/tests/integration/utils/dbus-pulse-volume.cpp index 2338de1..fa3ca3e 100644 --- a/tests/integration/utils/dbus-pulse-volume.cpp +++ b/tests/integration/utils/dbus-pulse-volume.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 Canonical, Ltd. + * Copyright (C) 2021 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -13,7 +14,9 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. * - * Author: Xavi Garcia <xavi.garcia.mena@canonical.com> + * Authors: + * Xavi Garcia <xavi.garcia.mena@canonical.com> + * Robert Tari <robert@tari.in> */ #include "dbus-pulse-volume.h" @@ -140,11 +143,7 @@ bool DBusPulseVolume::setVolume(QString const & role, double volume) { QDBusVariant dbusVar(QVariant::fromValue(volume)); QDBusReply<void> set_vol = accounts_interface_->call(QLatin1String("Set"), -#ifdef HAS_LOMIRI_ACCTSERVICE_SOUND_SETTINGS QVariant::fromValue(QString("com.lomiri.AccountsService.Sound")), -#else - QVariant::fromValue(QString("org.ayatana.AccountsService.Sound")), -#endif QVariant::fromValue(QString("Volume")), QVariant::fromValue(dbusVar)); if (!set_vol.isValid()) diff --git a/tests/service-mocks/CMakeLists.txt b/tests/service-mocks/CMakeLists.txt index 9cd8acb..f604986 100644 --- a/tests/service-mocks/CMakeLists.txt +++ b/tests/service-mocks/CMakeLists.txt @@ -1,2 +1,4 @@ -add_subdirectory(accounts-mock) +if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml") + add_subdirectory(accounts-mock) +endif() add_subdirectory(media-player-mpris-mock) diff --git a/tests/service-mocks/accounts-mock/AccountsDefs.h b/tests/service-mocks/accounts-mock/AccountsDefs.h index bf66208..db7cdfe 100644 --- a/tests/service-mocks/accounts-mock/AccountsDefs.h +++ b/tests/service-mocks/accounts-mock/AccountsDefs.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 Canonical, Ltd. + * Copyright (C) 2021 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -13,7 +14,9 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. * - * Author: Xavi Garcia <xavi.garcia.mena@canonical.com> + * Authors: + * Xavi Garcia <xavi.garcia.mena@canonical.com> + * Robert Tari <robert@tari.in> */ #pragma once @@ -28,11 +31,8 @@ namespace testing constexpr const char ACCOUNTS_SERVICE[] = "org.freedesktop.Accounts"; constexpr const char USER_PATH[] = "/org/freedesktop/Accounts/UserTest"; constexpr const char ACCOUNTS_PATH[] = "/org/freedesktop/Accounts"; -#ifdef HAS_LOMIRI_ACCTSERVICE_SOUND_SETTINGS constexpr const char ACCOUNTS_SOUND_INTERFACE[] = "com.lomiri.AccountsService.Sound"; -#else - constexpr const char ACCOUNTS_SOUND_INTERFACE[] = "org.ayatana.AccountsService.Sound"; -#endif + } // namespace testing } // namespace indicators diff --git a/tests/service-mocks/accounts-mock/CMakeLists.txt b/tests/service-mocks/accounts-mock/CMakeLists.txt index 1549249..da9bc99 100644 --- a/tests/service-mocks/accounts-mock/CMakeLists.txt +++ b/tests/service-mocks/accounts-mock/CMakeLists.txt @@ -6,13 +6,7 @@ include_directories(${Qt5DBus_INCLUDE_DIRS} "${CMAKE_SOURCE_DIR}/tests/service-mocks") add_definitions(-DQT_NO_KEYWORDS=1) - -if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml") - add_definitions(-DHAS_LOMIRI_ACCTSERVICE_SOUND_SETTINGS) - set(dbusinterface_sound_xml "com.lomiri.AccountsService.Sound.Mock.xml") -else() - set(dbusinterface_sound_xml "org.ayatana.AccountsService.Sound.Mock.xml") -endif() +set(dbusinterface_sound_xml "com.lomiri.AccountsService.Sound.Mock.xml") set_source_files_properties(${dbusinterface_sound_xml} PROPERTIES CLASSNAME AccountsServiceSoundMockInterface) diff --git a/tests/service-mocks/accounts-mock/org.ayatana.AccountsService.Sound.Mock.xml b/tests/service-mocks/accounts-mock/org.ayatana.AccountsService.Sound.Mock.xml deleted file mode 100644 index ae9170f..0000000 --- a/tests/service-mocks/accounts-mock/org.ayatana.AccountsService.Sound.Mock.xml +++ /dev/null @@ -1,7 +0,0 @@ -<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> -<node> - <interface name="org.ayatana.AccountsService.Sound"> - <property name="Volume" type="d" access="readwrite"/> - <property name="LastRunningPlayer" type="s" access="readwrite"/> - </interface> -</node>
\ No newline at end of file diff --git a/tests/service-mocks/media-player-mpris-mock/CMakeLists.txt b/tests/service-mocks/media-player-mpris-mock/CMakeLists.txt index 08ff68f..b7284bb 100644 --- a/tests/service-mocks/media-player-mpris-mock/CMakeLists.txt +++ b/tests/service-mocks/media-player-mpris-mock/CMakeLists.txt @@ -8,10 +8,6 @@ find_package(Qt5DBus REQUIRED) include_directories(${Qt5DBus_INCLUDE_DIRS} "${CMAKE_SOURCE_DIR}/tests/service-mocks") -if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.SecurityPrivacy.xml") - add_definitions(-DHAS_LOMIRI_ACCTSERVICE_SOUND_SETTINGS) -endif() - add_definitions(-DQT_NO_KEYWORDS=1) set(dbusinterface_mediaplayermpris_xml "org.mpris.MediaPlayer2.Player.xml") diff --git a/tests/service-mocks/media-player-mpris-mock/MediaPlayerMprisDefs.h b/tests/service-mocks/media-player-mpris-mock/MediaPlayerMprisDefs.h index 24fa986..214555b 100644 --- a/tests/service-mocks/media-player-mpris-mock/MediaPlayerMprisDefs.h +++ b/tests/service-mocks/media-player-mpris-mock/MediaPlayerMprisDefs.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 Canonical, Ltd. + * Copyright (C) 2021 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -13,7 +14,9 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. * - * Author: Xavi Garcia <xavi.garcia.mena@canonical.com> + * Authors: + * Xavi Garcia <xavi.garcia.mena@canonical.com> + * Robert Tari <robert@tari.in> */ #pragma once @@ -28,11 +31,8 @@ namespace testing constexpr const char MEDIA_PLAYER_MPRIS_SERVICE[] = "org.freedesktop.Accounts"; constexpr const char USER_PATH[] = "/org/freedesktop/Accounts/UserTest"; constexpr const char ACCOUNTS_PATH[] = "/org/freedesktop/Accounts"; -#ifdef HAS_LOMIRI_ACCTSERVICE_SOUND_SETTINGS constexpr const char ACCOUNTS_SOUND_INTERFACE[] = "com.lomiri.AccountsService.Sound"; -#else - constexpr const char ACCOUNTS_SOUND_INTERFACE[] = "org.ayatana.AccountsService.Sound"; -#endif + } // namespace testing } // namespace indicators |