status/power: Port to quick settings

The power indicator should not be a regular quick toggle, but
instead be part of a "system area" row at the top of the menu.

But as in the end it is still a simple button, we can do the
port to quick settings now, and move it later when the system
row is implemented.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
This commit is contained in:
Florian Müllner
2022-07-30 16:52:39 +02:00
committed by Marge Bot
parent 2ebdb6e318
commit 80d1f68c77
2 changed files with 93 additions and 103 deletions

View File

@ -378,7 +378,6 @@ class AggregateMenu extends PanelMenu.Button {
else
this._network = null;
this._power = new imports.ui.status.power.Indicator();
this._powerProfiles = new imports.ui.status.powerProfiles.Indicator();
this._volume = new imports.ui.status.volume.Indicator();
this._brightness = new imports.ui.status.brightness.Indicator();
@ -387,7 +386,6 @@ class AggregateMenu extends PanelMenu.Button {
if (this._network)
this._indicators.add_child(this._network);
this._indicators.add_child(this._volume);
this._indicators.add_child(this._power);
this._indicators.add_child(this._powerProfiles);
this.menu.addMenuItem(this._volume.menu);
@ -396,12 +394,10 @@ class AggregateMenu extends PanelMenu.Button {
if (this._network)
this.menu.addMenuItem(this._network.menu);
this.menu.addMenuItem(this._power.menu);
this.menu.addMenuItem(this._powerProfiles.menu);
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this.menu.addMenuItem(this._system.menu);
menuLayout.addSizeChild(this._power.menu.actor);
menuLayout.addSizeChild(this._powerProfiles.menu.actor);
menuLayout.addSizeChild(this._system.menu.actor);
}
@ -430,6 +426,7 @@ class QuickSettings extends PanelMenu.Button {
this._nightLight = new imports.ui.status.nightLight.Indicator();
this._rfkill = new imports.ui.status.rfkill.Indicator();
this._unsafeMode = new UnsafeModeIndicator();
this._power = new imports.ui.status.power.Indicator();
this._indicators.add_child(this._remoteAccess);
this._indicators.add_child(this._thunderbolt);
@ -439,6 +436,7 @@ class QuickSettings extends PanelMenu.Button {
this._indicators.add_child(this._bluetooth);
this._indicators.add_child(this._rfkill);
this._indicators.add_child(this._unsafeMode);
this._indicators.add_child(this._power);
this._addItems(this._remoteAccess.quickSettingsItems);
this._addItems(this._thunderbolt.quickSettingsItems);
@ -448,6 +446,7 @@ class QuickSettings extends PanelMenu.Button {
this._addItems(this._nightLight.quickSettingsItems);
this._addItems(this._rfkill.quickSettingsItems);
this._addItems(this._unsafeMode.quickSettingsItems);
this._addItems(this._power.quickSettingsItems);
}
_addItems(items, colSpan = 1) {