status/system: Port to quick settings

This port is a bit messier than the previous ones, because the
existing menu section translates less directly to the new UI,
which uses a row of individual toggles for settings, lock and
shutdown.

In order to not complicate the grid layout further by supporting
rows with a different number of columns than the overall grid and
children at their natural size, create a custom, non-reactive
SystemItem item that spans an entire row, and contains the individual
toggles.

This works quite well, even with the shutdown item that uses a menu
for the various actions.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2393>
This commit is contained in:
Florian Müllner
2022-07-30 02:17:15 +02:00
committed by Marge Bot
parent 62c62eced0
commit ea00da7fd7
3 changed files with 160 additions and 136 deletions

View File

@ -378,18 +378,11 @@ class AggregateMenu extends PanelMenu.Button {
else
this._network = null;
this._system = new imports.ui.status.system.Indicator();
if (this._network)
this._indicators.add_child(this._network);
if (this._network)
this.menu.addMenuItem(this._network.menu);
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this.menu.addMenuItem(this._system.menu);
menuLayout.addSizeChild(this._system.menu.actor);
}
});
@ -410,6 +403,7 @@ class QuickSettings extends PanelMenu.Button {
else
this._bluetooth = null;
this._system = new imports.ui.status.system.Indicator();
this._volume = new imports.ui.status.volume.Indicator();
this._brightness = new imports.ui.status.brightness.Indicator();
this._remoteAccess = new imports.ui.status.remoteAccess.RemoteAccessApplet();
@ -437,7 +431,9 @@ class QuickSettings extends PanelMenu.Button {
this._indicators.add_child(this._volume);
this._indicators.add_child(this._unsafeMode);
this._indicators.add_child(this._power);
this._indicators.add_child(this._system);
this._addItems(this._system.quickSettingsItems, N_QUICK_SETTINGS_COLUMNS);
this._addItems(this._volume.quickSettingsItems, N_QUICK_SETTINGS_COLUMNS);
this._addItems(this._brightness.quickSettingsItems, N_QUICK_SETTINGS_COLUMNS);