Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/Indicator.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
* SPDX-FileCopyrightText: 2023 elementary, Inc. (https://elementary.io)
*/


quicksettings tattlebox box {
padding: 0.666rem; /* 6px */
}

quicksettings scalebox,
quicksettings .togglebox {
padding: 0.666rem; /* 6px */
Expand Down
1 change: 1 addition & 0 deletions po/POTFILES
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ src/Widgets/EndSessionDialog.vala
src/Widgets/RotationToggle.vala
src/Widgets/SessionBox.vala
src/Widgets/SettingsToggle.vala
src/Widgets/TattleBox.vala
src/Widgets/TextScale.vala
9 changes: 9 additions & 0 deletions src/DBus/GeoclueManager.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* SPDX-License-Identifier: GPL-2.0-or-later
* SPDX-FileCopyrightText: 2011-2024 elementary, Inc. (https://elementary.io)
*/

[DBus (name = "org.freedesktop.GeoClue2.Manager")]
interface QuickSettings.GeoclueManager : DBusProxy {
public abstract bool in_use { get; }
}
5 changes: 5 additions & 0 deletions src/PopoverWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public class QuickSettings.PopoverWidget : Gtk.Box {
}

construct {
var tattle_box = new TattleBox () {
halign = CENTER
};

var screen_reader = new SettingsToggle (
new ThemedIcon ("orca-symbolic"),
_("Screen Reader")
Expand Down Expand Up @@ -64,6 +68,7 @@ public class QuickSettings.PopoverWidget : Gtk.Box {
bottom_box.get_style_context ().add_class ("togglebox");

var 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));
Expand Down
41 changes: 41 additions & 0 deletions src/Widgets/TattleBox.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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);
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;
}
}
}
2 changes: 2 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ sources = [
'PopoverWidget.vala',
'DBus' / 'AccountsService.vala',
'DBus' / 'EndSessionDialogServer.vala',
'DBus' / 'GeoclueManager.vala',
'DBus' / 'LockInterface.vala',
'DBus' / 'SensorProxy.vala',
'DBus' / 'SessionInterface.vala',
Expand All @@ -21,6 +22,7 @@ sources = [
'Widgets' / 'RotationToggle.vala',
'Widgets' / 'SettingsToggle.vala',
'Widgets' / 'SessionBox.vala',
'Widgets' / 'TattleBox.vala',
'Widgets' / 'TextScale.vala',
]

Expand Down