diff options
-rw-r--r-- | .build.yml | 9 | ||||
-rw-r--r-- | AUTHORS | 6 | ||||
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | ChangeLog | 131 | ||||
-rw-r--r-- | NEWS | 29 | ||||
-rw-r--r-- | data/50-org.ayatana.indicator.display.AccountsService.pkla | 6 | ||||
-rw-r--r-- | data/CMakeLists.txt | 4 | ||||
-rw-r--r-- | data/ayatana-indicator-display.service.in | 4 | ||||
-rw-r--r-- | debian/changelog | 28 | ||||
-rw-r--r-- | debian/control | 3 | ||||
-rw-r--r-- | po/es.po | 8 | ||||
-rw-r--r-- | po/et.po | 16 | ||||
-rw-r--r-- | po/ja.po | 71 | ||||
-rw-r--r-- | po/ro.po | 75 | ||||
-rw-r--r-- | po/ta.po | 70 | ||||
-rw-r--r-- | src/dbus-names.h | 59 | ||||
-rw-r--r-- | src/indicator.h | 2 | ||||
-rw-r--r-- | src/main.cpp | 14 | ||||
-rw-r--r-- | src/service.cpp | 543 | ||||
-rw-r--r-- | src/service.h | 2 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/utils/glib-fixture.h | 2 | ||||
-rw-r--r-- | tests/utils/test-dbus-fixture.h | 2 |
23 files changed, 686 insertions, 411 deletions
@@ -17,6 +17,9 @@ requires: - geoclue - gnome-desktop - accountsservice + - libx11 + - libxrandr + - librda # - libayatana-common (AUR) # - xsct (AUR) @@ -51,9 +54,9 @@ requires: - libgeoclue-2-dev - gsettings-desktop-schemas - libaccountsservice-dev -# For xsct - libx11-dev - libxrandr-dev + - librda-dev ubuntu: - clang @@ -85,9 +88,9 @@ requires: - libgeoclue-2-dev - gsettings-desktop-schemas - libaccountsservice-dev -# For xsct - libx11-dev - libxrandr-dev + - librda-dev ubuntu:focal: - clang @@ -119,9 +122,9 @@ requires: - libgeoclue-2-dev - gsettings-desktop-schemas - libaccountsservice-dev -# For xsct - libx11-dev - libxrandr-dev + - librda-dev variables: - 'CHECKERS=" @@ -27,6 +27,7 @@ Heimen Stoffels <vistausss@fastmail.com> Heimen Stoffels <vistausss@outlook.com> Henrique Combochi <henrique.combochi@gmail.com> Hosted Weblate <hosted@weblate.org> +ID J <tabby4442@gmail.com> iNetRoos <inetroos@gmail.com> Ivo Xavier <ivofernandes12@gmail.com> Jami Kettunen <jami.kettunen@protonmail.com> @@ -49,6 +50,7 @@ Moo <hazap@hotmail.com> M Ramani Priya <priya.maremanda@gmail.com> MrJang <ijin1322@gmail.com> Oğuz Ersen <oguz@ersen.moe> +OPNA2608 <opna2608@protonmail.com> Pavel Borecki <pavel.borecki@gmail.com> Pete Woods <pete.woods@canonical.com> Petter Reinholdtsen <pere-weblate@hungry.com> @@ -56,6 +58,7 @@ phlostically <phlostically@mailinator.com> Prachi Joshi <josprachi@yahoo.com> Quentin PAGÈS <quentinantonin@free.fr> Ratchanan Srirattanamet <ratchanan@ubports.com> +Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org> Reza Almanda <rezaalmanda27@gmail.com> Robert Tari <robert@tari.in> Rodney Dawes <rodney.dawes@canonical.com> @@ -79,6 +82,7 @@ THANOS SIOURDAKIS <siourdakisthanos@gmail.com> Tiago de Oliveira <z_tiago@hotmail.com> Tobias p <sorenautonom667@gmail.com> Tomáš Marný <tomik.marny@gmail.com> +umesaburo sagawa <atowa-notonare-yamatonare427@pm.me> Viktar Vauchkevich <victorenator@gmail.com> wdggg <wdggg7@gmail.com> Weblate <noreply@weblate.org> @@ -89,3 +93,5 @@ Zeeshan Khan <zkhan1093@gmail.com> Володимир Бриняк <bardvv@gmail.com> Марс Ямбар <mjambarmeta@gmail.com> Мира Странная <miraityan2004@gmail.com> +தமிழ்நேரம் <anishprabu.t@gmail.com> +复予 <clonewith@qq.com> diff --git a/CMakeLists.txt b/CMakeLists.txt index c80a7e3..0a0da08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.13) -project(ayatana-indicator-display VERSION 24.4.0 LANGUAGES C CXX) +project(ayatana-indicator-display VERSION 24.5.2 LANGUAGES C CXX) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) SET(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE) @@ -20,6 +20,7 @@ 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_COLOR_TEMP "Include colour temperature specific code in the build" ON) +option(ENABLE_RDA "Enable RDA (remote desktop awareness), only taking effect if built with ENABLE_COLOR_TEMP" ON) if(ENABLE_COVERAGE) set(ENABLE_TESTS ON) @@ -68,8 +69,13 @@ set(GLIB_MINIMUM 2.36) set (SERVICE_DEPS libayatana-common>=0.9.3 gio-unix-2.0>=${GLIB_MINIMUM} glib-2.0>=${GLIB_MINIMUM} properties-cpp>=0.0.1) if (ENABLE_COLOR_TEMP) - list (APPEND SERVICE_DEPS libgeoclue-2.0 accountsservice) + list (APPEND SERVICE_DEPS libgeoclue-2.0 accountsservice x11 xrandr) add_definitions (-DCOLOR_TEMP_ENABLED) + + if (ENABLE_RDA) + list (APPEND SERVICE_DEPS rda) + add_definitions (-DRDA_ENABLED) + endif () endif () pkg_check_modules (SERVICE_DEPS REQUIRED ${SERVICE_DEPS}) @@ -117,3 +123,4 @@ message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}") message(STATUS "Unit tests: ${ENABLE_TESTS}") message(STATUS "Build with -Werror: ${ENABLE_WERROR}") message(STATUS "Build with colour temperature code: ${ENABLE_COLOR_TEMP}") +message(STATUS "Build with remote desktop awareness: ${ENABLE_RDA}") @@ -1,6 +1,135 @@ +2025-05-04 Mike Gabriel + + * release 24.5.2 (HEAD -> main, tag: 24.5.2) + * Merge branch 'tari01-pr/rename-panel-icon' (217d17fd) + +2025-05-04 Robert Tari + + * src/service.cpp: Use standard video-display fallback for panel icon + (57c03b47) + +2025-04-27 தமிழ்நேரம் + + * Translated using Weblate (Tamil) (34851c31) + +2025-03-12 Mike Gabriel + + * release 24.5.1 (3676a29f) (tag: 24.5.1) + * Merge branch 'tari01-pr/drop-pkla' (fba80533) + +2025-01-15 Robert Tari + + * Drop the deprecated PolicyKit *.pkla file (1d4e1f48)fixes: + https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1093060 + +2024-11-08 தமிழ்நேரம் + + * Translated using Weblate (Tamil) (b3f407b1) + +2024-09-27 Remus-Gabriel Chelu + + * Translated using Weblate (Romanian) (c213f18e) + +2024-08-22 Mike Gabriel + + * Merge branch 'tari01-pr/duplicate-code' (0fdd09d6) + +2024-07-18 Robert Tari + + * service.cpp: Remove duplicate line (9a324475) + +2024-08-08 umesaburo sagawa + + * Translated using Weblate (Japanese) (01181a50) + +2024-07-16 Mike Gabriel + + * Merge branch 'tari01-pr/panic-warning' (d99008b2) + +2024-07-16 Robert Tari + + * src/service.cpp: Disable Xsct for Wayland (362422ca) + * src/service.cpp: If possible, replace errors with more descriptive + warnings when facing a panic (43843508) + +2024-07-15 Mike Gabriel + + * Merge branch 'tari01-pr/virtual-display' (490a62b1) + +2024-06-25 Robert Tari + + * .build.yml: Add libx11, libxrandr and librda dependencies + (41915b25) + * debian/control: Add libx11-dev, libxrandr-dev and librda-dev + dependencies (cbff4ee4) + * Hide xsct features if not supported by server/driver (34ef083e) + +2024-06-13 Robert Tari + + * Merge branch 'sunweaver-pr/drop-dbus-names' (ede1f56b) + +2024-06-12 Mike Gabriel + + * src/dbus-names.h: Drop file. Not needed anymore. (70018019) + +2024-05-22 Mike Gabriel + + * release 24.5.0 (d1bcf8f3) (tag: 24.5.0) + +2024-05-22 Robert Tari + + * Merge branch 'sunweaver-pr/lomiri-indicators-target' (b982756f) + +2024-05-21 Mike Gabriel + + * data/ayatana-indicator-display.service.in: Become part of + lomiri-indicators.target. (3699389a) + +2024-05-22 Mike Gabriel + + * Merge branch 'OPNA2608-fix/recursive-schema-lookup' (ffec0d45) + +2024-05-20 OPNA2608 + + * src/service.cpp: Look up schemas recursively (50b2197c) + +2024-05-17 Mike Gabriel + + * release 24.4.1 (4d95bad3) (tag: 24.4.1) + +2024-05-17 Robert Tari + + * Merge branch 'sunweaver-pr/cppcheck-2.14' (4b25c3a1) + +2024-05-04 Mike Gabriel + + * cppcheck: Run with --check-level=exhaustive. (bfb74193) + * cppcheck: Replace C-style casts by C++-style static_cast<> casts. + (9b3eb0bc) + * cppcheck: Suppress constParameterCallback. (8c4b2d9c) + * cppcheck: Fix missingOverride complaints. (f1dde7a9) + +2024-05-15 Robert Tari + + * Merge branch + 'sunweaver-pr/xsct-brightness-slider-blackscreen-with-de-locale' + (9a605aa2) + +2024-05-14 Mike Gabriel + + * src/main.cpp: Initialize LC_NUMERIC with 'POSIX'. (89ca869f) + +2024-04-18 复予 + + * Translated using Weblate (Chinese (Simplified)) (cd7ad7e2) + +2024-04-13 ID J + + * Translated using Weblate (Korean) (79894112) + 2024-04-08 Mike Gabriel - * release 24.4.0 (HEAD -> main, tag: 24.4.0) + * release 24.4.0 (fb208451) (tag: 24.4.0) * Merge branch 'tari01-pr/slider-step' (3ec03467) 2024-04-05 Robert Tari @@ -1,3 +1,32 @@ +Overview of changes in ayatana-indicator-display 24.5.2 + + - src/service.cpp: Use standard video-display fallback for panel icon. + - Translation updates. + +Overview of changes in ayatana-indicator-display 24.5.1 + + - Hide xsct features if not supported by server/driver. + - src/service.cpp: If possible, replace errors with more descriptive + warnings when facing a panic. + - src/service.cpp: Disable Xsct for Wayland. + - Drop the deprecated PolicyKit *.pkla file. + - Translation updates. + +Overview of changes in ayatana-indicator-display 24.5.0 + + - src/service.cpp: Look up schemas recursively + - data/ayatana-indicator-display.service.in: Become part of + lomiri-indicators.target. + +Overview of changes in ayatana-indicator-display 24.4.1 + + - src/main.cpp: Initialize LC_NUMERIC with 'POSIX'. + - cppcheck: Fix missingOverride complaints. + - cppcheck: Suppress constParameterCallback. + - cppcheck: Replace C-style casts by C++-style static_cast<> casts. + - cppcheck: Run with --check-level=exhaustive. + - Translation updates. + Overview of changes in ayatana-indicator-display 24.4.0 - Fix access of unitialized variables in DisplayIndicator destructor. diff --git a/data/50-org.ayatana.indicator.display.AccountsService.pkla b/data/50-org.ayatana.indicator.display.AccountsService.pkla deleted file mode 100644 index f607642..0000000 --- a/data/50-org.ayatana.indicator.display.AccountsService.pkla +++ /dev/null @@ -1,6 +0,0 @@ -[Allow LightDM to set AccountsService fields] -Identity=unix-user:lightdm -Action=org.ayatana.indicator.display.AccountsService.ModifyAnyUser -ResultActive=yes -ResultInactive=yes -ResultAny=yes diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index e24a925..451c9e8 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -82,8 +82,4 @@ if (ENABLE_COLOR_TEMP) install (FILES 50-org.ayatana.indicator.display.AccountsService.rules DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/polkit-1/rules.d") - # 50-org.ayatana.indicator.display.AccountsService.pkla - - install (FILES 50-org.ayatana.indicator.display.AccountsService.pkla DESTINATION "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/polkit-1/localauthority/10-vendor.d") - endif () diff --git a/data/ayatana-indicator-display.service.in b/data/ayatana-indicator-display.service.in index 4ae5d2b..85070f2 100644 --- a/data/ayatana-indicator-display.service.in +++ b/data/ayatana-indicator-display.service.in @@ -1,11 +1,11 @@ [Unit] Description=Ayatana Indicator Display Backend PartOf=graphical-session.target -PartOf=ayatana-indicators.target +PartOf=ayatana-indicators.target lomiri-indicators.target [Service] ExecStart=@CMAKE_INSTALL_FULL_LIBEXECDIR@/ayatana-indicator-display/ayatana-indicator-display-service Restart=on-failure [Install] -WantedBy=ayatana-indicators.target +WantedBy=ayatana-indicators.target lomiri-indicators.target diff --git a/debian/changelog b/debian/changelog index c485017..6be1739 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,31 @@ +ayatana-indicator-display (24.5.2-0) unstable; urgency=medium + + * Upstream-provided Debian package for ayatana-indicator-display. + See upstream ChangeLog for recent changes. + + -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Sun, 04 May 2025 22:23:18 +0200 + +ayatana-indicator-display (24.5.1-0) unstable; urgency=medium + + * Upstream-provided Debian package for ayatana-indicator-display. + See upstream ChangeLog for recent changes. + + -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Wed, 12 Mar 2025 12:55:26 +0100 + +ayatana-indicator-display (24.5.0-0) unstable; urgency=medium + + * Upstream-provided Debian package for ayatana-indicator-display. + See upstream ChangeLog for recent changes. + + -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Wed, 22 May 2024 08:49:48 +0200 + +ayatana-indicator-display (24.4.1-0) unstable; urgency=medium + + * Upstream-provided Debian package for ayatana-indicator-display. + See upstream ChangeLog for recent changes. + + -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Fri, 17 May 2024 18:51:07 +0200 + ayatana-indicator-display (24.4.0-0) unstable; urgency=medium * Upstream-provided Debian package for ayatana-indicator-display. diff --git a/debian/control b/debian/control index 3413eee..c9464e8 100644 --- a/debian/control +++ b/debian/control @@ -12,6 +12,9 @@ Build-Depends: cmake, libproperties-cpp-dev, libgeoclue-2-dev, libaccountsservice-dev, + libx11-dev, + libxrandr-dev, + librda-dev, # for coverage reports gcovr, lcov, @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-12 23:45+0200\n" -"PO-Revision-Date: 2023-10-16 04:19+0000\n" -"Last-Translator: gallegonovato <fran-carro@hotmail.es>\n" +"PO-Revision-Date: 2025-06-30 03:06+0000\n" +"Last-Translator: DP <dprietob@users.noreply.hosted.weblate.org>\n" "Language-Team: Spanish <https://hosted.weblate.org/projects/" "ayatana-indicators/display-applet/es/>\n" "Language: es\n" @@ -17,11 +17,11 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 5.1-dev\n" +"X-Generator: Weblate 5.13-dev\n" #: data/org.ayatana.indicator.display.gschema.xml:1 msgid "Lock rotation" -msgstr "Rotación de la cerradura" +msgstr "Bloquear rotación" #: data/org.ayatana.indicator.display.gschema.xml:2 msgid "Lock automatic display rotation." @@ -8,16 +8,16 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-12 23:45+0200\n" -"PO-Revision-Date: 2022-10-20 11:02+0000\n" -"Last-Translator: Kristjan Räts <kristjanrats@gmail.com>\n" -"Language-Team: Estonian <https://hosted.weblate.org/projects/ayatana-" -"indicators/display-applet/et/>\n" +"PO-Revision-Date: 2025-05-08 11:02+0000\n" +"Last-Translator: Priit Jõerüüt <hwlate@joeruut.com>\n" +"Language-Team: Estonian <https://hosted.weblate.org/projects/" +"ayatana-indicators/display-applet/et/>\n" "Language: et\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.14.2-dev\n" +"X-Generator: Weblate 5.12-dev\n" #: data/org.ayatana.indicator.display.gschema.xml:1 msgid "Lock rotation" @@ -124,15 +124,15 @@ msgstr "Pööramise lukustus" #: src/service.cpp:597 msgid "Brightness" -msgstr "" +msgstr "Eredus" #: src/service.cpp:651 msgid "Light" -msgstr "" +msgstr "Hele" #: src/service.cpp:654 msgid "Dark" -msgstr "" +msgstr "Tume" #: src/service.cpp:667 msgid "Display settings…" @@ -8,117 +8,116 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-12 23:46+0200\n" -"PO-Revision-Date: 2019-12-17 11:21+0000\n" -"Last-Translator: Ryo Nakano <ryonakaknock3@gmail.com>\n" -"Language-Team: Japanese <https://hosted.weblate.org/projects/ayatana-" -"indicators/display-applet/ja/>\n" +"PO-Revision-Date: 2024-08-09 14:09+0000\n" +"Last-Translator: umesaburo sagawa <atowa-notonare-yamatonare427@pm.me>\n" +"Language-Team: Japanese <https://hosted.weblate.org/projects/" +"ayatana-indicators/display-applet/ja/>\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 3.10-dev\n" +"X-Generator: Weblate 5.7-dev\n" #: data/org.ayatana.indicator.display.gschema.xml:1 -#, fuzzy msgid "Lock rotation" -msgstr "回転" +msgstr "画面回転ロック" #: data/org.ayatana.indicator.display.gschema.xml:2 msgid "Lock automatic display rotation." -msgstr "" +msgstr "ディスプレイの自動回転をロックします。" #: data/org.ayatana.indicator.display.gschema.xml:3 -#, fuzzy msgid "Orientation lock" msgstr "回転ロック" #: data/org.ayatana.indicator.display.gschema.xml:4 msgid "Locks orientation to a specific value." -msgstr "" +msgstr "オリエンテーションを特定の値にロックする。" #: data/org.ayatana.indicator.display.gschema.xml:5 src/service.cpp:611 msgid "Color temperature" -msgstr "" +msgstr "色温度" #: data/org.ayatana.indicator.display.gschema.xml:6 msgid "" "Sets the color temperature of your screen. The lower the value, the higher " "the intensity of the redness effect applied to the display." -msgstr "" +msgstr "画面の色温度を設定します。数値が低いほど、ディスプレイに適用される赤みエフェ" +"クトの強度が高くなります。" #: data/org.ayatana.indicator.display.gschema.xml:7 src/service.cpp:622 msgid "Color temperature profile" -msgstr "" +msgstr "色温度のプロフィール" #: data/org.ayatana.indicator.display.gschema.xml:8 msgid "The current color temperature profile being used by the indicator." -msgstr "" +msgstr "インジケーターが現在使用している色温度プロファイル。" #: data/org.ayatana.indicator.display.gschema.xml:9 msgid "Screen brightness" -msgstr "" +msgstr "画面の明るさ" #: data/org.ayatana.indicator.display.gschema.xml:10 msgid "Stores the current brightness value of your screen." -msgstr "" +msgstr "スクリーンの現在の明るさの値を保存します。" #: data/org.ayatana.indicator.display.gschema.xml:11 msgid "The name of the light theme" -msgstr "" +msgstr "ライトテーマの名前" #: data/org.ayatana.indicator.display.gschema.xml:12 msgid "This is the theme the indicator will set when \"Light\" is selected." -msgstr "" +msgstr "これは、「Light」を選択したときにインジケーターが設定するテーマです。" #: data/org.ayatana.indicator.display.gschema.xml:13 msgid "The name of the dark theme" -msgstr "" +msgstr "ダークテーマの名前" #: data/org.ayatana.indicator.display.gschema.xml:14 msgid "This is the theme the indicator will set when \"Dark\" is selected." -msgstr "" +msgstr "これは、「Dark」が選択されたときにインジケーターが設定するテーマである。" #: data/org.ayatana.indicator.display.gschema.xml:15 #: src/service.cpp:650 msgid "Theme profile" -msgstr "" +msgstr "テーマプロファイル" #: data/org.ayatana.indicator.display.gschema.xml:16 msgid "The current theme profile being used by the indicator." -msgstr "" +msgstr "インジケーターが現在使用しているテーマプロファイル。" #: data/org.ayatana.indicator.display.gschema.xml:17 msgid "Current geographic latitude" -msgstr "" +msgstr "現在の地理的緯度" #: data/org.ayatana.indicator.display.gschema.xml:18 msgid "Stores the last recorded geographic latitude of the device." -msgstr "" +msgstr "最後に記録されたデバイスの地理的緯度を保存します。" #: data/org.ayatana.indicator.display.gschema.xml:19 msgid "Current geographic longitude" -msgstr "" +msgstr "現在の地理的緯度" #: data/org.ayatana.indicator.display.gschema.xml:20 msgid "Stores the last recorded geographic longitude of the device." -msgstr "" +msgstr "最後に記録されたデバイスの地理的経度を保存します。" #: src/service.cpp:48 msgid "Manual" -msgstr "" +msgstr "マニュアル" #: src/service.cpp:49 msgid "Adaptive (Colder)" -msgstr "" +msgstr "適応(寒冷)" #: src/service.cpp:50 src/service.cpp:657 msgid "Adaptive" -msgstr "" +msgstr "適応" #: src/service.cpp:51 msgid "Adaptive (Warmer)" -msgstr "" +msgstr "適応(温暖)" #: src/service.cpp:544 src/service.cpp:581 msgid "Rotation Lock" @@ -126,19 +125,19 @@ msgstr "回転ロック" #: src/service.cpp:597 msgid "Brightness" -msgstr "" +msgstr "明るさ" #: src/service.cpp:651 msgid "Light" -msgstr "" +msgstr "ライト" #: src/service.cpp:654 msgid "Dark" -msgstr "" +msgstr "ダーク" #: src/service.cpp:667 msgid "Display settings…" -msgstr "" +msgstr "ディスプレイセッティング…" #: src/service.cpp:680 msgid "Rotation" @@ -146,11 +145,11 @@ msgstr "回転" #: src/service.cpp:691 msgid "Display" -msgstr "" +msgstr "ディスプレイ" #: src/service.cpp:692 msgid "Display settings and features" -msgstr "" +msgstr "ディスプレイの設定と機能" #: src/usb-snap.cpp:109 #, c-format @@ -8,138 +8,143 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-12 23:46+0200\n" -"PO-Revision-Date: 2020-04-03 18:21+0000\n" -"Last-Translator: Allan Nordhøy <epost@anotheragency.no>\n" -"Language-Team: Romanian <https://hosted.weblate.org/projects/ayatana-" -"indicators/display-applet/ro/>\n" +"PO-Revision-Date: 2024-09-29 00:16+0000\n" +"Last-Translator: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>\n" +"Language-Team: Romanian <https://hosted.weblate.org/projects/" +"ayatana-indicators/display-applet/ro/>\n" "Language: ro\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < " "20)) ? 1 : 2;\n" -"X-Generator: Weblate 4.0-dev\n" +"X-Generator: Weblate 5.8-dev\n" #: data/org.ayatana.indicator.display.gschema.xml:1 -#, fuzzy msgid "Lock rotation" -msgstr "Rotire" +msgstr "Blochează rotirea" #: data/org.ayatana.indicator.display.gschema.xml:2 msgid "Lock automatic display rotation." -msgstr "" +msgstr "Blochează rotația automată a afișării." #: data/org.ayatana.indicator.display.gschema.xml:3 -#, fuzzy msgid "Orientation lock" -msgstr "Blocarea rotatiei" +msgstr "Blochează orientarea" #: data/org.ayatana.indicator.display.gschema.xml:4 msgid "Locks orientation to a specific value." -msgstr "" +msgstr "Blochează orientarea la o anumită valoare." #: data/org.ayatana.indicator.display.gschema.xml:5 src/service.cpp:611 msgid "Color temperature" -msgstr "" +msgstr "Temperatura culorii" #: data/org.ayatana.indicator.display.gschema.xml:6 msgid "" "Sets the color temperature of your screen. The lower the value, the higher " "the intensity of the redness effect applied to the display." msgstr "" +"Stabilește temperatura de culoare a ecranului. Cu cât este mai mică " +"valoarea, cu atât este mai mare intensitatea efectului de roșeață aplicat " +"ecranului." #: data/org.ayatana.indicator.display.gschema.xml:7 src/service.cpp:622 msgid "Color temperature profile" -msgstr "" +msgstr "Profilul temperaturii de culoare" #: data/org.ayatana.indicator.display.gschema.xml:8 msgid "The current color temperature profile being used by the indicator." -msgstr "" +msgstr "Profilul curent al temperaturii de culoare utilizat de indicator." #: data/org.ayatana.indicator.display.gschema.xml:9 msgid "Screen brightness" -msgstr "" +msgstr "Luminozitatea ecranului" #: data/org.ayatana.indicator.display.gschema.xml:10 msgid "Stores the current brightness value of your screen." -msgstr "" +msgstr "Stochează valoarea curentă a luminozității ecranului." #: data/org.ayatana.indicator.display.gschema.xml:11 msgid "The name of the light theme" -msgstr "" +msgstr "Numele temei luminoase" #: data/org.ayatana.indicator.display.gschema.xml:12 msgid "This is the theme the indicator will set when \"Light\" is selected." msgstr "" +"Aceasta este tema pe care indicatorul o va afișa atunci când este selectată " +"„Luminoasă”." #: data/org.ayatana.indicator.display.gschema.xml:13 msgid "The name of the dark theme" -msgstr "" +msgstr "Numele temei întunecate" #: data/org.ayatana.indicator.display.gschema.xml:14 msgid "This is the theme the indicator will set when \"Dark\" is selected." msgstr "" +"Aceasta este tema pe care indicatorul o va afișa atunci când este selectată " +"„Întunecată”." #: data/org.ayatana.indicator.display.gschema.xml:15 #: src/service.cpp:650 msgid "Theme profile" -msgstr "" +msgstr "Profilul temei" #: data/org.ayatana.indicator.display.gschema.xml:16 msgid "The current theme profile being used by the indicator." -msgstr "" +msgstr "Profilul temei curente utilizate de indicator." #: data/org.ayatana.indicator.display.gschema.xml:17 msgid "Current geographic latitude" -msgstr "" +msgstr "Latitudinea geografică curentă" #: data/org.ayatana.indicator.display.gschema.xml:18 msgid "Stores the last recorded geographic latitude of the device." -msgstr "" +msgstr "Stochează ultima latitudine geografică înregistrată a dispozitivului." #: data/org.ayatana.indicator.display.gschema.xml:19 msgid "Current geographic longitude" -msgstr "" +msgstr "Longitudinea geografică curentă" #: data/org.ayatana.indicator.display.gschema.xml:20 msgid "Stores the last recorded geographic longitude of the device." -msgstr "" +msgstr "Stochează ultima longitudine geografică înregistrată a dispozitivului." #: src/service.cpp:48 msgid "Manual" -msgstr "" +msgstr "Manual" #: src/service.cpp:49 msgid "Adaptive (Colder)" -msgstr "" +msgstr "Adaptivă (mai rece)" #: src/service.cpp:50 src/service.cpp:657 msgid "Adaptive" -msgstr "" +msgstr "Adaptivă" #: src/service.cpp:51 msgid "Adaptive (Warmer)" -msgstr "" +msgstr "Adaptivă (mai caldă)" #: src/service.cpp:544 src/service.cpp:581 msgid "Rotation Lock" -msgstr "Blocarea rotatiei" +msgstr "Rotire blocată" #: src/service.cpp:597 msgid "Brightness" -msgstr "" +msgstr "Luminozitate" #: src/service.cpp:651 msgid "Light" -msgstr "" +msgstr "Luminoasă" #: src/service.cpp:654 msgid "Dark" -msgstr "" +msgstr "Întunecată" #: src/service.cpp:667 msgid "Display settings…" -msgstr "" +msgstr "Configurări de ecran…" #: src/service.cpp:680 msgid "Rotation" @@ -147,11 +152,11 @@ msgstr "Rotire" #: src/service.cpp:691 msgid "Display" -msgstr "" +msgstr "Ecran" #: src/service.cpp:692 msgid "Display settings and features" -msgstr "" +msgstr "Configurări și caracteristici ale ecranului" #: src/usb-snap.cpp:109 #, c-format @@ -8,144 +8,150 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-12 23:46+0200\n" -"PO-Revision-Date: 2017-11-28 08:50+0000\n" -"Last-Translator: Automatically generated\n" -"Language-Team: none\n" +"PO-Revision-Date: 2025-04-27 02:17+0000\n" +"Last-Translator: தமிழ்நேரம் <anishprabu.t@gmail.com>\n" +"Language-Team: Tamil <https://hosted.weblate.org/projects/ayatana-indicators/" +"display-applet/ta/>\n" "Language: ta\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.12-dev\n" #: data/org.ayatana.indicator.display.gschema.xml:1 msgid "Lock rotation" -msgstr "" +msgstr "பூட்டு சுழற்சி" #: data/org.ayatana.indicator.display.gschema.xml:2 msgid "Lock automatic display rotation." -msgstr "" +msgstr "தானியங்கி காட்சி சுழற்சியைப் பூட்டு." #: data/org.ayatana.indicator.display.gschema.xml:3 msgid "Orientation lock" -msgstr "" +msgstr "நோக்குநிலை பூட்டு" #: data/org.ayatana.indicator.display.gschema.xml:4 msgid "Locks orientation to a specific value." -msgstr "" +msgstr "ஒரு குறிப்பிட்ட மதிப்புக்கு நோக்குநிலையை பூட்டுகிறது." #: data/org.ayatana.indicator.display.gschema.xml:5 src/service.cpp:611 msgid "Color temperature" -msgstr "" +msgstr "வண்ண வெப்பநிலை" #: data/org.ayatana.indicator.display.gschema.xml:6 msgid "" "Sets the color temperature of your screen. The lower the value, the higher " "the intensity of the redness effect applied to the display." msgstr "" +"உங்கள் திரையின் வண்ண வெப்பநிலையை அமைக்கிறது. மதிப்பைக் குறைத்து, காட்சிக்கு பயன்படுத்தப்படும் சிவத்தல் விளைவின் தீவிரம்." #: data/org.ayatana.indicator.display.gschema.xml:7 src/service.cpp:622 msgid "Color temperature profile" -msgstr "" +msgstr "வண்ண வெப்பநிலை சுயவிவரம்" #: data/org.ayatana.indicator.display.gschema.xml:8 msgid "The current color temperature profile being used by the indicator." -msgstr "" +msgstr "தற்போதைய வண்ண வெப்பநிலை சுயவிவரம் காட்டி மூலம் பயன்படுத்தப்படுகிறது." #: data/org.ayatana.indicator.display.gschema.xml:9 msgid "Screen brightness" -msgstr "" +msgstr "திரை ஒளி" #: data/org.ayatana.indicator.display.gschema.xml:10 msgid "Stores the current brightness value of your screen." -msgstr "" +msgstr "உங்கள் திரையின் தற்போதைய பிரகாச மதிப்பை சேமிக்கிறது." #: data/org.ayatana.indicator.display.gschema.xml:11 msgid "The name of the light theme" -msgstr "" +msgstr "ஒளி கருப்பொருளின் பெயர்" #: data/org.ayatana.indicator.display.gschema.xml:12 msgid "This is the theme the indicator will set when \"Light\" is selected." -msgstr "" +msgstr "\"ஒளி\" தேர்ந்தெடுக்கப்படும்போது காட்டி அமைக்கும் கருப்பொருள் இதுதான்." #: data/org.ayatana.indicator.display.gschema.xml:13 msgid "The name of the dark theme" -msgstr "" +msgstr "இருண்ட கருப்பொருளின் பெயர்" #: data/org.ayatana.indicator.display.gschema.xml:14 msgid "This is the theme the indicator will set when \"Dark\" is selected." msgstr "" +"\"இருண்ட\" தேர்ந்தெடுக்கப்படும்போது காட்டி அமைக்கும் கருப்பொருள் இதுதான்." #: data/org.ayatana.indicator.display.gschema.xml:15 #: src/service.cpp:650 msgid "Theme profile" -msgstr "" +msgstr "கருப்பொருள் சுயவிவரம்" #: data/org.ayatana.indicator.display.gschema.xml:16 msgid "The current theme profile being used by the indicator." -msgstr "" +msgstr "தற்போதைய கருப்பொருள் சுயவிவரம் காட்டி பயன்படுத்துகிறது." #: data/org.ayatana.indicator.display.gschema.xml:17 msgid "Current geographic latitude" -msgstr "" +msgstr "தற்போதைய புவியியல் அட்சரேகை" #: data/org.ayatana.indicator.display.gschema.xml:18 msgid "Stores the last recorded geographic latitude of the device." -msgstr "" +msgstr "சாதனத்தின் கடைசியாக பதிவு செய்யப்பட்ட புவியியல் அட்சரேகையை சேமிக்கிறது." #: data/org.ayatana.indicator.display.gschema.xml:19 msgid "Current geographic longitude" -msgstr "" +msgstr "தற்போதைய புவியியல் தீர்க்கரேகை" #: data/org.ayatana.indicator.display.gschema.xml:20 msgid "Stores the last recorded geographic longitude of the device." msgstr "" +"சாதனத்தின் கடைசியாக பதிவு செய்யப்பட்ட புவியியல் தீர்க்கரேகையை சேமிக்கிறது." #: src/service.cpp:48 msgid "Manual" -msgstr "" +msgstr "கையேடு" #: src/service.cpp:49 msgid "Adaptive (Colder)" -msgstr "" +msgstr "தகவமைப்பு (குளிர்)" #: src/service.cpp:50 src/service.cpp:657 msgid "Adaptive" -msgstr "" +msgstr "தகவமைப்பு" #: src/service.cpp:51 msgid "Adaptive (Warmer)" -msgstr "" +msgstr "தகவமைப்பு (வெப்பமானது)" #: src/service.cpp:544 src/service.cpp:581 msgid "Rotation Lock" -msgstr "" +msgstr "சுழற்சி பூட்டு" #: src/service.cpp:597 msgid "Brightness" -msgstr "" +msgstr "வெளிச்சம்" #: src/service.cpp:651 msgid "Light" -msgstr "" +msgstr "ஒளி" #: src/service.cpp:654 msgid "Dark" -msgstr "" +msgstr "இருண்ட" #: src/service.cpp:667 msgid "Display settings…" -msgstr "" +msgstr "அமைப்புகளைக் காண்பி…" #: src/service.cpp:680 msgid "Rotation" -msgstr "" +msgstr "சுழற்சி" #: src/service.cpp:691 msgid "Display" -msgstr "" +msgstr "காட்சி" #: src/service.cpp:692 msgid "Display settings and features" -msgstr "" +msgstr "அமைப்புகள் மற்றும் அம்சங்களைக் காண்பி" #: src/usb-snap.cpp:109 #, c-format diff --git a/src/dbus-names.h b/src/dbus-names.h deleted file mode 100644 index aa7ef2a..0000000 --- a/src/dbus-names.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2016 Canonical Ltd. - * - * 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 - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, 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/>. - * - * Authors: - * Charles Kerr <charles.kerr@canonical.com> - */ - -#pragma once - -namespace DBusNames -{ - namespace Notify - { - static constexpr char const * NAME = "org.freedesktop.Notifications"; - static constexpr char const * PATH = "/org/freedesktop/Notifications"; - static constexpr char const * INTERFACE = "org.freedesktop.Notifications"; - - namespace ActionInvoked - { - static constexpr char const * NAME = "ActionInvoked"; - } - - namespace NotificationClosed - { - static constexpr char const * NAME = "NotificationClosed"; - enum Reason { EXPIRED=1, DISMISSED=2, API=3, UNDEFINED=4 }; - } - } - - namespace Greeter - { - static constexpr char const * NAME = "org.ayatana.Greeter"; - static constexpr char const * PATH = "/"; - static constexpr char const * INTERFACE = "org.ayatana.Greeter"; - } - - namespace Properties - { - static constexpr char const * INTERFACE = "org.freedesktop.DBus.Properties"; - - namespace PropertiesChanged - { - static constexpr char const* NAME = "PropertiesChanged"; - static constexpr char const* ARGS_VARIANT_TYPE = "(sa{sv}as)"; - } - } -} diff --git a/src/indicator.h b/src/indicator.h index c9ccb1e..db8c5ac 100644 --- a/src/indicator.h +++ b/src/indicator.h @@ -65,7 +65,7 @@ class SimpleProfile: public Profile { public: SimpleProfile(const char* name, const std::shared_ptr<GMenuModel>& menu): m_name(name), m_menu(menu) {} - virtual ~SimpleProfile(); + virtual ~SimpleProfile() override; std::string name() const override {return m_name;} core::Property<Header>& header() override {return m_header;} diff --git a/src/main.cpp b/src/main.cpp index a422610..c03a5ec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -48,6 +48,20 @@ main(int /*argc*/, char** /*argv*/) // boilerplate i18n setlocale(LC_ALL, ""); + + // Initialize LC_NUMERIC with 'POSIX'. This assures that float number + // conversions (from float to string via e.g. g_strdup_sprintf()) always + // use a dot in decimal numbers. + // + // This resolves blackening of the screen if users with e.g. de_DE.UTF-8 + // use the brightness slider and hand over a komma-decimal to the xsct + // executable (which only understands dot-decimals). + // + // As we don't use numbers / number conversions anywhere else in the + // display indicator, this global setting of LC_NUMERIC seems to be the + // easiest approach. + setlocale(LC_NUMERIC, "POSIX"); + bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); textdomain(GETTEXT_PACKAGE); diff --git a/src/service.cpp b/src/service.cpp index 26faec9..d6b4ed7 100644 --- a/src/service.cpp +++ b/src/service.cpp @@ -1,6 +1,6 @@ /* * Copyright 2014 Canonical Ltd. - * Copyright 2023-2024 Robert Tari + * Copyright 2023-2025 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 @@ -24,6 +24,13 @@ #ifdef COLOR_TEMP_ENABLED #include <geoclue.h> + + #ifdef RDA_ENABLED + #include <rda/rda.h> + #endif + + #include <X11/Xlib.h> + #include <X11/extensions/Xrandr.h> #endif extern "C" @@ -67,6 +74,81 @@ public: #ifdef COLOR_TEMP_ENABLED const gchar *sTest = g_getenv ("TEST_NAME"); this->bTest = (sTest != NULL && g_str_equal (sTest, "rotation-lock-test")); + + if (!this->bTest) + { + // Check if we are on Wayland + const gchar *sWayland = g_getenv ("WAYLAND_DISPLAY"); + this->bXsctUnsupported = (sWayland != NULL); + //~Check if we are on Wayland + + // Check if we are in a virtual environment + if (!this->bXsctUnsupported) + { + Display *pDisplay = XOpenDisplay (NULL); + + if (!pDisplay) + { + g_warning ("Panic: Failed to open X display while checking for virtual environment"); + } + else + { + guint nScreen = DefaultScreen (pDisplay); + Window pWindow = RootWindow (pDisplay, nScreen); + XRRScreenResources *pResources = XRRGetScreenResources (pDisplay, pWindow); + + if (!pResources) + { + g_warning ("Panic: Failed to get screen resources while checking for virtual environment"); + XCloseDisplay (pDisplay); + } + else + { + RROutput nOutputPrimary = XRRGetOutputPrimary (pDisplay, pWindow); + XRROutputInfo *pOutputInfo = XRRGetOutputInfo (pDisplay, pResources, nOutputPrimary); + GRegex *pRegex = NULL; + GError *pError = NULL; + + #if GLIB_CHECK_VERSION(2, 73, 0) + pRegex = g_regex_new (".*virtual.*", G_REGEX_CASELESS, G_REGEX_MATCH_DEFAULT, &pError); + #else + pRegex = g_regex_new (".*virtual.*", G_REGEX_CASELESS, (GRegexMatchFlags) 0, &pError); + #endif + + if (!pError) + { + #if GLIB_CHECK_VERSION(2, 73, 0) + gboolean bMatch = g_regex_match (pRegex, pOutputInfo->name, G_REGEX_MATCH_DEFAULT, NULL); + #else + gboolean bMatch = g_regex_match (pRegex, pOutputInfo->name, (GRegexMatchFlags) 0, NULL); + #endif + + if (bMatch) + { + this->bXsctUnsupported = TRUE; + } + + g_regex_unref (pRegex); + } + else + { + g_warning ("PANIC: Failed to compile regex: %s", pError->message); + g_error_free (pError); + } + + XRRFreeOutputInfo (pOutputInfo); + XRRFreeScreenResources (pResources); + XCloseDisplay (pDisplay); + + #ifdef RDA_ENABLED + gboolean bRemote = rda_session_is_remote (); + this->bXsctUnsupported = this->bXsctUnsupported || bRemote; + #endif + } + } + } + //~Check if we are in a virtual environment + } #endif const char *sUserName = g_get_user_name(); this->bGreeter = g_str_equal (sUserName, "lightdm"); @@ -76,7 +158,7 @@ public: { if (ayatana_common_utils_is_lomiri()) { - GSettingsSchema *pSchema = g_settings_schema_source_lookup(pSource, "com.lomiri.touch.system", FALSE); + GSettingsSchema *pSchema = g_settings_schema_source_lookup(pSource, "com.lomiri.touch.system", TRUE); if (pSchema != NULL) { @@ -85,13 +167,12 @@ public: } else { - g_error("No schema could be found"); + g_error ("Panic: No com.lomiri.touch.system schema could be found"); } - } else { - GSettingsSchema *pSchema = g_settings_schema_source_lookup(pSource, "org.ayatana.indicator.display", FALSE); + GSettingsSchema *pSchema = g_settings_schema_source_lookup(pSource, "org.ayatana.indicator.display", TRUE); if (pSchema != NULL) { @@ -100,7 +181,7 @@ public: } else { - g_error("No schema could be found"); + g_error ("Panic: No org.ayatana.indicator.display schema could be found"); } #ifdef COLOR_TEMP_ENABLED @@ -134,40 +215,40 @@ public: } } - pSchema = g_settings_schema_source_lookup (pSource, sSchema, FALSE); + pSchema = g_settings_schema_source_lookup (pSource, sSchema, TRUE); if (pSchema != NULL) { g_settings_schema_unref (pSchema); - pThemeSettings = g_settings_new (sSchema); + this->pThemeSettings = g_settings_new (sSchema); } else { - g_error("No %s schema could be found", sSchema); + g_warning ("Panic: No %s schema could be found", sSchema); } - pSchema = g_settings_schema_source_lookup (pSource, sCursorSchema, FALSE); + pSchema = g_settings_schema_source_lookup (pSource, sCursorSchema, TRUE); if (pSchema != NULL) { g_settings_schema_unref (pSchema); - pCursorSettings = g_settings_new (sCursorSchema); + this->pCursorSettings = g_settings_new (sCursorSchema); } else { - g_error("No %s schema could be found", sCursorSchema); + g_warning ("Panic: No %s schema could be found", sCursorSchema); } - pSchema = g_settings_schema_source_lookup (pSource, sMetacitySchema, FALSE); + pSchema = g_settings_schema_source_lookup (pSource, sMetacitySchema, TRUE); if (pSchema != NULL) { g_settings_schema_unref (pSchema); - pMetacitySettings = g_settings_new (sMetacitySchema); + this->pMetacitySettings = g_settings_new (sMetacitySchema); } else { - g_error("No %s schema could be found", sMetacitySchema); + g_warning ("Panic: No %s schema could be found", sMetacitySchema); } if (this->bTest) @@ -179,7 +260,7 @@ public: sSchema = "org.gnome.desktop.interface"; } - pSchema = g_settings_schema_source_lookup (pSource, sSchema, FALSE); + pSchema = g_settings_schema_source_lookup (pSource, sSchema, TRUE); if (pSchema != NULL) { @@ -188,7 +269,7 @@ public: if (bColorScheme) { - pColorSchemeSettings = g_settings_new (sSchema); + this->pColorSchemeSettings = g_settings_new (sSchema); } else { @@ -197,7 +278,7 @@ public: } else { - g_error("No %s schema could be found", sSchema); + g_warning ("Panic: No %s schema could be found", sSchema); } } else @@ -224,7 +305,7 @@ public: if (!ayatana_common_utils_is_lomiri()) { - icon_name = "display-panel"; + icon_name = "video-display-panel"; } auto icon = g_themed_icon_new_with_default_fallbacks(icon_name); @@ -240,7 +321,13 @@ public: // build the desktop profile std::shared_ptr<GMenuModel> desktop_menu (create_desktop_menu(), menu_model_deleter); m_desktop = std::make_shared<SimpleProfile>("desktop", desktop_menu); - update_desktop_header(); + gboolean bVisible = !this->bGreeter; + + #ifdef COLOR_TEMP_ENABLED + bVisible = bVisible || !this->bXsctUnsupported; + #endif + + update_desktop_header(bVisible); #ifdef COLOR_TEMP_ENABLED if (ayatana_common_utils_is_lomiri() == FALSE) @@ -285,25 +372,10 @@ public: g_free (sLastTheme); } - if (pThemeSettings) - { - g_clear_object (&pThemeSettings); - } - - if (pCursorSettings) - { - g_clear_object (&pCursorSettings); - } - - if (pMetacitySettings) - { - g_clear_object (&pMetacitySettings); - } - - if (pColorSchemeSettings) - { - g_clear_object (&pColorSchemeSettings); - } + g_clear_object (&pThemeSettings); + g_clear_object (&pCursorSettings); + g_clear_object (&pMetacitySettings); + g_clear_object (&pColorSchemeSettings); if (this->pAccountsServiceConnection) { @@ -334,40 +406,43 @@ private: #ifdef COLOR_TEMP_ENABLED static void onUserChanged (GDBusConnection *pConnection, const gchar *sSender, const gchar *sPath, const gchar *sInterface, const gchar *sSignal, GVariant *pParameters, gpointer pUserData) { - DisplayIndicator::Impl *pImpl = (DisplayIndicator::Impl*) pUserData; + DisplayIndicator::Impl *pImpl = static_cast<DisplayIndicator::Impl*>(pUserData); g_variant_get (pParameters, "(s)", &pImpl->sUser); loadManager (pImpl); } static void getAccountsService (DisplayIndicator::Impl *pImpl, gint nUid) { - pImpl->bReadingAccountsService = TRUE; - gchar *sPath = g_strdup_printf ("/org/freedesktop/Accounts/User%i", nUid); - GDBusProxy *pProxy = g_dbus_proxy_new_sync (pImpl->pAccountsServiceConnection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.Accounts", sPath, "org.freedesktop.DBus.Properties", NULL, NULL); - g_free (sPath); - - if (pProxy) + if (!pImpl->bXsctUnsupported) { - const gchar *lProperties[] = {"brightness", "color-temp", "color-temp-profile"}; + pImpl->bReadingAccountsService = TRUE; + gchar *sPath = g_strdup_printf ("/org/freedesktop/Accounts/User%i", nUid); + GDBusProxy *pProxy = g_dbus_proxy_new_sync (pImpl->pAccountsServiceConnection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.Accounts", sPath, "org.freedesktop.DBus.Properties", NULL, NULL); + g_free (sPath); - for (gint nIndex = 0; nIndex < 3; nIndex++) + if (pProxy) { - GVariant *pParams = g_variant_new ("(ss)", "org.ayatana.indicator.display.AccountsService", lProperties[nIndex]); - GVariant *pValue = g_dbus_proxy_call_sync (pProxy, "Get", pParams, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL); + const gchar *lProperties[] = {"brightness", "color-temp", "color-temp-profile"}; - if (pValue) + for (gint nIndex = 0; nIndex < 3; nIndex++) { - GVariant *pChild0 = g_variant_get_child_value (pValue, 0); - g_variant_unref (pValue); - GVariant *pChild1 = g_variant_get_child_value (pChild0, 0); - g_variant_unref (pChild0); - g_settings_set_value (pImpl->m_settings, lProperties[nIndex], pChild1); - g_variant_unref (pChild1); + GVariant *pParams = g_variant_new ("(ss)", "org.ayatana.indicator.display.AccountsService", lProperties[nIndex]); + GVariant *pValue = g_dbus_proxy_call_sync (pProxy, "Get", pParams, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL); + + if (pValue) + { + GVariant *pChild0 = g_variant_get_child_value (pValue, 0); + g_variant_unref (pValue); + GVariant *pChild1 = g_variant_get_child_value (pChild0, 0); + g_variant_unref (pChild0); + g_settings_set_value (pImpl->m_settings, lProperties[nIndex], pChild1); + g_variant_unref (pChild1); + } } } - } - pImpl->bReadingAccountsService = FALSE; + pImpl->bReadingAccountsService = FALSE; + } } static void onUserLoaded (DisplayIndicator::Impl *pImpl, ActUser *pUser) @@ -449,7 +524,7 @@ private: static gboolean updateColor (gpointer pData) { - DisplayIndicator::Impl *pImpl = (DisplayIndicator::Impl*) pData; + DisplayIndicator::Impl *pImpl = static_cast<DisplayIndicator::Impl*>(pData); if (pImpl->bReadingAccountsService) { @@ -457,8 +532,14 @@ private: } guint nProfile = 0; - g_settings_get (pImpl->m_settings, "color-temp-profile", "q", &nProfile); - gdouble fBrightness = g_settings_get_double (pImpl->m_settings, "brightness"); + gdouble fBrightness = 0.0; + + if (!pImpl->bXsctUnsupported) + { + g_settings_get (pImpl->m_settings, "color-temp-profile", "q", &nProfile); + fBrightness = g_settings_get_double (pImpl->m_settings, "brightness"); + } + gchar *sThemeProfile = NULL; gboolean bThemeAdaptive = FALSE; @@ -474,25 +555,28 @@ private: gint64 nNow = g_get_real_time (); gdouble fElevation = solar_elevation((gdouble) nNow / 1000000.0, pImpl->fLatitude, pImpl->fLongitude); - if (nProfile == 0) - { - g_settings_get (pImpl->m_settings, "color-temp", "q", &nTemperature); - } - else + if (!pImpl->bXsctUnsupported) { - gdouble fShifting = 0.0; - - if (fElevation < SOLAR_CIVIL_TWILIGHT_ELEV) + if (nProfile == 0) { - fShifting = 1.0; + g_settings_get (pImpl->m_settings, "color-temp", "q", &nTemperature); } - else if (fElevation < 3.0) + else { - fShifting = 1.0 - ((SOLAR_CIVIL_TWILIGHT_ELEV - fElevation) / (SOLAR_CIVIL_TWILIGHT_ELEV - 3.0)); - } + gdouble fShifting = 0.0; - nTemperature = m_lTempProfiles[nProfile].nTempHigh - (m_lTempProfiles[nProfile].nTempHigh - m_lTempProfiles[nProfile].nTempLow) * fShifting; - pImpl->bAutoSliderUpdate = TRUE; + if (fElevation < SOLAR_CIVIL_TWILIGHT_ELEV) + { + fShifting = 1.0; + } + else if (fElevation < 3.0) + { + fShifting = 1.0 - ((SOLAR_CIVIL_TWILIGHT_ELEV - fElevation) / (SOLAR_CIVIL_TWILIGHT_ELEV - 3.0)); + } + + nTemperature = m_lTempProfiles[nProfile].nTempHigh - (m_lTempProfiles[nProfile].nTempHigh - m_lTempProfiles[nProfile].nTempLow) * fShifting; + pImpl->bAutoSliderUpdate = TRUE; + } } if (!pImpl->bGreeter) @@ -529,57 +613,63 @@ private: } } - if (pImpl->fLastBrightness != fBrightness || pImpl->nLasColorTemp != nTemperature) + if (!pImpl->bXsctUnsupported) { - g_debug ("Calling xsct with %u %f", nTemperature, fBrightness); + if (pImpl->fLastBrightness != fBrightness || pImpl->nLasColorTemp != nTemperature) + { + g_debug ("Calling xsct with %u %f", nTemperature, fBrightness); - GAction *pAction = g_action_map_lookup_action (G_ACTION_MAP (pImpl->m_action_group), "color-temp"); - GVariant *pTemperature = g_variant_new_double (nTemperature); - g_action_change_state (pAction, pTemperature); + GAction *pAction = g_action_map_lookup_action (G_ACTION_MAP (pImpl->m_action_group), "color-temp"); + GVariant *pTemperature = g_variant_new_double (nTemperature); + g_action_change_state (pAction, pTemperature); - GError *pError = NULL; - gchar *sCommand = g_strdup_printf ("xsct %u %f", nTemperature, fBrightness); - gboolean bSuccess = g_spawn_command_line_sync (sCommand, NULL, NULL, NULL, &pError); + GError *pError = NULL; + gchar *sCommand = g_strdup_printf ("xsct %u %f", nTemperature, fBrightness); + gboolean bSuccess = g_spawn_command_line_sync (sCommand, NULL, NULL, NULL, &pError); - if (!bSuccess) - { - g_error ("The call to '%s' failed: %s", sCommand, pError->message); - g_error_free (pError); - } + if (!bSuccess) + { + g_warning ("Panic: The call to '%s' failed: %s", sCommand, pError->message); + g_error_free (pError); + } + else + { + pImpl->fLastBrightness = fBrightness; + pImpl->nLasColorTemp = nTemperature; + gint nUid = 0; - pImpl->fLastBrightness = fBrightness; - pImpl->nLasColorTemp = nTemperature; - g_free (sCommand); - gint nUid = 0; + if (!pImpl->bGreeter) + { + nUid = geteuid (); + } + else if (pImpl->sUser) + { + const struct passwd *pPasswd = getpwnam (pImpl->sUser); - if (!pImpl->bGreeter) - { - nUid = geteuid (); - } - else if (pImpl->sUser) - { - const struct passwd *pPasswd = getpwnam (pImpl->sUser); + if (pPasswd) + { + nUid = pPasswd->pw_uid; + } + } - if (pPasswd) - { - nUid = pPasswd->pw_uid; + if (nUid) + { + gchar *sPath = g_strdup_printf ("/org/freedesktop/Accounts/User%i", nUid); + GDBusProxy *pProxy = g_dbus_proxy_new_sync (pImpl->pAccountsServiceConnection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.Accounts", sPath, "org.freedesktop.DBus.Properties", NULL, NULL); + g_free (sPath); + GVariant *pBrightnessValue = g_variant_new ("d", pImpl->fLastBrightness); + GVariant *pBrightnessParams = g_variant_new ("(ssv)", "org.ayatana.indicator.display.AccountsService", "brightness", pBrightnessValue); + g_dbus_proxy_call (pProxy, "Set", pBrightnessParams, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); + GVariant *pColorTempValue = g_variant_new ("q", pImpl->nLasColorTemp); + GVariant *pColorTempParams = g_variant_new ("(ssv)", "org.ayatana.indicator.display.AccountsService", "color-temp", pColorTempValue); + g_dbus_proxy_call (pProxy, "Set", pColorTempParams, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); + GVariant *pProfileValue = g_variant_new ("q", nProfile); + GVariant *pProfileParams = g_variant_new ("(ssv)", "org.ayatana.indicator.display.AccountsService", "color-temp-profile", pProfileValue); + g_dbus_proxy_call (pProxy, "Set", pProfileParams, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); + } } - } - if (nUid) - { - gchar *sPath = g_strdup_printf ("/org/freedesktop/Accounts/User%i", nUid); - GDBusProxy *pProxy = g_dbus_proxy_new_sync (pImpl->pAccountsServiceConnection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.Accounts", sPath, "org.freedesktop.DBus.Properties", NULL, NULL); - g_free (sPath); - GVariant *pBrightnessValue = g_variant_new ("d", pImpl->fLastBrightness); - GVariant *pBrightnessParams = g_variant_new ("(ssv)", "org.ayatana.indicator.display.AccountsService", "brightness", pBrightnessValue); - g_dbus_proxy_call (pProxy, "Set", pBrightnessParams, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); - GVariant *pColorTempValue = g_variant_new ("q", pImpl->nLasColorTemp); - GVariant *pColorTempParams = g_variant_new ("(ssv)", "org.ayatana.indicator.display.AccountsService", "color-temp", pColorTempValue); - g_dbus_proxy_call (pProxy, "Set", pColorTempParams, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); - GVariant *pProfileValue = g_variant_new ("q", nProfile); - GVariant *pProfileParams = g_variant_new ("(ssv)", "org.ayatana.indicator.display.AccountsService", "color-temp-profile", pProfileValue); - g_dbus_proxy_call (pProxy, "Set", pProfileParams, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); + g_free (sCommand); } } @@ -608,7 +698,11 @@ private: { g_debug ("Changing theme to %s", sTheme); - g_settings_set_string (pImpl->pThemeSettings, "gtk-theme", sTheme); + if (pImpl->pThemeSettings) + { + g_settings_set_string (pImpl->pThemeSettings, "gtk-theme", sTheme); + } + gchar *sThemePath = g_strdup_printf ("/usr/share/themes/%s/index.theme", sTheme); gboolean bThemePath = g_file_test (sThemePath, G_FILE_TEST_EXISTS); @@ -639,7 +733,12 @@ private: if (bMatch) { gchar *sIconTheme = g_match_info_fetch (pMatchInfo, 1); - g_settings_set_string (pImpl->pThemeSettings, "icon-theme", sIconTheme); + + if (pImpl->pThemeSettings) + { + g_settings_set_string (pImpl->pThemeSettings, "icon-theme", sIconTheme); + } + g_free (sIconTheme); } else @@ -652,7 +751,7 @@ private: } else { - g_error ("PANIC: Failed to compile regex: %s", pError->message); + g_warning ("Panic: Failed to compile regex: %s", pError->message); g_error_free (pError); } @@ -675,7 +774,12 @@ private: if (bMatch) { gchar *sMetacityTheme = g_match_info_fetch (pMatchInfo, 1); - g_settings_set_string (pImpl->pMetacitySettings, "theme", sMetacityTheme); + + if (pImpl->pMetacitySettings) + { + g_settings_set_string (pImpl->pMetacitySettings, "theme", sMetacityTheme); + } + g_free (sMetacityTheme); } else @@ -688,7 +792,7 @@ private: } else { - g_error ("PANIC: Failed to compile regex: %s", pError->message); + g_warning ("Panic: Failed to compile regex: %s", pError->message); g_error_free (pError); } @@ -711,7 +815,12 @@ private: if (bMatch) { gchar *sCursorTheme = g_match_info_fetch (pMatchInfo, 1); - g_settings_set_string (pImpl->pCursorSettings, "cursor-theme", sTheme); + + if (pImpl->pCursorSettings) + { + g_settings_set_string (pImpl->pCursorSettings, "cursor-theme", sTheme); + } + g_free (sCursorTheme); } else @@ -724,7 +833,7 @@ private: } else { - g_error ("PANIC: Failed to compile regex: %s", pError->message); + g_warning ("Panic: Failed to compile regex: %s", pError->message); g_error_free (pError); } @@ -732,7 +841,7 @@ private: } else { - g_error ("PANIC: Failed to get index.theme contents: %s", pError->message); + g_warning ("Panic: Failed to get index.theme contents: %s", pError->message); g_error_free (pError); } } @@ -760,7 +869,7 @@ private: static void onGeoClueLoaded (GObject *pObject, GAsyncResult *pResult, gpointer pData) { - DisplayIndicator::Impl *pImpl = (DisplayIndicator::Impl*) pData; + DisplayIndicator::Impl *pImpl = static_cast<DisplayIndicator::Impl*>(pData); GError *pError = NULL; GClueSimple *pSimple = gclue_simple_new_finish (pResult, &pError); @@ -816,7 +925,7 @@ private: { g_simple_action_set_state (pAction, pVariant); - DisplayIndicator::Impl *pImpl = (DisplayIndicator::Impl*) pData; + DisplayIndicator::Impl *pImpl = static_cast<DisplayIndicator::Impl*>(pData); if (pImpl->bAutoSliderUpdate) { @@ -880,36 +989,39 @@ private: #ifdef COLOR_TEMP_ENABLED if (ayatana_common_utils_is_lomiri() == FALSE) { - pVariantType = g_variant_type_new ("d"); - guint nTemperature = 0; - g_settings_get (this->m_settings, "color-temp", "q", &nTemperature); - action = g_simple_action_new_stateful ("color-temp", pVariantType, g_variant_new_double (nTemperature)); - g_variant_type_free (pVariantType); - g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (action)); - g_signal_connect (m_settings, "changed::color-temp", G_CALLBACK (onColorTempSettings), this); - g_signal_connect (action, "change-state", G_CALLBACK (onColorTempState), this); - g_object_unref(G_OBJECT (action)); + if (!this->bXsctUnsupported) + { + pVariantType = g_variant_type_new ("d"); + guint nTemperature = 0; + g_settings_get (this->m_settings, "color-temp", "q", &nTemperature); + action = g_simple_action_new_stateful ("color-temp", pVariantType, g_variant_new_double (nTemperature)); + g_variant_type_free (pVariantType); + g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (action)); + g_signal_connect (m_settings, "changed::color-temp", G_CALLBACK (onColorTempSettings), this); + g_signal_connect (action, "change-state", G_CALLBACK (onColorTempState), this); + g_object_unref(G_OBJECT (action)); - pVariantType = g_variant_type_new ("s"); - guint nProfile = 0; - g_settings_get (this->m_settings, "color-temp-profile", "q", &nProfile); - gchar *sProfile = g_strdup_printf ("%i", nProfile); - action = g_simple_action_new_stateful ("profile", pVariantType, g_variant_new_string (sProfile)); - g_free (sProfile); - g_variant_type_free (pVariantType); - g_settings_bind_with_mapping (this->m_settings, "color-temp-profile", action, "state", G_SETTINGS_BIND_DEFAULT, settingsIntToActionStateString, actionStateStringToSettingsInt, NULL, NULL); - g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(action)); - g_object_unref(G_OBJECT(action)); - g_signal_connect_swapped (m_settings, "changed::color-temp-profile", G_CALLBACK (updateColor), this); - - pVariantType = g_variant_type_new("d"); - gdouble fBrightness = g_settings_get_double (this->m_settings, "brightness"); - action = g_simple_action_new_stateful ("brightness", pVariantType, g_variant_new_double (fBrightness)); - g_variant_type_free(pVariantType); - g_settings_bind_with_mapping (m_settings, "brightness", action, "state", G_SETTINGS_BIND_DEFAULT, settings_to_action_state, action_state_to_settings, NULL, NULL); - g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (action)); - g_object_unref (G_OBJECT (action)); - g_signal_connect_swapped (m_settings, "changed::brightness", G_CALLBACK (updateColor), this); + pVariantType = g_variant_type_new ("s"); + guint nProfile = 0; + g_settings_get (this->m_settings, "color-temp-profile", "q", &nProfile); + gchar *sProfile = g_strdup_printf ("%i", nProfile); + action = g_simple_action_new_stateful ("profile", pVariantType, g_variant_new_string (sProfile)); + g_free (sProfile); + g_variant_type_free (pVariantType); + g_settings_bind_with_mapping (this->m_settings, "color-temp-profile", action, "state", G_SETTINGS_BIND_DEFAULT, settingsIntToActionStateString, actionStateStringToSettingsInt, NULL, NULL); + g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(action)); + g_object_unref(G_OBJECT(action)); + g_signal_connect_swapped (m_settings, "changed::color-temp-profile", G_CALLBACK (updateColor), this); + + pVariantType = g_variant_type_new("d"); + gdouble fBrightness = g_settings_get_double (this->m_settings, "brightness"); + action = g_simple_action_new_stateful ("brightness", pVariantType, g_variant_new_double (fBrightness)); + g_variant_type_free(pVariantType); + g_settings_bind_with_mapping (m_settings, "brightness", action, "state", G_SETTINGS_BIND_DEFAULT, settings_to_action_state, action_state_to_settings, NULL, NULL); + g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (action)); + g_object_unref (G_OBJECT (action)); + g_signal_connect_swapped (m_settings, "changed::brightness", G_CALLBACK (updateColor), this); + } if (!this->bGreeter) { @@ -1003,69 +1115,71 @@ private: #ifdef COLOR_TEMP_ENABLED section = g_menu_new (); - GIcon *pIconMin = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-brightness-low"); - GIcon *pIconMax = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-brightness-high"); - GVariant *pIconMinSerialised = g_icon_serialize (pIconMin); - GVariant *pIconMaxSerialised = g_icon_serialize (pIconMax); - menu_item = g_menu_item_new (_("Brightness"), "indicator.brightness"); - g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.slider"); - g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.slider"); - g_menu_item_set_attribute_value (menu_item, "min-icon", pIconMinSerialised); - g_menu_item_set_attribute_value (menu_item, "max-icon", pIconMaxSerialised); - g_menu_item_set_attribute (menu_item, "min-value", "d", 0.5); - g_menu_item_set_attribute (menu_item, "max-value", "d", 1.0); - g_menu_item_set_attribute (menu_item, "step", "d", 0.01); - g_menu_item_set_attribute (menu_item, "digits", "y", 2); - g_menu_append_item (section, menu_item); - - pIconMin = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-colortemp-on"); - pIconMax = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-colortemp-off"); - pIconMinSerialised = g_icon_serialize (pIconMin); - pIconMaxSerialised = g_icon_serialize (pIconMax); - menu_item = g_menu_item_new (_("Color temperature"), "indicator.color-temp"); - g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.slider"); - g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.slider"); - g_menu_item_set_attribute_value (menu_item, "min-icon", pIconMinSerialised); - g_menu_item_set_attribute_value (menu_item, "max-icon", pIconMaxSerialised); - g_menu_item_set_attribute (menu_item, "min-value", "d", 3000.0); - g_menu_item_set_attribute (menu_item, "max-value", "d", 6500.0); - g_menu_item_set_attribute (menu_item, "step", "d", 100.0); - g_menu_item_set_attribute (menu_item, "digits", "y", 0); - g_menu_append_item (section, menu_item); - - GMenu *pMenuProfiles = g_menu_new (); - GMenuItem *pItemProfiles = g_menu_item_new_submenu (_("Color temperature profile"), G_MENU_MODEL (pMenuProfiles)); - guint nProfile = 0; - - while (m_lTempProfiles[nProfile].sName != NULL) + if (!this->bXsctUnsupported) { - gchar *sAction = g_strdup_printf ("indicator.profile::%u", nProfile); - gchar *sName = gettext (m_lTempProfiles[nProfile].sName); - GMenuItem *pItemProfile = g_menu_item_new (sName, sAction); - g_free(sAction); - g_menu_append_item (pMenuProfiles, pItemProfile); - g_object_unref (pItemProfile); + GIcon *pIconMin = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-brightness-low"); + GIcon *pIconMax = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-brightness-high"); + GVariant *pIconMinSerialised = g_icon_serialize (pIconMin); + GVariant *pIconMaxSerialised = g_icon_serialize (pIconMax); + menu_item = g_menu_item_new (_("Brightness"), "indicator.brightness"); + g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.slider"); + g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.slider"); + g_menu_item_set_attribute_value (menu_item, "min-icon", pIconMinSerialised); + g_menu_item_set_attribute_value (menu_item, "max-icon", pIconMaxSerialised); + g_menu_item_set_attribute (menu_item, "min-value", "d", 0.5); + g_menu_item_set_attribute (menu_item, "max-value", "d", 1.0); + g_menu_item_set_attribute (menu_item, "step", "d", 0.01); + g_menu_item_set_attribute (menu_item, "digits", "y", 2); + g_menu_append_item (section, menu_item); - nProfile++; - } + pIconMin = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-colortemp-on"); + pIconMax = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-colortemp-off"); + pIconMinSerialised = g_icon_serialize (pIconMin); + pIconMaxSerialised = g_icon_serialize (pIconMax); + menu_item = g_menu_item_new (_("Color temperature"), "indicator.color-temp"); + g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.slider"); + g_menu_item_set_attribute_value (menu_item, "min-icon", pIconMinSerialised); + g_menu_item_set_attribute_value (menu_item, "max-icon", pIconMaxSerialised); + g_menu_item_set_attribute (menu_item, "min-value", "d", 3000.0); + g_menu_item_set_attribute (menu_item, "max-value", "d", 6500.0); + g_menu_item_set_attribute (menu_item, "step", "d", 100.0); + g_menu_item_set_attribute (menu_item, "digits", "y", 0); + g_menu_append_item (section, menu_item); + + GMenu *pMenuProfiles = g_menu_new (); + GMenuItem *pItemProfiles = g_menu_item_new_submenu (_("Color temperature profile"), G_MENU_MODEL (pMenuProfiles)); + guint nProfile = 0; - g_menu_append_item (section, pItemProfiles); - g_object_unref (pItemProfiles); - g_object_unref (pMenuProfiles); + while (m_lTempProfiles[nProfile].sName != NULL) + { + gchar *sAction = g_strdup_printf ("indicator.profile::%u", nProfile); + gchar *sName = gettext (m_lTempProfiles[nProfile].sName); + GMenuItem *pItemProfile = g_menu_item_new (sName, sAction); + g_free(sAction); + g_menu_append_item (pMenuProfiles, pItemProfile); + g_object_unref (pItemProfile); + + nProfile++; + } - g_menu_append_section (menu, NULL, G_MENU_MODEL (section)); - g_object_unref (pIconMin); - g_object_unref (pIconMax); - g_variant_unref (pIconMinSerialised); - g_variant_unref (pIconMaxSerialised); - g_object_unref (section); - g_object_unref (menu_item); + g_menu_append_item (section, pItemProfiles); + g_object_unref (pItemProfiles); + g_object_unref (pMenuProfiles); + + g_menu_append_section (menu, NULL, G_MENU_MODEL (section)); + g_object_unref (pIconMin); + g_object_unref (pIconMax); + g_variant_unref (pIconMinSerialised); + g_variant_unref (pIconMaxSerialised); + g_object_unref (section); + g_object_unref (menu_item); + } if (!this->bGreeter) { section = g_menu_new (); - pMenuProfiles = g_menu_new (); - pItemProfiles = g_menu_item_new_submenu (_("Theme profile"), G_MENU_MODEL (pMenuProfiles)); + GMenu *pMenuProfiles = g_menu_new (); + GMenuItem *pItemProfiles = g_menu_item_new_submenu (_("Theme profile"), G_MENU_MODEL (pMenuProfiles)); GMenuItem *pItemProfile = g_menu_item_new (_("Light"), "indicator.theme::light"); g_menu_append_item (pMenuProfiles, pItemProfile); g_object_unref (pItemProfile); @@ -1108,13 +1222,13 @@ private: m_phone->header().set(h); } - void update_desktop_header() + void update_desktop_header(gboolean bVisible) { Header h; h.title = _("Display"); h.tooltip = _("Display settings and features"); h.a11y = h.title; - h.is_visible = TRUE; + h.is_visible = bVisible; h.icon = m_icon; m_desktop->header().set(h); } @@ -1149,6 +1263,7 @@ private: GSList *lUsers = NULL; gboolean bReadingAccountsService = FALSE; GDBusConnection *pAccountsServiceConnection = NULL; + gboolean bXsctUnsupported = FALSE; #endif }; diff --git a/src/service.h b/src/service.h index da8d8ba..f134853 100644 --- a/src/service.h +++ b/src/service.h @@ -30,7 +30,7 @@ class DisplayIndicator: public Indicator { public: DisplayIndicator(); - ~DisplayIndicator(); + ~DisplayIndicator() override; const char* name() const override; GSimpleActionGroup* action_group() const override; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 81e083c..bdc074f 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 --suppress=uselessOverride) +add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --check-level=exhaustive --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=constParameterCallback --suppress=unusedFunction --suppress=uselessOverride) add_subdirectory (unit) diff --git a/tests/utils/glib-fixture.h b/tests/utils/glib-fixture.h index ccdeccd..b56654b 100644 --- a/tests/utils/glib-fixture.h +++ b/tests/utils/glib-fixture.h @@ -35,7 +35,7 @@ class GlibFixture : public ::testing::Test { public: - virtual ~GlibFixture() =default; + virtual ~GlibFixture() override =default; protected: diff --git a/tests/utils/test-dbus-fixture.h b/tests/utils/test-dbus-fixture.h index b01405a..e98a002 100644 --- a/tests/utils/test-dbus-fixture.h +++ b/tests/utils/test-dbus-fixture.h @@ -30,7 +30,7 @@ class TestDBusFixture: public GlibFixture public: explicit TestDBusFixture() {}; - virtual ~TestDBusFixture() =default; + virtual ~TestDBusFixture() override =default; explicit TestDBusFixture(const std::vector<std::string>& service_dirs_in): service_dirs(service_dirs_in) {} |