diff options
-rw-r--r-- | po/POTFILES.in | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/main.cpp | 8 | ||||
-rw-r--r-- | src/service.cpp (renamed from src/rotation-lock.cpp) | 28 | ||||
-rw-r--r-- | src/service.h (renamed from src/rotation-lock.h) | 12 | ||||
-rw-r--r-- | tests/unit/rotation-lock-test.cpp | 6 |
6 files changed, 29 insertions, 29 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in index 1cb6f88..1802d8d 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -4,7 +4,7 @@ src/exporter.cpp src/greeter.cpp src/indicator.cpp src/main.cpp -src/rotation-lock.cpp +src/service.cpp src/usb-manager.cpp src/usb-monitor.cpp src/usb-snap.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d66cc1c..f0158ea 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,7 +7,7 @@ add_compile_options( set (SERVICE_LIB_SOURCES exporter.cpp indicator.cpp - rotation-lock.cpp + service.cpp ) if (ENABLE_LOMIRI_FEATURES) diff --git a/src/main.cpp b/src/main.cpp index 03c72c6..49832c6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,6 @@ /* * Copyright 2014 Canonical Ltd. - * Copyright 2022 Robert Tari + * Copyright 2022-2023 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 @@ -20,7 +20,7 @@ */ #include <src/exporter.h> -#include <src/rotation-lock.h> +#include <src/service.h> #ifdef LOMIRI_FEATURES_ENABLED #include <src/greeter.h> @@ -57,11 +57,9 @@ main(int /*argc*/, char** /*argv*/) g_main_loop_quit(loop); }; - // build all our indicators. - // Right now we've only got one -- rotation lock -- but hey, we can dream. std::vector<std::shared_ptr<Indicator>> indicators; std::vector<std::shared_ptr<Exporter>> exporters; - indicators.push_back(std::make_shared<RotationLockIndicator>()); + indicators.push_back(std::make_shared<DisplayIndicator>()); for (auto& indicator : indicators) { auto exporter = std::make_shared<Exporter>(indicator); exporter->name_lost().connect(on_name_lost); diff --git a/src/rotation-lock.cpp b/src/service.cpp index 9e2971b..121bbac 100644 --- a/src/rotation-lock.cpp +++ b/src/service.cpp @@ -19,7 +19,7 @@ * Robert Tari <robert@tari.in> */ -#include <src/rotation-lock.h> +#include <src/service.h> #include <glib/gi18n.h> #ifdef COLOR_TEMP_ENABLED @@ -53,7 +53,7 @@ TempProfile m_lTempProfiles[] = }; #endif -class RotationLockIndicator::Impl +class DisplayIndicator::Impl { public: @@ -150,14 +150,14 @@ public: m_action_group = create_action_group(); // build the icon - const char *rotation_lock_icon_name {"orientation-lock"}; + const char *icon_name {"orientation-lock"}; if (!ayatana_common_utils_is_lomiri()) { - rotation_lock_icon_name = "display-panel"; + icon_name = "display-panel"; } - auto icon = g_themed_icon_new_with_default_fallbacks(rotation_lock_icon_name); + auto icon = g_themed_icon_new_with_default_fallbacks(icon_name); auto icon_deleter = [](GIcon* o){g_object_unref(G_OBJECT(o));}; m_icon.reset(icon, icon_deleter); @@ -232,7 +232,7 @@ private: #ifdef COLOR_TEMP_ENABLED static gboolean updateColor (gpointer pData) { - RotationLockIndicator::Impl *pImpl = (RotationLockIndicator::Impl*) pData; + DisplayIndicator::Impl *pImpl = (DisplayIndicator::Impl*) pData; guint nProfile = 0; g_settings_get (pImpl->m_settings, "color-temp-profile", "q", &nProfile); gdouble fBrightness = g_settings_get_double (pImpl->m_settings, "brightness"); @@ -360,7 +360,7 @@ private: static void onGeoClueLoaded (GObject *pObject, GAsyncResult *pResult, gpointer pData) { - RotationLockIndicator::Impl *pImpl = (RotationLockIndicator::Impl*) pData; + DisplayIndicator::Impl *pImpl = (DisplayIndicator::Impl*) pData; GError *pError = NULL; GClueSimple *pSimple = gclue_simple_new_finish (pResult, &pError); @@ -416,7 +416,7 @@ private: { g_simple_action_set_state (pAction, pVariant); - RotationLockIndicator::Impl *pImpl = (RotationLockIndicator::Impl*) pData; + DisplayIndicator::Impl *pImpl = (DisplayIndicator::Impl*) pData; if (pImpl->bAutoSliderUpdate) { @@ -724,31 +724,31 @@ private: **** ***/ -RotationLockIndicator::RotationLockIndicator(): +DisplayIndicator::DisplayIndicator(): impl(new Impl()) { } -RotationLockIndicator::~RotationLockIndicator() +DisplayIndicator::~DisplayIndicator() { } std::vector<std::shared_ptr<Profile>> -RotationLockIndicator::profiles() const +DisplayIndicator::profiles() const { return impl->profiles(); } GSimpleActionGroup* -RotationLockIndicator::action_group() const +DisplayIndicator::action_group() const { return impl->action_group(); } const char* -RotationLockIndicator::name() const +DisplayIndicator::name() const { - return "rotation_lock"; + return "display"; } /*** diff --git a/src/rotation-lock.h b/src/service.h index 7bdfb14..da8d8ba 100644 --- a/src/rotation-lock.h +++ b/src/service.h @@ -1,5 +1,6 @@ /* * Copyright 2014 Canonical Ltd. + * Copyright 2023 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 @@ -15,20 +16,21 @@ * * Authors: * Charles Kerr <charles.kerr@canonical.com> + * Robert Tari <robert@tari.in> */ -#ifndef INDICATOR_DISPLAY_ROTATION_LOCK_H -#define INDICATOR_DISPLAY_ROTATION_LOCK_H +#ifndef INDICATOR_DISPLAY_SERVICE_H +#define INDICATOR_DISPLAY_SERVICE_H #include <src/indicator.h> #include <memory> // std::unique_ptr -class RotationLockIndicator: public Indicator +class DisplayIndicator: public Indicator { public: - RotationLockIndicator(); - ~RotationLockIndicator(); + DisplayIndicator(); + ~DisplayIndicator(); const char* name() const override; GSimpleActionGroup* action_group() const override; diff --git a/tests/unit/rotation-lock-test.cpp b/tests/unit/rotation-lock-test.cpp index a4ce388..7bf2e45 100644 --- a/tests/unit/rotation-lock-test.cpp +++ b/tests/unit/rotation-lock-test.cpp @@ -19,7 +19,7 @@ #include <tests/utils/test-dbus-fixture.h> -#include <src/rotation-lock.h> +#include <src/service.h> class RotationLockFixture: public TestDBusFixture { @@ -45,9 +45,9 @@ protected: TEST_F(RotationLockFixture, CheckIndicator) { - RotationLockIndicator indicator; + DisplayIndicator indicator; - ASSERT_STREQ("rotation_lock", indicator.name()); + ASSERT_STREQ("display", indicator.name()); auto actions = indicator.action_group(); ASSERT_TRUE(actions != nullptr); ASSERT_TRUE(g_action_group_has_action(G_ACTION_GROUP(actions), "rotation-lock")); |