aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-10-29 14:16:27 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-11-01 08:23:04 +0100
commit92334f72b0722710f301707eec3b7dd52d9a099d (patch)
tree272e4c4bb420760d9211df06b16f53880b0b4260 /src
parent9facc9ae06c42ce822e78b605c58e1cb7d7db8dc (diff)
downloadayatana-indicator-display-92334f72b0722710f301707eec3b7dd52d9a099d.tar.gz
ayatana-indicator-display-92334f72b0722710f301707eec3b7dd52d9a099d.tar.bz2
ayatana-indicator-display-92334f72b0722710f301707eec3b7dd52d9a099d.zip
Drop HAS_LOMIRI_TOUCH_SCHEMA, use native schema instead
fixes https://github.com/AyatanaIndicators/ayatana-indicator-display/issues/8
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/rotation-lock.cpp40
2 files changed, 32 insertions, 12 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5066cbd..57bdc4b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,9 +1,5 @@
add_definitions(-DG_LOG_DOMAIN="${CMAKE_PROJECT_NAME}")
-if(EXISTS "/usr/share/glib-2.0/schemas/com.lomiri.touch.system.gschema.xml")
- add_definitions( -DHAS_LOMIRI_TOUCH_SCHEMA )
-endif()
-
add_compile_options(
${CXX_WARNING_ARGS}
)
diff --git a/src/rotation-lock.cpp b/src/rotation-lock.cpp
index a794dd2..ad89e10 100644
--- a/src/rotation-lock.cpp
+++ b/src/rotation-lock.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2014 Canonical Ltd.
+ * Copyright 2021 Robert Tari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <src/rotation-lock.h>
@@ -30,10 +32,37 @@ class RotationLockIndicator::Impl
{
public:
- Impl():
- m_settings(g_settings_new(m_schema_name)),
- m_action_group(create_action_group())
+ Impl()
{
+ GSettingsSchemaSource *pSource = g_settings_schema_source_get_default();
+
+ if (pSource != NULL)
+ {
+ GSettingsSchema *pSchema = g_settings_schema_source_lookup(pSource, "com.lomiri.touch.system", FALSE);
+
+ if (pSchema != NULL)
+ {
+ g_settings_schema_unref(pSchema);
+ m_settings = g_settings_new("com.lomiri.touch.system");
+ }
+ else
+ {
+ pSchema = g_settings_schema_source_lookup(pSource, "org.ayatana.indicator.display", FALSE);
+
+ if (pSchema != NULL)
+ {
+ g_settings_schema_unref(pSchema);
+ m_settings = g_settings_new("org.ayatana.indicator.display");
+ }
+ else
+ {
+ g_error("No schema could be found");
+ }
+ }
+ }
+
+ m_action_group = create_action_group();
+
// build the icon
const char *rotation_lock_icon_name {"orientation-lock"};
@@ -195,11 +224,6 @@ private:
****
***/
-#ifdef HAS_LOMIRI_TOUCH_SCHEMA
- static constexpr char const * m_schema_name {"com.lomiri.touch.system"};
-#else
- static constexpr char const * m_schema_name {"org.ayatana.indicator.display"};
-#endif
GSettings* m_settings = nullptr;
GSimpleActionGroup* m_action_group = nullptr;
std::shared_ptr<SimpleProfile> m_phone;