[gnome-shell] quickSettings: Add SystemIndicator
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] quickSettings: Add SystemIndicator
- Date: Tue, 2 Aug 2022 16:09:06 +0000 (UTC)
commit f18d103f832c4f4fc1fb0efa93701d79b64b6952
Author: Florian Müllner <fmuellner gnome org>
Date: Sun Jul 24 19:29:50 2022 +0200
quickSettings: Add SystemIndicator
This serves the exact same purpose as the existing SystemIndicator
class from PanelMenu, except that it exposes a quickSettingsItems
array instead of a menu.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
js/ui/quickSettings.js | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/quickSettings.js b/js/ui/quickSettings.js
index 340d6a3753..0858d69228 100644
--- a/js/ui/quickSettings.js
+++ b/js/ui/quickSettings.js
@@ -1,4 +1,4 @@
-/* exported QuickToggle, QuickSettingsMenu */
+/* exported QuickToggle, QuickSettingsMenu, SystemIndicator */
const {Atk, Clutter, Gio, GLib, GObject, Pango, St} = imports.gi;
const Main = imports.ui.main;
@@ -268,3 +268,28 @@ var QuickSettingsMenu = class extends PopupMenu.PopupMenu {
this._grid, item, 'column-span', colSpan);
}
};
+
+var SystemIndicator = GObject.registerClass(
+class SystemIndicator extends St.BoxLayout {
+ _init() {
+ super._init({
+ style_class: 'panel-status-indicators-box',
+ reactive: true,
+ visible: false,
+ });
+
+ this.quickSettingsItems = [];
+ }
+
+ _syncIndicatorsVisible() {
+ this.visible = this.get_children().some(a => a.visible);
+ }
+
+ _addIndicator() {
+ const icon = new St.Icon({style_class: 'system-status-icon'});
+ this.add_actor(icon);
+ icon.connect('notify::visible', () => this._syncIndicatorsVisible());
+ this._syncIndicatorsVisible();
+ return icon;
+ }
+});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]