diff --git a/data/Indicator.css b/data/Indicator.css index 7570cda..688485b 100644 --- a/data/Indicator.css +++ b/data/Indicator.css @@ -1,8 +1,12 @@ /* * SPDX-License-Identifier: GPL-3.0-or-later - * SPDX-FileCopyrightText: 2023 elementary, Inc. (https://elementary.io) + * SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io) */ +quicksettings tattlebox box { + padding: 0.666rem; /* 6px */ +} + quicksettings scalebox, quicksettings .togglebox { padding: 0.666rem; /* 6px */ diff --git a/po/POTFILES b/po/POTFILES index eb1a914..c75d4e4 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -15,6 +15,7 @@ src/Widgets/PreventSleepToggle.vala src/Widgets/RotationToggle.vala src/Widgets/SessionBox.vala src/Widgets/SettingsToggle.vala +src/Widgets/TattleBox.vala src/Widgets/TextScale.vala src/Widgets/UserList.vala src/Widgets/UserRow.vala diff --git a/src/DBus/GeoclueManager.vala b/src/DBus/GeoclueManager.vala new file mode 100644 index 0000000..f907f8e --- /dev/null +++ b/src/DBus/GeoclueManager.vala @@ -0,0 +1,9 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * SPDX-FileCopyrightText: 2011-2025 elementary, Inc. (https://elementary.io) + */ + +[DBus (name = "org.freedesktop.GeoClue2.Manager")] +interface QuickSettings.GeoclueManager : DBusProxy { + public abstract bool in_use { get; } +} diff --git a/src/PopoverWidget.vala b/src/PopoverWidget.vala index 9dd331c..b1edc01 100644 --- a/src/PopoverWidget.vala +++ b/src/PopoverWidget.vala @@ -24,6 +24,10 @@ public class QuickSettings.PopoverWidget : Gtk.Box { } construct { + var tattle_box = new TattleBox () { + halign = CENTER + }; + var screen_reader = new SettingsToggle ( _("Screen Reader") ) { @@ -75,6 +79,7 @@ public class QuickSettings.PopoverWidget : Gtk.Box { bottom_box.get_style_context ().add_class ("togglebox"); main_box = new Gtk.Box (VERTICAL, 0); + main_box.add (tattle_box); main_box.add (toggle_box); main_box.add (scale_box); main_box.add (new Gtk.Separator (HORIZONTAL)); diff --git a/src/Widgets/TattleBox.vala b/src/Widgets/TattleBox.vala new file mode 100644 index 0000000..946c86a --- /dev/null +++ b/src/Widgets/TattleBox.vala @@ -0,0 +1,50 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * SPDX-FileCopyrightText: 2011-2025 elementary, Inc. (https://elementary.io) + */ + +public class QuickSettings.TattleBox : Gtk.Bin { + class construct { + set_css_name ("tattlebox"); + } + + construct { + var location_image = new Gtk.Image.from_icon_name ("location-active-symbolic", MENU); + location_image.get_style_context ().add_class (Granite.STYLE_CLASS_ACCENT); + location_image.get_style_context ().add_class ("purple"); + + var location_label = new Gtk.Label (_("Location services in use")); + + var location_box = new Gtk.Box (HORIZONTAL, 3); + location_box.add (location_image); + location_box.add (location_label); + + var location_revealer = new Gtk.Revealer () { + child = location_box + }; + + child = location_revealer; + + setup_geoclue_manager.begin ((obj, res) => { + var geoclue_manager = setup_geoclue_manager.end (res); + if (geoclue_manager == null) { + return; + } + + location_revealer.reveal_child = geoclue_manager.in_use; + + geoclue_manager.g_properties_changed.connect (() => { + location_revealer.reveal_child = geoclue_manager.in_use; + }); + }); + } + + private async GeoclueManager? setup_geoclue_manager () { + try { + return yield Bus.get_proxy (BusType.SYSTEM, "org.freedesktop.GeoClue2", "/org/freedesktop/GeoClue2/Manager"); + } catch (Error e) { + info ("Unable to connect to GeoClue2 bus, location tattle tale will not be available: %s", e.message); + return null; + } + } +} diff --git a/src/meson.build b/src/meson.build index 7a0cd82..a01d598 100644 --- a/src/meson.build +++ b/src/meson.build @@ -11,6 +11,7 @@ sources = [ 'Indicator.vala', 'PopoverWidget.vala', 'DBus' / 'EndSessionDialogServer.vala', + 'DBus' / 'GeoclueManager.vala', 'DBus' / 'LockInterface.vala', 'DBus' / 'SeatInterface.vala', 'DBus' / 'SensorProxy.vala', @@ -25,6 +26,7 @@ sources = [ 'Widgets' / 'RotationToggle.vala', 'Widgets' / 'SettingsToggle.vala', 'Widgets' / 'SessionBox.vala', + 'Widgets' / 'TattleBox.vala', 'Widgets' / 'TextScale.vala', 'Widgets' / 'UserList.vala', 'Widgets' / 'UserRow.vala',