diff options
-rw-r--r-- | .build.yml | 16 | ||||
-rw-r--r-- | CMakeLists.txt | 32 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/notifier.c | 12 |
4 files changed, 42 insertions, 20 deletions
@@ -33,6 +33,7 @@ requires: - cmake-extras - intltool # - libayatana-common-dev +# - lomiri-schemas - liblomiri-url-dispatcher-dev - gobject-introspection - libgirepository1.0-dev @@ -123,6 +124,17 @@ before_scripts: - make install - cd - - rm -Rf libayatana-common-build/ + - + - cd ${START_DIR} + - if [ ! -d lomiri-schemas-build ]; then + - git clone --depth 1 https://gitlab.com/ubports/core/lomiri-schemas.git lomiri-schemas-build + - fi + - cd lomiri-schemas-build + - cmake . -DCMAKE_INSTALL_PREFIX=/usr + - make + - make install + - cd - + - rm -Rf lomiri-schemas-build/ build_scripts: - if [ ${DISTRO_NAME} == "debian" ];then @@ -130,7 +142,9 @@ build_scripts: - fi - - if [ -e ./CMakeLists.txt ]; then - - if [ ${DISTRO_NAME} == "debian" ] || [ ${DISTRO_NAME} == "ubuntu" ]; then + - if [ ${DISTRO_NAME} == "debian" ]; then + - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON -DENABLE_TESTS=ON -DENABLE_LOMIRI_FEATURES=ON + - elif [ ${DISTRO_NAME} == "ubuntu" ]; then - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON -DENABLE_TESTS=ON - else - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a25fb5..5762fb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,7 @@ set(PACKAGE ${CMAKE_PROJECT_NAME}) option(ENABLE_TESTS "Enable all tests and checks" OFF) option(ENABLE_COVERAGE "Enable coverage reports (includes enabling all tests and checks)" OFF) option(ENABLE_WERROR "Treat all build warnings as errors" OFF) +option(ENABLE_LOMIRI_FEATURES "Build with Lomiri-specific libraries, schemas and media" OFF) if(ENABLE_COVERAGE) set(ENABLE_TESTS ON) @@ -64,20 +65,26 @@ find_package (PkgConfig REQUIRED) include (CheckIncludeFile) include (FindPkgConfig) -pkg_check_modules(SERVICE_DEPS REQUIRED - glib-2.0>=2.36 - gio-2.0>=2.36 - gio-unix-2.0>=2.36 - libnotify>=0.7.6 - libayatana-common>=0.9.1) - -include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS}) +set( + SERVICE_DEPS REQUIRED + glib-2.0>=2.36 + gio-2.0>=2.36 + gio-unix-2.0>=2.36 + libnotify>=0.7.6 + libayatana-common>=0.9.1 +) -pkg_check_modules(LOMIRI_SCHEMAS lomiri-schemas) +if (ENABLE_LOMIRI_FEATURES) + list ( + APPEND + SERVICE_DEPS + lomiri-schemas + ) + add_definitions (-DLOMIRI_FEATURES_ENABLED) +endif () -if(LOMIRI_SCHEMAS_FOUND) - add_definitions ( -DHAS_LOMIRI_SCHEMAS ) -endif() +pkg_check_modules (SERVICE_DEPS REQUIRED ${SERVICE_DEPS}) +include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS}) ## ## custom targets @@ -119,3 +126,4 @@ endif () message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}") message(STATUS "Unit tests: ${ENABLE_TESTS}") message(STATUS "Build with -Werror: ${ENABLE_WERROR}") +message(STATUS "Build with Lomiri features: ${ENABLE_LOMIRI_FEATURES}") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a98f90e..df2fd5d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,7 +28,7 @@ add_gdbus_codegen_with_namespace(SERVICE_GENERATED_SOURCES dbus-testing Dbus ${CMAKE_SOURCE_DIR}/data/org.ayatana.indicator.power.Testing.xml) -if (LOMIRI_SCHEMAS_FOUND) +if (ENABLE_LOMIRI_FEATURES) add_gdbus_codegen_with_namespace(SERVICE_GENERATED_SOURCES dbus-accounts-sound com.lomiri.touch Dbus diff --git a/src/notifier.c b/src/notifier.c index f8eda71..ba30ae5 100644 --- a/src/notifier.c +++ b/src/notifier.c @@ -21,7 +21,7 @@ #include "datafiles.h" -#ifdef HAS_LOMIRI_SCHEMAS +#ifdef LOMIRI_FEATURES_ENABLED #include "dbus-accounts-sound.h" #endif @@ -86,7 +86,7 @@ typedef struct gboolean actions_supported; GCancellable * cancellable; - #ifdef HAS_LOMIRI_SCHEMAS + #ifdef LOMIRI_FEATURES_ENABLED DbusAccountsServiceSound * accounts_service_sound_proxy; gboolean accounts_service_sound_proxy_pending; #endif @@ -147,7 +147,7 @@ get_battery_power_level (IndicatorPowerDevice * battery) **** Sounds ***/ -#ifdef HAS_LOMIRI_SCHEMAS +#ifdef LOMIRI_FEATURES_ENABLED static void on_sound_proxy_ready (GObject * source_object G_GNUC_UNUSED, GAsyncResult * res, @@ -309,7 +309,7 @@ notification_show(IndicatorPowerNotifier * self) if (are_actions_supported(self)) { - #ifdef HAS_LOMIRI_SCHEMAS + #ifdef LOMIRI_FEATURES_ENABLED if (!silent_mode(self)) #endif { @@ -454,7 +454,7 @@ my_dispose (GObject * o) indicator_power_notifier_set_battery (self, NULL); g_clear_object (&p->dbus_battery); - #ifdef HAS_LOMIRI_SCHEMAS + #ifdef LOMIRI_FEATURES_ENABLED g_clear_object (&p->accounts_service_sound_proxy); #endif @@ -491,7 +491,7 @@ indicator_power_notifier_init (IndicatorPowerNotifier * self) if (!instance_count++ && !notify_init(SERVICE_EXEC)) g_critical("Unable to initialize libnotify! Notifications might not be shown."); - #ifdef HAS_LOMIRI_SCHEMAS + #ifdef LOMIRI_FEATURES_ENABLED p->accounts_service_sound_proxy_pending = TRUE; gchar* object_path = g_strdup_printf("/org/freedesktop/Accounts/User%lu", (gulong)getuid()); dbus_accounts_service_sound_proxy_new_for_bus( |