From 8e0988139aa78db19ad41594b7935016399fc44f Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Wed, 24 Nov 2021 09:58:10 +0100 Subject: Check for lomiri-schemas package instead of individual files --- CMakeLists.txt | 7 +------ src/CMakeLists.txt | 4 ++-- src/main.cpp | 6 +++--- src/snap.cpp | 2 +- tests/CMakeLists.txt | 4 ++-- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fc630f..3370b06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,12 +81,7 @@ if(URLDISPATCHER_FOUND) endif() pkg_check_modules(LOMIRI_SOUNDS lomiri-sounds) - -if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.touch.AccountsService.Sound.xml") - set (HAS_LOMIRI_ACCTSERVICE_SOUND ON) -else() - set (HAS_LOMIRI_ACCTSERVICE_SOUND OFF) -endif() +pkg_check_modules(LOMIRI_SCHEMAS lomiri-schemas) ## ## custom targets diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9cde5fe..d6d6844 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -47,11 +47,11 @@ set(SERVICE_GENERATED_SOURCES) add_gdbus_codegen(SERVICE_GENERATED_SOURCES dbus-alarm-properties org.ayatana.indicator ${CMAKE_SOURCE_DIR}/data/org.ayatana.indicator.datetime.AlarmProperties.xml) -if(HAS_LOMIRI_ACCTSERVICE_SOUND) +if(LOMIRI_SCHEMAS_FOUND) add_gdbus_codegen(SERVICE_GENERATED_SOURCES dbus-accounts-sound com.lomiri.touch /usr/share/accountsservice/interfaces/com.lomiri.touch.AccountsService.Sound.xml) - add_definitions (-DHAS_LOMIRI_ACCTSERVICE_SOUND) + add_definitions (-DHAS_LOMIRI_SCHEMAS) endif() # add warnings/coverage info on handwritten files diff --git a/src/main.cpp b/src/main.cpp index 613f700..0dc7198 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,7 +32,7 @@ #include #include #include -#ifdef HAS_LOMIRI_ACCTSERVICE_SOUND +#ifdef HAS_LOMIRI_SCHEMAS #include #endif #include @@ -95,7 +95,7 @@ namespace return state; } -#ifdef HAS_LOMIRI_ACCTSERVICE_SOUND +#ifdef HAS_LOMIRI_SCHEMAS std::shared_ptr create_simple_alarm_queue(const std::shared_ptr& clock, const std::shared_ptr& snooze_planner, const std::shared_ptr& engine, @@ -149,7 +149,7 @@ main(int /*argc*/, char** /*argv*/) auto actions = std::make_shared(state); MenuFactory factory(actions, state); -#ifdef HAS_LOMIRI_ACCTSERVICE_SOUND +#ifdef HAS_LOMIRI_SCHEMAS // set up the snap decisions auto snooze_planner = std::make_shared(state->settings, state->clock); auto notification_engine = std::make_shared("ayatana-indicator-datetime-service"); diff --git a/src/snap.cpp b/src/snap.cpp index 45cd299..e306dea 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -19,7 +19,7 @@ * Robert Tari */ -#ifdef HAS_LOMIRI_ACCTSERVICE_SOUND +#ifdef HAS_LOMIRI_SCHEMAS #include "dbus-accounts-sound.h" #include diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3eb0b8a..7a6a301 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -44,7 +44,7 @@ function(add_test_by_name name) target_link_libraries (${TEST_NAME} indicatordatetimeservice ${DBUSTEST_LIBRARIES} ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} ${URLDISPATCHER_LIBRARIES}) endfunction() add_test_by_name(test-datetime) -if(HAS_LOMIRI_ACCTSERVICE_SOUND) +if(LOMIRI_SCHEMAS_FOUND) if(LOMIRI_SOUNDS_FOUND) add_test_by_name(test-sound) add_test_by_name(test-notification) @@ -74,7 +74,7 @@ add_test_by_name(test-settings) add_test_by_name(test-timezone-timedated) add_test_by_name(test-utils) -if(HAS_LOMIRI_ACCTSERVICE_SOUND) +if(LOMIRI_SCHEMAS_FOUND) set (TEST_NAME manual-test-snap) set (COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME}) add_executable (${TEST_NAME} ${TEST_NAME}.cpp) -- cgit v1.2.3