aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--src/CMakeLists.txt26
-rw-r--r--src/accounts-service-access.vala2
-rw-r--r--src/accounts-service-user.vala14
-rw-r--r--src/options-gsettings.vala6
-rw-r--r--tests/CMakeLists.txt8
-rw-r--r--tests/dbus-types/CMakeLists.txt4
-rw-r--r--tests/integration/indicator-sound-test-base.cpp2
-rw-r--r--tests/service-mocks/CMakeLists.txt2
9 files changed, 29 insertions, 41 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3038762..7a5a37a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,6 +63,12 @@ pkg_check_modules(
include_directories(${SOUNDSERVICE_INCLUDE_DIRS})
pkg_check_modules(LOMIRI_API liblomiri-api>=0.1.1)
+pkg_check_modules(LOMIRI_SCHEMAS lomiri-schemas)
+
+# FIXME: Drop this block once lomiri-schemas has all the schemas: https://gitlab.com/ubports/core/lomiri-schemas/-/merge_requests/1
+if(LOMIRI_SCHEMAS_FOUND AND NOT EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml")
+ set(LOMIRI_SCHEMAS_FOUND FALSE)
+endif()
include_directories(${TEST_INCLUDE_DIRS})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7479518..6e24fb2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,24 +6,10 @@ set(HEADER_PATH "${CMAKE_CURRENT_BINARY_DIR}/indicator-sound-service.h")
set(SYMBOLS_PATH "${CMAKE_CURRENT_BINARY_DIR}/indicator-sound-service.def")
set(VAPI_PATH "${CMAKE_CURRENT_BINARY_DIR}/indicator-sound-service.vapi")
-if(EXISTS "/usr/share/glib-2.0/schemas/com.lomiri.sound.gschema.xml")
- set (VALA_DEFINE_LOMIRI_SOUND_SCHEMA "--define=HAS_LOMIRI_SOUND_SCHEMA")
-endif()
-
-if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.touch.AccountsService.SecurityPrivacy.xml")
- set (HAS_LOMIRI_ACCTSERVICE_PRIVACY_SETTINGS ON)
+if(LOMIRI_SCHEMAS_FOUND)
+ set (VALA_DEFINE_HAS_LOMIRI_SCHEMAS "--define=HAS_LOMIRI_SCHEMAS")
set (VALA_FILE_ACCTSERVICE_PRIVACY_SETTINGS "accounts-service-privacy-settings")
- set (VALA_DEFINE_ACCTSERVICE_PRIVACY_SETTINGS "--define=HAS_LOMIRI_ACCTSERVICE_PRIVACY_SETTINGS")
-else()
- set (HAS_LOMIRI_ACCTSERVICE_PRIVACY_SETTINGS OFF)
-endif()
-
-if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.touch.AccountsService.Sound.xml")
- set (HAS_LOMIRI_ACCTSERVICE_SYSTEMSOUND_SETTINGS ON)
set (VALA_FILE_ACCTSERVICE_SYSTEMSOUND_SETTINGS "accounts-service-system-sound-settings")
- set (VALA_DEFINE_ACCTSERVICE_SYSTEMSOUND_SETTINGS "--define=HAS_LOMIRI_ACCTSERVICE_SYSTEMSOUND_SETTINGS")
-else()
- set (HAS_LOMIRI_ACCTSERVICE_SYSTEMSOUND_SETTINGS OFF)
endif()
vapi_gen(accounts-service
@@ -55,9 +41,7 @@ vala_init(ayatana-indicator-sound-service
--vapidir=${CMAKE_SOURCE_DIR}/vapi/
--vapidir=.
--pkg=bus-watcher
- ${VALA_DEFINE_LOMIRI_SOUND_SCHEMA}
- ${VALA_DEFINE_ACCTSERVICE_PRIVACY_SETTINGS}
- ${VALA_DEFINE_ACCTSERVICE_SYSTEMSOUND_SETTINGS}
+ ${VALA_DEFINE_HAS_LOMIRI_SCHEMAS}
)
vala_add(ayatana-indicator-sound-service
@@ -212,13 +196,11 @@ vala_add(ayatana-indicator-sound-service
accounts-service-sound-settings.vala
)
-if(${HAS_LOMIRI_ACCTSERVICE_PRIVACY_SETTINGS})
+if(LOMIRI_SCHEMAS_FOUND)
vala_add(ayatana-indicator-sound-service
accounts-service-privacy-settings.vala
)
-endif()
-if(${HAS_LOMIRI_ACCTSERVICE_SYSTEMSOUND_SETTINGS})
vala_add(ayatana-indicator-sound-service
accounts-service-system-sound-settings.vala
)
diff --git a/src/accounts-service-access.vala b/src/accounts-service-access.vala
index 1c55ff2..373e294 100644
--- a/src/accounts-service-access.vala
+++ b/src/accounts-service-access.vala
@@ -143,7 +143,7 @@ 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_SOUND_SCHEMA
+#if HAS_LOMIRI_SCHEMAS
_user_proxy = yield new DBusProxy.for_bus (BusType.SYSTEM, DBusProxyFlags.GET_INVALIDATED_PROPERTIES, null, "org.freedesktop.Accounts", user_path, "com.lomiri.AccountsService.Sound");
#endif
} else {
diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala
index 0679392..ac803a1 100644
--- a/src/accounts-service-user.vala
+++ b/src/accounts-service-user.vala
@@ -23,10 +23,8 @@ public class AccountsServiceUser : Object {
Act.UserManager accounts_manager = Act.UserManager.get_default();
Act.User? user = null;
AccountsServiceSoundSettings? proxy = null;
-#if HAS_LOMIRI_ACCTSERVICE_PRIVACY_SETTINGS
+#if HAS_LOMIRI_SCHEMAS
AccountsServicePrivacySettings? privacyproxy = null;
-#endif
-#if HAS_LOMIRI_ACCTSERVICE_SYSTEMSOUND_SETTINGS
AccountsServiceSystemSoundSettings? syssoundproxy = null;
#endif
uint timer = 0;
@@ -42,7 +40,7 @@ public class AccountsServiceUser : Object {
}
set {
_silentMode = value;
-#if HAS_LOMIRI_ACCTSERVICE_SYSTEMSOUND_SETTINGS
+#if HAS_LOMIRI_SCHEMAS
if (syssoundproxy != null)
syssoundproxy.silent_mode = value;
#endif
@@ -149,7 +147,7 @@ public class AccountsServiceUser : Object {
DBusProxyFlags.GET_INVALIDATED_PROPERTIES,
null,
new_sound_proxy);
-#if HAS_LOMIRI_ACCTSERVICE_PRIVACY_SETTINGS
+#if HAS_LOMIRI_SCHEMAS
Bus.get_proxy.begin<AccountsServicePrivacySettings> (
BusType.SYSTEM,
"org.freedesktop.Accounts",
@@ -159,7 +157,7 @@ public class AccountsServiceUser : Object {
new_privacy_proxy);
#endif
-#if HAS_LOMIRI_ACCTSERVICE_SYSTEMSOUND_SETTINGS
+#if HAS_LOMIRI_SCHEMAS
Bus.get_proxy.begin<AccountsServiceSystemSoundSettings> (
BusType.SYSTEM,
"org.freedesktop.Accounts",
@@ -191,7 +189,7 @@ public class AccountsServiceUser : Object {
}
}
-#if HAS_LOMIRI_ACCTSERVICE_PRIVACY_SETTINGS
+#if HAS_LOMIRI_SCHEMAS
void new_privacy_proxy (GLib.Object? obj, AsyncResult res) {
try {
this.privacyproxy = Bus.get_proxy.end (res);
@@ -216,7 +214,7 @@ public class AccountsServiceUser : Object {
}
#endif
-#if HAS_LOMIRI_ACCTSERVICE_SYSTEMSOUND_SETTINGS
+#if HAS_LOMIRI_SCHEMAS
void new_system_sound_proxy (GLib.Object? obj, AsyncResult res) {
try {
this.syssoundproxy = Bus.get_proxy.end (res);
diff --git a/src/options-gsettings.vala b/src/options-gsettings.vala
index 17e07c6..48df2fe 100644
--- a/src/options-gsettings.vala
+++ b/src/options-gsettings.vala
@@ -33,7 +33,7 @@ public class IndicatorSound.OptionsGSettings : Options
}
private Settings _settings = new Settings ("org.ayatana.indicator.sound");
-#if HAS_LOMIRI_SOUND_SCHEMA
+#if HAS_LOMIRI_SCHEMAS
private Settings _shared_settings = new Settings ("com.lomiri.sound");
#endif
/** MAX VOLUME PROPERTY **/
@@ -45,7 +45,7 @@ public class IndicatorSound.OptionsGSettings : Options
private void init_max_volume() {
_settings.changed[NORMAL_dB_KEY].connect(() => update_max_volume());
_settings.changed[AMP_dB_KEY].connect(() => update_max_volume());
-#if HAS_LOMIRI_SOUND_SCHEMA
+#if HAS_LOMIRI_SCHEMAS
_shared_settings.changed[ALLOW_AMP_KEY].connect(() => update_max_volume());
#endif
update_max_volume();
@@ -60,7 +60,7 @@ public class IndicatorSound.OptionsGSettings : Options
}
}
private double calculate_max_volume () {
-#if HAS_LOMIRI_SOUND_SCHEMA
+#if HAS_LOMIRI_SCHEMAS
unowned string decibel_key = _shared_settings.get_boolean(ALLOW_AMP_KEY)
? AMP_dB_KEY
: NORMAL_dB_KEY;
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index d0c0ac6..3e03a20 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -33,9 +33,11 @@ add_custom_target (
# and help the tests to find that file by setting -DSCHEMA_DIR
set (XDG_DATA_DIRS "${CMAKE_CURRENT_BINARY_DIR}/gsettings-schemas")
set (SCHEMA_DIR "${XDG_DATA_DIRS}/glib-2.0/schemas")
-if (EXISTS /usr/share/glib-2.0/schemas/com.lomiri.sound.gschema.xml)
- add_definitions ( -DHAS_LOMIRI_SOUND_SCHEMA )
+
+if(LOMIRI_SCHEMAS_FOUND)
+ add_definitions ( -DHAS_LOMIRI_SCHEMAS )
endif()
+
add_definitions(-DSCHEMA_DIR="${SCHEMA_DIR}")
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas
OUTPUT_VARIABLE COMPILE_SCHEMA_EXECUTABLE
@@ -322,7 +324,7 @@ add_test(indicator-test
indicator-test
)
-if (LOMIRI_API_FOUND AND EXISTS "/usr/share/glib-2.0/schemas/com.lomiri.sound.gschema.xml")
+if (LOMIRI_API_FOUND AND LOMIRI_SCHEMAS_FOUND)
add_subdirectory(integration)
endif()
add_subdirectory(dbus-types)
diff --git a/tests/dbus-types/CMakeLists.txt b/tests/dbus-types/CMakeLists.txt
index 1b6faed..9d7d3a2 100644
--- a/tests/dbus-types/CMakeLists.txt
+++ b/tests/dbus-types/CMakeLists.txt
@@ -14,7 +14,7 @@ set(dbusinterface_accounts_xml "org.freedesktop.Accounts.xml")
set_source_files_properties(${dbusinterface_accounts_xml} PROPERTIES
CLASSNAME AccountsInterface)
-if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml")
+if(LOMIRI_SCHEMAS_FOUND)
set_source_files_properties("com.lomiri.AccountsService.Sound.xml" PROPERTIES
CLASSNAME AccountsSoundInterface)
endif()
@@ -38,7 +38,7 @@ qt5_add_dbus_interface(interface_files ${dbusinterface_streamrestore_xml} stream
qt5_add_dbus_interface(interface_files ${dbusinterface_properties_xml} dbus_properties_interface)
qt5_add_dbus_interface(interface_files ${dbusinterface_accounts_xml} dbus_accounts_interface)
-if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml")
+if(LOMIRI_SCHEMAS_FOUND)
qt5_add_dbus_interface("com.lomiri.AccountsService.Sound.xml" dbus_accountssound_interface)
endif()
diff --git a/tests/integration/indicator-sound-test-base.cpp b/tests/integration/indicator-sound-test-base.cpp
index 3217764..f46d57f 100644
--- a/tests/integration/indicator-sound-test-base.cpp
+++ b/tests/integration/indicator-sound-test-base.cpp
@@ -179,7 +179,7 @@ bool IndicatorSoundTestBase::clearGSettingsPlayers()
bool IndicatorSoundTestBase::resetAllowAmplifiedVolume()
{
-#if HAS_LOMIRI_SOUND_SCHEMA
+#if HAS_LOMIRI_SCHEMAS
QProcess proc;
proc.start("gsettings", QStringList()
diff --git a/tests/service-mocks/CMakeLists.txt b/tests/service-mocks/CMakeLists.txt
index f604986..87221da 100644
--- a/tests/service-mocks/CMakeLists.txt
+++ b/tests/service-mocks/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml")
+if(LOMIRI_SCHEMAS_FOUND)
add_subdirectory(accounts-mock)
endif()
add_subdirectory(media-player-mpris-mock)