aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-10-10 12:31:06 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-10-10 12:31:06 +0200
commitbaac68d16d2272f5b357e7caf3a3d9f3cdab6962 (patch)
tree72c9accd0b06d272dc44c568df62ba4f0b38ee26
parentff70460acbf19702464fcf22dc4c21fc20665d0e (diff)
parentb7af6626ab2aaf844e0f382cdadb26dffe6756a9 (diff)
downloadayatana-indicator-sound-baac68d16d2272f5b357e7caf3a3d9f3cdab6962.tar.gz
ayatana-indicator-sound-baac68d16d2272f5b357e7caf3a3d9f3cdab6962.tar.bz2
ayatana-indicator-sound-baac68d16d2272f5b357e7caf3a3d9f3cdab6962.zip
Merge branch 'tari01-pr/notification-orca'
Attributes GH PR #93: https://github.com/AyatanaIndicators/ayatana-indicator-sound/pull/93
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/info-notification.vala28
-rw-r--r--src/main.c3
3 files changed, 34 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6cd24f9..4c57477 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -44,6 +44,14 @@ vala_init(ayatana-indicator-sound-service
${VALA_DEFINE_LOMIRI_FEATURES_ENABLED}
)
+set_source_files_properties (warn-notification.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-function-pointer-types")
+set_source_files_properties (service.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-function-pointer-types")
+set_source_files_properties (volume-control-pulse.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-function-pointer-types")
+set_source_files_properties (volume-warning-pulse.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-function-pointer-types")
+set_source_files_properties (media-player-user.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-function-pointer-types")
+set_source_files_properties (media-player-mpris.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-function-pointer-types")
+set_source_files_properties (media-player-list-mpris.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-function-pointer-types")
+
vala_add(ayatana-indicator-sound-service
notification.vala
)
diff --git a/src/info-notification.vala b/src/info-notification.vala
index 4379acf..4e246b2 100644
--- a/src/info-notification.vala
+++ b/src/info-notification.vala
@@ -39,18 +39,36 @@ public class IndicatorSound.InfoNotification: Notification
/* Reset the notification */
var n = _notification;
-
- uint nChars = ((int32)((volume * 20) + 0.5)).clamp(0, 20);
volume_label += "\n";
+ int32 nValue = ((int32)((volume * 100.0) + 0.5)).clamp(0, 100);
+ SettingsSchemaSource pSource = SettingsSchemaSource.get_default ();
+ SettingsSchema pSchema = pSource.lookup ("org.gnome.desktop.a11y.applications", false);
+ bool bOrcaActive = false;
+
+ if (pSchema != null)
+ {
+ Settings pSettings = new Settings ("org.gnome.desktop.a11y.applications");
+ bOrcaActive = pSettings.get_boolean ("screen-reader-enabled");
+ }
- for (uint nChar = 0; nChar < nChars; nChar++)
+ if (bOrcaActive)
{
- volume_label += "◼";
+ string sValue = nValue.to_string ();
+ volume_label += sValue + "%";
+ }
+ else
+ {
+ uint nChars = ((int32)((volume * 20) + 0.5)).clamp(0, 20);
+
+ for (uint nChar = 0; nChar < nChars; nChar++)
+ {
+ volume_label += "◼";
+ }
}
n.update (_("Volume"), volume_label, icon);
n.clear_hints();
- n.set_hint ("value", ((int32)((volume * 100.0) + 0.5)).clamp(0, 100));
+ n.set_hint ("value", nValue);
show_notification ();
}
diff --git a/src/main.c b/src/main.c
index 8d65c01..a6c83b5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,5 +1,6 @@
/*
* Copyright 2015 Canonical Ltd.
+ * Copyright 2023 Robert Tari <robert@tari.in>
*
* 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,8 @@
*/
#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib-unix.h>
#include <locale.h>
#include <libnotify/notify.h>