diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-11-28 08:47:03 +0000 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-11-28 08:51:08 +0000 |
commit | de76813c8421fd900e0d57038d28e8be693e33be (patch) | |
tree | d99b90ed99e1c42f0bd7ad4bef35770bce521720 | |
parent | 22d45854cb2c7a6374d6dfc631d684d01fcc9063 (diff) | |
download | ayatana-indicator-display-de76813c8421fd900e0d57038d28e8be693e33be.tar.gz ayatana-indicator-display-de76813c8421fd900e0d57038d28e8be693e33be.tar.bz2 ayatana-indicator-display-de76813c8421fd900e0d57038d28e8be693e33be.zip |
Fork from Ubuntus' indicator-display project.
-rw-r--r-- | .bzr-builddeb/default.conf | 2 | ||||
-rw-r--r-- | .bzrignore | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | data/CMakeLists.txt | 28 | ||||
-rw-r--r-- | data/ayatana-indicator-display.conf.in (renamed from data/indicator-display.conf.in) | 0 | ||||
-rw-r--r-- | data/ayatana-indicator-display.override (renamed from data/indicator-display.override) | 0 | ||||
-rw-r--r-- | data/ayatana-indicator-display.service.in (renamed from data/indicator-display.service.in) | 0 | ||||
-rw-r--r-- | data/org.ayatana.display.gschema.xml | 24 | ||||
-rw-r--r-- | data/org.ayatana.indicator.rotation_lock (renamed from data/com.canonical.indicator.rotation_lock) | 0 | ||||
-rw-r--r-- | debian/changelog | 9 | ||||
-rw-r--r-- | debian/control | 35 | ||||
-rw-r--r-- | debian/copyright | 7 | ||||
-rw-r--r-- | debian/indicator-display.maintscript | 1 | ||||
-rwxr-xr-x | debian/rules | 14 | ||||
-rw-r--r-- | po/LINGUAS | 117 | ||||
-rw-r--r-- | po/POTFILES.in | 9 | ||||
-rw-r--r-- | po/ayatana-indicator-display.pot (renamed from po/indicator-display.pot) | 0 | ||||
-rw-r--r-- | src/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/dbus-names.h | 7 | ||||
-rw-r--r-- | src/exporter.cpp | 8 | ||||
-rw-r--r-- | src/greeter.cpp | 28 | ||||
-rw-r--r-- | src/greeter.h | 12 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/rotation-lock.cpp | 6 | ||||
-rw-r--r-- | tests/unit/CMakeLists.txt | 32 | ||||
-rw-r--r-- | tests/unit/greeter-test.cpp | 12 | ||||
-rw-r--r-- | tests/utils/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/utils/mock-greeter.py (renamed from tests/utils/mock-unity-greeter.py) | 10 | ||||
-rwxr-xr-x | update-po.sh | 29 | ||||
-rwxr-xr-x | update-pot.sh | 19 |
30 files changed, 340 insertions, 86 deletions
diff --git a/.bzr-builddeb/default.conf b/.bzr-builddeb/default.conf deleted file mode 100644 index 6c96a98..0000000 --- a/.bzr-builddeb/default.conf +++ /dev/null @@ -1,2 +0,0 @@ -[BUILDDEB] -split = True diff --git a/.bzrignore b/.bzrignore deleted file mode 100644 index 4f05230..0000000 --- a/.bzrignore +++ /dev/null @@ -1,3 +0,0 @@ -build/ -po/Makefile.in.in -po/POTFILES.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 27a074b..ce70069 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,10 @@ -project(indicator-display LANGUAGES C CXX) +project(ayatana-indicator-display LANGUAGES C CXX) cmake_minimum_required(VERSION 2.8.9) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) set(PACKAGE ${CMAKE_PROJECT_NAME}) -set(GETTEXT_PACKAGE indicator-display) +set(GETTEXT_PACKAGE "ayatana-indicator-display") add_definitions( -DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}" -DGNOMELOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}" @@ -82,4 +82,3 @@ ENABLE_COVERAGE_REPORT( TESTS ${COVERAGE_TEST_TARGETS} FILTER /usr/include ${CMAKE_BINARY_DIR}/* ) - diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index d74ca48..7f10bac 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,3 +1,5 @@ +find_package(GSettings) + ## ## Upstart Job File ## @@ -19,13 +21,19 @@ install (FILES "${UPSTART_JOB_FILE}" DESTINATION "${UPSTART_JOBS_DIR}") ## +## GSettings +## + +if(NOT EXISTS /usr/share/glib-2.0/schemas/com.ubuntu.touch.system.gschema.xml) + add_schema ("org.ayatana.display.gschema.xml") +endif() + +## ## Systemd Unit File ## # where to install -# Uncomment when we drop Vivid -# pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir) -set (SYSTEMD_USER_DIR "/usr/lib/systemd/user") +pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir) message (STATUS "${SYSTEMD_USER_DIR} is the systemd user unit file install dir") set (SYSTEMD_USER_NAME "${CMAKE_PROJECT_NAME}.service") @@ -51,15 +59,15 @@ install (FILES "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.override" DESTINATION "${UPSTART_SYSTEMD_OVERRIDE_DIR}") ## -## Unity Indicator File +## Ayatana Indicator File ## # where to install -set (UNITY_INDICATOR_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/unity/indicators") -message (STATUS "${UNITY_INDICATOR_DIR} is the Unity Indicator install dir") +set (AYATANA_INDICATOR_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/ayatana/indicators") +message (STATUS "${AYATANA_INDICATOR_DIR} is the Ayatana Indicator install dir") -set (UNITY_INDICATOR_NAME "com.canonical.indicator.rotation_lock") -set (UNITY_INDICATOR_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${UNITY_INDICATOR_NAME}") +set (AYATANA_INDICATOR_NAME "org.ayatana.indicator.rotation_lock") +set (AYATANA_INDICATOR_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${AYATANA_INDICATOR_NAME}") -install (FILES "${UNITY_INDICATOR_FILE}" - DESTINATION "${UNITY_INDICATOR_DIR}") +install (FILES "${AYATANA_INDICATOR_FILE}" + DESTINATION "${AYATANA_INDICATOR_DIR}") diff --git a/data/indicator-display.conf.in b/data/ayatana-indicator-display.conf.in index 2fbabc4..2fbabc4 100644 --- a/data/indicator-display.conf.in +++ b/data/ayatana-indicator-display.conf.in diff --git a/data/indicator-display.override b/data/ayatana-indicator-display.override index 2905494..2905494 100644 --- a/data/indicator-display.override +++ b/data/ayatana-indicator-display.override diff --git a/data/indicator-display.service.in b/data/ayatana-indicator-display.service.in index 8245917..8245917 100644 --- a/data/indicator-display.service.in +++ b/data/ayatana-indicator-display.service.in diff --git a/data/org.ayatana.display.gschema.xml b/data/org.ayatana.display.gschema.xml new file mode 100644 index 0000000..70d6e46 --- /dev/null +++ b/data/org.ayatana.display.gschema.xml @@ -0,0 +1,24 @@ +<schemalist gettext-domain="ayatana-indicator-display"> + <enum id="org.ayatana.display.ScreenOrientation"> + <value value="0" nick="none"/> + <value value="1" nick="PrimaryOrientation"/> + <value value="2" nick="LandscapeOrientation"/> + <value value="3" nick="PortraitOrientation"/> + <value value="4" nick="InvertedLandscapeOrientation"/> + <value value="5" nick="InvertedPortraitOrientation"/> + </enum> + <schema id="org.ayatana.display" path="/org/ayatana/display/"> + <key name="rotation-lock" type="b"> + <default>false</default> + <summary>Lock rotation</summary> + <description> + Lock automatic display rotation. + </description> + </key> + <key name="orientation-lock" enum="org.ayatana.display.ScreenOrientation"> + <default>"none"</default> + <summary>Orientation lock</summary> + <description>Locks orientation to a specific value.</description> + </key> + </schema> +</schemalist> diff --git a/data/com.canonical.indicator.rotation_lock b/data/org.ayatana.indicator.rotation_lock index 7740db7..7740db7 100644 --- a/data/com.canonical.indicator.rotation_lock +++ b/data/org.ayatana.indicator.rotation_lock diff --git a/debian/changelog b/debian/changelog index 8c8e124..e75a952 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +ayatana-indicator-display (0.2-0) UNRELEASED; urgency=medium + + * Fork ayatana-indicator-datetime from Ubuntu's indicator-display. + + * Upstream-provided Debian package for ayatana-indicator-display. + See upstream ChangeLog for recent changes. + + -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Fri, 24 Nov 2017 10:04:00 +0100 + indicator-display (0.1+17.04.20170210-0ubuntu1) zesty; urgency=medium * Remove old autostart files. diff --git a/debian/control b/debian/control index 7871d0f..84930d7 100644 --- a/debian/control +++ b/debian/control @@ -1,8 +1,7 @@ -Source: indicator-display -Section: misc +Source: ayatana-indicator-display +Section: x11 Priority: optional -Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> -XSBC-Original-Maintainer: Charles Kerr <charles.kerr@canonical.com> +Maintainer: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Build-Depends: cmake, cmake-extras (>= 0.10), dbus, @@ -12,32 +11,28 @@ Build-Depends: cmake, # for coverage reports gcovr, lcov, +# Ubuntu B-Ds, if on Ubuntu + gsettings-ubuntu-schemas (>= 0.0.2+14.10.20140813) | hello, # for tests - qt5-default, qtbase5-dev, libqtdbusmock1-dev, libqtdbustest1-dev, cppcheck, googletest | google-mock (>= 1.6.0+svn437), - gsettings-ubuntu-schemas (>= 0.0.2+14.10.20140813), # for packaging debhelper (>= 9), - dh-translations, # for systemd unit - systemd, -Standards-Version: 3.9.5 -Homepage: http://launchpad.net/indicator-display/ -X-Ubuntu-Use-Langpack: yes -# If you aren't a member of ~indicator-applet-developers but need to upload -# packaging changes, just go ahead. ~indicator-applet-developers will notice and -# sync up the code again. -Vcs-Bzr: https://code.launchpad.net/~indicator-applet-developers/indicator-display/trunk.14.10 + systemd [linux-any], +Standards-Version: 4.1.1 +Homepage: http://github.com/AyatanaIndicators/ayatana-indicator-display +Vcs-Git: http://github.com/AyatanaIndicators/ayatana-indicator-display +Vcs-Browser: http://github.com/AyatanaIndicators/ayatana-indicator-display -Package: indicator-display +Package: ayatana-indicator-display Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, - gsettings-ubuntu-schemas (>= 0.0.2+14.10.20140813), - indicator-common, -Description: Collection of small indicators - Indicators too small to merit separate codebases, such as Rotation Lock + ayatana-indicator-common, +Description: Ayatana Indicator for Display configuration + This Ayatana Indicator is designed to be placed on the right side of a + panel and give the user easy control for changing their display settings. diff --git a/debian/copyright b/debian/copyright index 7809d7c..54b1359 100644 --- a/debian/copyright +++ b/debian/copyright @@ -5,6 +5,13 @@ Source: http://launchpad.net/indicator-display Files: * Copyright: 2014, Canonical Ltd. License: GPL-3 + +Files: debian/* +Copyright: 2014, Canonical Ltd. + 2017, Mike Gabriel <mike.gabriel@das-netzwerkteam.de> +License: GPL-3 + +License: GPL-3 This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 3 of the License. diff --git a/debian/indicator-display.maintscript b/debian/indicator-display.maintscript deleted file mode 100644 index 6013bd1..0000000 --- a/debian/indicator-display.maintscript +++ /dev/null @@ -1 +0,0 @@ -rm_conffile /etc/xdg/autostart/indicator-display.desktop 0.1+17.04.20170210-0ubuntu1~ diff --git a/debian/rules b/debian/rules index 9bd9847..4ff937e 100755 --- a/debian/rules +++ b/debian/rules @@ -1,5 +1,17 @@ #!/usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export DPKG_GENSYMBOLS_CHECK_LEVEL=4 + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/buildflags.mk %: - dh $@ --parallel --with translations + dh $@ --parallel +get-orig-source: + uscan --noconf --force-download --rename --download-current-version --destdir=.. diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..8f5caec --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1,117 @@ +af +am +an +ar +ast +az +bem +be +bg +bn +bo +br +bs +ca +ca@valencia +ce +ckb +co +crh +cs +cv +cy +da +de +el +en_AU +en_CA +en_GB +eo +es +et +eu +fa +fil +fi +fo +fr_CA +fr +frp +fy +ga +gd +gl +gu +he +hi +hr +ht +hu +hy +ia +id +is +it +ja +ka +kk +kl +km +kn +ko +ku +kw +ky +la +lb +lo +lt +lv +mg +mhr +mi +ml +mr +ms +my +nb +ne +nl +nn +oc +os +pa +pl +ps +pt_BR +pt +ro +ru +sa +sc +sd +se +shn +si +sk +sl +sq +sr +sv +sw +szl +ta +te +tg +th +ti +tr +ug +uk +ur +uz +vi +wae +zh_CN +zh_HK +zh_TW diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..8d88dd5 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,9 @@ +src/adbd-client.cpp +src/exporter.cpp +src/greeter.cpp +src/indicator.cpp +src/main.cpp +src/rotation-lock.cpp +src/usb-manager.cpp +src/usb-monitor.cpp +src/usb-snap.cpp diff --git a/po/indicator-display.pot b/po/ayatana-indicator-display.pot index 26488a3..26488a3 100644 --- a/po/indicator-display.pot +++ b/po/ayatana-indicator-display.pot diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 060071d..eb736c8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,9 @@ - add_definitions(-DG_LOG_DOMAIN="${CMAKE_PROJECT_NAME}") +if(EXISTS "/usr/share/glib-2.0/schemas/com.ubuntu.sound.gschema.xml") + add_definitions( -DHAS_UBUNTU_TOUCH_SCHEMA ) +endif() + add_compile_options( ${CXX_WARNING_ARGS} ) @@ -34,4 +37,3 @@ install( ${SERVICE_EXEC} RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_PKGLIBEXECDIR} ) - diff --git a/src/dbus-names.h b/src/dbus-names.h index b31098a..aa7ef2a 100644 --- a/src/dbus-names.h +++ b/src/dbus-names.h @@ -39,11 +39,11 @@ namespace DBusNames } } - namespace UnityGreeter + namespace Greeter { - static constexpr char const * NAME = "com.canonical.UnityGreeter"; + static constexpr char const * NAME = "org.ayatana.Greeter"; static constexpr char const * PATH = "/"; - static constexpr char const * INTERFACE = "com.canonical.UnityGreeter"; + static constexpr char const * INTERFACE = "org.ayatana.Greeter"; } namespace Properties @@ -57,4 +57,3 @@ namespace DBusNames } } } - diff --git a/src/exporter.cpp b/src/exporter.cpp index 252bbdf..b415a81 100644 --- a/src/exporter.cpp +++ b/src/exporter.cpp @@ -26,7 +26,7 @@ public: explicit Impl(const std::shared_ptr<Indicator>& indicator): m_indicator(indicator) { - auto bus_name = g_strdup_printf("com.canonical.indicator.%s", indicator->name()); + auto bus_name = g_strdup_printf("org.ayatana.indicator.%s", indicator->name()); m_own_id = g_bus_own_name(G_BUS_TYPE_SESSION, bus_name, G_BUS_NAME_OWNER_FLAGS_NONE, @@ -94,7 +94,7 @@ private: // export the actions error = nullptr; - object_path = g_strdup_printf("/com/canonical/indicator/%s", indicator->name()); + object_path = g_strdup_printf("/org/ayatana/indicator/%s", indicator->name()); id = g_dbus_connection_export_action_group(m_bus, object_path, G_ACTION_GROUP(indicator->action_group()), @@ -151,7 +151,7 @@ private: // build the header menu auto detailed_action = g_strdup_printf("indicator.%s", action_name.c_str()); GMenuItem* header = g_menu_item_new(nullptr, detailed_action); - g_menu_item_set_attribute(header, "x-canonical-type", "s", "com.canonical.indicator.root"); + g_menu_item_set_attribute(header, "x-canonical-type", "s", "org.ayatana.indicator.root"); g_menu_item_set_submenu(header, profile->menu_model().get()); g_free(detailed_action); @@ -161,7 +161,7 @@ private: g_object_unref(header); // export the menu - auto object_path = g_strdup_printf("/com/canonical/indicator/%s/%s", + auto object_path = g_strdup_printf("/org/ayatana/indicator/%s/%s", indicator->name(), profile->name().c_str()); GError* error = nullptr; diff --git a/src/greeter.cpp b/src/greeter.cpp index 3d0f347..02eb0be 100644 --- a/src/greeter.cpp +++ b/src/greeter.cpp @@ -22,7 +22,7 @@ #include <gio/gio.h> -class UnityGreeter::Impl +class Greeter::Impl { public: @@ -72,7 +72,7 @@ private: const auto watcher_id = g_bus_watch_name_on_connection( bus, - DBusNames::UnityGreeter::NAME, + DBusNames::Greeter::NAME, G_BUS_NAME_WATCHER_FLAGS_AUTO_START, on_greeter_appeared, on_greeter_vanished, @@ -81,11 +81,11 @@ private: const auto subscription_id = g_dbus_connection_signal_subscribe( bus, - DBusNames::UnityGreeter::NAME, + DBusNames::Greeter::NAME, DBusNames::Properties::INTERFACE, DBusNames::Properties::PropertiesChanged::NAME, - DBusNames::UnityGreeter::PATH, - DBusNames::UnityGreeter::INTERFACE, + DBusNames::Greeter::PATH, + DBusNames::Greeter::INTERFACE, G_DBUS_SIGNAL_FLAGS_NONE, on_properties_changed_signal, gself, @@ -114,11 +114,11 @@ private: g_dbus_connection_call( bus, - DBusNames::UnityGreeter::NAME, - DBusNames::UnityGreeter::PATH, + DBusNames::Greeter::NAME, + DBusNames::Greeter::PATH, DBusNames::Properties::INTERFACE, "Get", - g_variant_new("(ss)", DBusNames::UnityGreeter::INTERFACE, "IsActive"), + g_variant_new("(ss)", DBusNames::Greeter::INTERFACE, "IsActive"), G_VARIANT_TYPE("(v)"), G_DBUS_CALL_FLAGS_NONE, -1, @@ -171,7 +171,7 @@ private: auto self = static_cast<Impl*>(gself); g_return_if_fail(!g_strcmp0(sender_name, self->m_owner.c_str())); - g_return_if_fail(!g_strcmp0(object_path, DBusNames::UnityGreeter::PATH)); + g_return_if_fail(!g_strcmp0(object_path, DBusNames::Greeter::PATH)); g_return_if_fail(!g_strcmp0(interface_name, DBusNames::Properties::INTERFACE)); g_return_if_fail(!g_strcmp0(signal_name, DBusNames::Properties::PropertiesChanged::NAME)); g_return_if_fail(g_variant_is_of_type(parameters, G_VARIANT_TYPE(DBusNames::Properties::PropertiesChanged::ARGS_VARIANT_TYPE))); @@ -193,19 +193,19 @@ private: **** ***/ -Greeter::Greeter() =default; +BaseGreeter::BaseGreeter() =default; -Greeter::~Greeter() =default; +BaseGreeter::~BaseGreeter() =default; -UnityGreeter::UnityGreeter(): +Greeter::Greeter(): impl{new Impl{}} { } -UnityGreeter::~UnityGreeter() =default; +Greeter::~Greeter() =default; core::Property<Greeter::State>& -UnityGreeter::state() +Greeter::state() { return impl->state(); } diff --git a/src/greeter.h b/src/greeter.h index f3012f6..0bfe026 100644 --- a/src/greeter.h +++ b/src/greeter.h @@ -24,11 +24,11 @@ #include <memory> #include <string> -class Greeter +class BaseGreeter { public: - Greeter(); - virtual ~Greeter(); + BaseGreeter(); + virtual ~BaseGreeter(); enum class State { UNAVAILABLE, INACTIVE, ACTIVE }; static inline const char* state_str(const State& state) { @@ -39,11 +39,11 @@ static inline const char* state_str(const State& state) { }; -class UnityGreeter: public Greeter +class Greeter: public BaseGreeter { public: - UnityGreeter(); - virtual ~UnityGreeter(); + Greeter(); + virtual ~Greeter(); core::Property<State>& state() override; protected: diff --git a/src/main.cpp b/src/main.cpp index 52cdd58..e061871 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -63,7 +63,7 @@ main(int /*argc*/, char** /*argv*/) static constexpr char const * ADB_SOCKET_PATH {"/dev/socket/adbd"}; static constexpr char const * PUBLIC_KEYS_FILENAME {"/data/misc/adb/adb_keys"}; auto usb_monitor = std::make_shared<GUDevUsbMonitor>(); - auto greeter = std::make_shared<UnityGreeter>(); + auto greeter = std::make_shared<Greeter>(); UsbManager usb_manager {ADB_SOCKET_PATH, PUBLIC_KEYS_FILENAME, usb_monitor, greeter}; // let's go! diff --git a/src/rotation-lock.cpp b/src/rotation-lock.cpp index 88c7e1b..9af5f8e 100644 --- a/src/rotation-lock.cpp +++ b/src/rotation-lock.cpp @@ -123,7 +123,7 @@ private: menu = g_menu_new(); menu_item = g_menu_item_new(_("Rotation Lock"), "indicator.rotation-lock"); - g_menu_item_set_attribute(menu_item, "x-canonical-type", "s", "com.canonical.indicator.switch"); + g_menu_item_set_attribute(menu_item, "x-canonical-type", "s", "org.ayatana.indicator.switch"); g_menu_append_item(menu, menu_item); g_object_unref(menu_item); @@ -144,7 +144,11 @@ private: **** ***/ +#ifdef HAS_UBUNTU_TOUCH_SCHEMA static constexpr char const * m_schema_name {"com.ubuntu.touch.system"}; +#else + static constexpr char const * m_schema_name {"org.ayatana.display"}; +#endif static constexpr char const * m_rotation_lock_icon_name {"orientation-lock"}; GSettings* m_settings = nullptr; GSimpleActionGroup* m_action_group = nullptr; diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 87fab3a..fda43be 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -1,3 +1,31 @@ +########################### +# GSettings Schema +########################### + +# build the necessary schemas +set_directory_properties (PROPERTIES + ADDITIONAL_MAKE_CLEAN_FILES gschemas.compiled) +set_source_files_properties (gschemas.compiled GENERATED) + +# GSettings: +# compile the org.ayatana.display schema into a gschemas.compiled file in this directory, +# 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.ubuntu.touch.system.gschema.xml) + set (DISPLAY_SCHEMA /usr/share/glib-2.0/schemas/com.ubuntu.touch.system.gschema.xml) +else() + set (DISPLAY_SCHEMA ${CMAKE_SOURCE_DIR}/data/org.ayatana.display.gschema.xml) +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 + OUTPUT_STRIP_TRAILING_WHITESPACE) +add_custom_command (OUTPUT gschemas.compiled + COMMAND mkdir -p ${SCHEMA_DIR} + COMMAND cp -f ${DISPLAY_SCHEMA} ${SCHEMA_DIR} + COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR}) + set(SERVICE_LINK_LIBRARIES ${SERVICE_LIB} ${SERVICE_DEPS_LIBRARIES} @@ -15,13 +43,13 @@ set(TEST_LINK_LIBRARIES ) add_definitions( - -DGREETER_TEMPLATE="${CMAKE_SOURCE_DIR}/tests/utils/mock-unity-greeter.py" + -DGREETER_TEMPLATE="${CMAKE_SOURCE_DIR}/tests/utils/mock-greeter.py" ) function(add_test_by_name name) set(TEST_NAME ${name}) set(COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME} PARENT_SCOPE) - add_executable (${TEST_NAME} ${TEST_NAME}.cpp) + add_executable (${TEST_NAME} ${TEST_NAME}.cpp gschemas.compiled) add_test(${TEST_NAME} ${TEST_NAME}) set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT ${CTEST_ENVIRONMENT}) target_link_libraries(${TEST_NAME} ${SERVICE_LINK_LIBRARIES} ${TEST_LINK_LIBRARIES} ${THREAD_LINK_LIBRARIES}) diff --git a/tests/unit/greeter-test.cpp b/tests/unit/greeter-test.cpp index bfa88e8..61880f6 100644 --- a/tests/unit/greeter-test.cpp +++ b/tests/unit/greeter-test.cpp @@ -70,7 +70,7 @@ protected: // set a watcher to look for our mock greeter to appear bool owned {}; QDBusServiceWatcher watcher( - DBusNames::UnityGreeter::NAME, + DBusNames::Greeter::NAME, m_dbus_runner->sessionConnection() ); QObject::connect( @@ -83,7 +83,7 @@ protected: QVariantMap parameters; parameters["IsActive"] = QVariant(is_active); m_dbus_mock->registerTemplate( - DBusNames::UnityGreeter::NAME, + DBusNames::Greeter::NAME, GREETER_TEMPLATE, parameters, QDBusConnection::SessionBus @@ -116,7 +116,7 @@ TEST_F(GreeterFixture, ActiveServiceStartsBeforeWatcher) start_greeter_service(is_active); - UnityGreeter greeter; + Greeter greeter; ASSERT_PROPERTY_EQ_EVENTUALLY(expected, greeter.state()); } @@ -126,7 +126,7 @@ TEST_F(GreeterFixture, WatcherStartsBeforeActiveService) constexpr bool is_active {true}; constexpr Greeter::State expected {Greeter::State::ACTIVE}; - UnityGreeter greeter; + Greeter greeter; start_greeter_service(is_active); @@ -140,7 +140,7 @@ TEST_F(GreeterFixture, InactiveServiceStartsBeforeWatcher) start_greeter_service(is_active); - UnityGreeter greeter; + Greeter greeter; ASSERT_PROPERTY_EQ_EVENTUALLY(expected, greeter.state()); } @@ -150,7 +150,7 @@ TEST_F(GreeterFixture, WatcherStartsBeforeInactiveService) constexpr bool is_active {false}; constexpr Greeter::State expected {Greeter::State::INACTIVE}; - UnityGreeter greeter; + Greeter greeter; start_greeter_service(is_active); diff --git a/tests/utils/CMakeLists.txt b/tests/utils/CMakeLists.txt index e458c82..fd82b79 100644 --- a/tests/utils/CMakeLists.txt +++ b/tests/utils/CMakeLists.txt @@ -14,4 +14,3 @@ qt5_use_modules( Core DBus ) - diff --git a/tests/utils/mock-unity-greeter.py b/tests/utils/mock-greeter.py index 70fb791..dc48a6d 100644 --- a/tests/utils/mock-unity-greeter.py +++ b/tests/utils/mock-greeter.py @@ -1,4 +1,4 @@ -'''unity greeter mock template +'''desktop greeter mock template Very basic template that just mocks the greeter is-active flag ''' @@ -19,17 +19,17 @@ import os from dbusmock import MOCK_IFACE, mockobject -BUS_NAME = 'com.canonical.UnityGreeter' +BUS_NAME = 'org.ayatana.Greeter' MAIN_OBJ = '/' -MAIN_IFACE = 'com.canonical.UnityGreeter' +MAIN_IFACE = 'org.ayatana.Greeter' SYSTEM_BUS = False def load(mock, parameters): mock.AddMethods( MAIN_IFACE, [ - ('HideGreeter', '', '', 'self.Set("com.canonical.UnityGreeter", "IsActive", False)'), - ('ShowGreeter', '', '', 'self.Set("com.canonical.UnityGreeter", "IsActive", True)') + ('HideGreeter', '', '', 'self.Set("org.ayatana.Greeter", "IsActive", False)'), + ('ShowGreeter', '', '', 'self.Set("org.ayatana.Greeter", "IsActive", True)') ] ) mock.AddProperties( diff --git a/update-po.sh b/update-po.sh new file mode 100755 index 0000000..81a9dc5 --- /dev/null +++ b/update-po.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -x + +# Copyright (C) 2017 by Mike Gabriel <mike.gabriel@das-netzwerkteam.de> +# +# This package is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 3 of the License. +# +# This package is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/> + +GETTEXT_DOMAIN=$(cat CMakeLists.txt | grep 'set.*(.*GETTEXT_PACKAGE' | sed -r -e 's/.*\"([^"]+)\"\)/\1/') + +cd po/ +cat LINGUAS | while read lingua; do + if [ ! -e ${lingua}.po ]; then + msginit --input=${GETTEXT_DOMAIN}.pot --locale=${lingua} --no-translator --output-file=$lingua.po + else + intltool-update --gettext-package ${GETTEXT_DOMAIN} $(basename ${lingua}) + fi +done +cd - 1>/dev/null diff --git a/update-pot.sh b/update-pot.sh new file mode 100755 index 0000000..f4dcda8 --- /dev/null +++ b/update-pot.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright (C) 2017 by Mike Gabriel <mike.gabriel@das-netzwerkteam.de> +# +# This package is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 3 of the License. +# +# This package is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/> + +GETTEXT_DOMAIN=$(cat CMakeLists.txt | grep 'set.*(.*GETTEXT_PACKAGE' | sed -r -e 's/.*\"([^"]+)\"\)/\1/') + +cd po/ && intltool-update --gettext-package ${GETTEXT_DOMAIN} --pot |