aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-10-10 12:21:49 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-10-10 12:21:49 +0200
commita6635f03b72a81151f55c2fb9f6dbb0c8bb806aa (patch)
tree9216706d6b4233e0f72414aaaefd85c8b9da4bba
parent0713c69189ead3be8b1946a004fcd99275834c47 (diff)
parent15d318fe93fb8419b1f03052f62c8feceb45356b (diff)
downloadayatana-indicator-display-a6635f03b72a81151f55c2fb9f6dbb0c8bb806aa.tar.gz
ayatana-indicator-display-a6635f03b72a81151f55c2fb9f6dbb0c8bb806aa.tar.bz2
ayatana-indicator-display-a6635f03b72a81151f55c2fb9f6dbb0c8bb806aa.zip
Merge branch 'tari01-pr/rename-to-display'
Attributes GH PR #78: https://github.com/AyatanaIndicators/ayatana-indicator-display/pull/78
-rw-r--r--INSTALL.md1
-rw-r--r--README.md4
-rw-r--r--data/CMakeLists.txt2
-rw-r--r--data/org.ayatana.indicator.display13
-rw-r--r--data/org.ayatana.indicator.rotation_lock13
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/indicator.h8
-rw-r--r--src/main.cpp8
-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/CMakeLists.txt2
-rw-r--r--tests/unit/rotation-lock-test.cpp6
13 files changed, 51 insertions, 50 deletions
diff --git a/INSTALL.md b/INSTALL.md
index 89e1b81..8a11f7a 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -9,6 +9,7 @@
- glib-2.0 (>= 2.36)
- gudev-1.0
- properties-cpp
+ - libgeoclue-2.0
- gtest (>= 1.6.0) - **For testing**
- qt5-base5 - **For testing**
- libqtdbusmock1 - **For testing**
diff --git a/README.md b/README.md
index c41e33b..18099db 100644
--- a/README.md
+++ b/README.md
@@ -35,8 +35,8 @@ https://ayatana-indicators.org
## The Display Ayatana System Indicator
The -display Ayatana System Indicator is the display menu indicator for
-Lomiri (Currently rotation-lock only, but we are planning to add further
-functionality for desktops, e.g. MATE, XFCE, LXDE). Its behavior and features will be listed at
+MATE and Lomiri (optionally for others, e.g. XFCE, LXDE). Its behavior
+and features will be listed at
https://wiki.ayatana-indicators.org/AyatanaIndicatorDisplay
## License and Copyright
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index 81b13f4..38ba788 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -51,7 +51,7 @@ install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.desktop" DESTI
set (AYATANA_INDICATOR_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/ayatana/indicators")
message (STATUS "${AYATANA_INDICATOR_DIR} is the Ayatana Indicator install dir")
-set (AYATANA_INDICATOR_NAME "org.ayatana.indicator.rotation_lock")
+set (AYATANA_INDICATOR_NAME "org.ayatana.indicator.display")
set (AYATANA_INDICATOR_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${AYATANA_INDICATOR_NAME}")
install (FILES "${AYATANA_INDICATOR_FILE}"
diff --git a/data/org.ayatana.indicator.display b/data/org.ayatana.indicator.display
new file mode 100644
index 0000000..cc4fe85
--- /dev/null
+++ b/data/org.ayatana.indicator.display
@@ -0,0 +1,13 @@
+[Indicator Service]
+Name=ayatana-indicator-display
+ObjectPath=/org/ayatana/indicator/display
+Position=90
+
+[phone]
+ObjectPath=/org/ayatana/indicator/display/phone
+
+[phone_greeter]
+ObjectPath=/org/ayatana/indicator/display/phone
+
+[desktop]
+ObjectPath=/org/ayatana/indicator/display/desktop
diff --git a/data/org.ayatana.indicator.rotation_lock b/data/org.ayatana.indicator.rotation_lock
deleted file mode 100644
index 050f1a0..0000000
--- a/data/org.ayatana.indicator.rotation_lock
+++ /dev/null
@@ -1,13 +0,0 @@
-[Indicator Service]
-Name=ayatana-indicator-rotation-lock
-ObjectPath=/org/ayatana/indicator/rotation_lock
-Position=90
-
-[phone]
-ObjectPath=/org/ayatana/indicator/rotation_lock/phone
-
-[phone_greeter]
-ObjectPath=/org/ayatana/indicator/rotation_lock/phone
-
-[desktop]
-ObjectPath=/org/ayatana/indicator/rotation_lock/desktop
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/indicator.h b/src/indicator.h
index 7379b32..c9ccb1e 100644
--- a/src/indicator.h
+++ b/src/indicator.h
@@ -1,5 +1,6 @@
/*
* Copyright 2014-2016 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,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#pragma once
@@ -50,7 +52,7 @@ class Profile
{
public:
virtual std::string name() const =0;
- virtual const core::Property<Header>& header() const =0;
+ virtual core::Property<Header>& header() =0;
virtual std::shared_ptr<GMenuModel> menu_model() const =0;
virtual ~Profile();
@@ -66,8 +68,7 @@ public:
virtual ~SimpleProfile();
std::string name() const override {return m_name;}
- core::Property<Header>& header() {return m_header;}
- const core::Property<Header>& header() const override {return m_header;}
+ core::Property<Header>& header() override {return m_header;}
std::shared_ptr<GMenuModel> menu_model() const override {return m_menu;}
protected:
@@ -86,4 +87,3 @@ public:
virtual GSimpleActionGroup* action_group() const =0;
virtual std::vector<std::shared_ptr<Profile>> profiles() const =0;
};
-
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/CMakeLists.txt b/tests/CMakeLists.txt
index 6b25955..5bd645f 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -28,7 +28,7 @@ endif()
add_compile_options(${CXX_WARNING_ARGS})
-add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --error-exitcode=2 --inline-suppr --library=qt -I${CMAKE_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/tests/utils/qmain.cpp -i${CMAKE_SOURCE_DIR}/tests/gmock ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests --suppress=missingIncludeSystem --suppress=uninitDerivedMemberVar --suppress=unmatchedSuppression --suppress=constParameter --suppress=unusedFunction)
+add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --error-exitcode=2 --inline-suppr --library=qt -I${CMAKE_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/tests/utils/qmain.cpp -i${CMAKE_SOURCE_DIR}/tests/gmock ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests --suppress=missingIncludeSystem --suppress=uninitDerivedMemberVar --suppress=unmatchedSuppression --suppress=constParameter --suppress=unusedFunction --suppress=uselessOverride)
if (ENABLE_LOMIRI_FEATURES)
add_subdirectory (integration)
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"));