status/network: Stop summarizing device sections
Now that the number of displayed items is capped, there's no need for a summary anymore. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
This commit is contained in:
parent
1a0dbd00e4
commit
b4ff426a93
@ -17,7 +17,6 @@ Gio._promisify(NM.Client, 'new_async');
|
|||||||
Gio._promisify(NM.Client.prototype, 'check_connectivity_async');
|
Gio._promisify(NM.Client.prototype, 'check_connectivity_async');
|
||||||
|
|
||||||
const MAX_VISIBLE_NETWORKS = 8;
|
const MAX_VISIBLE_NETWORKS = 8;
|
||||||
var MAX_DEVICE_ITEMS = 4;
|
|
||||||
|
|
||||||
// small optimization, to avoid using [] all the time
|
// small optimization, to avoid using [] all the time
|
||||||
const NM80211Mode = NM['80211Mode'];
|
const NM80211Mode = NM['80211Mode'];
|
||||||
@ -1458,14 +1457,6 @@ class NMDeviceSection extends NMSection {
|
|||||||
|
|
||||||
this._deviceType = deviceType;
|
this._deviceType = deviceType;
|
||||||
this._nmDevices = new Set();
|
this._nmDevices = new Set();
|
||||||
|
|
||||||
this._summaryItem = new PopupMenu.PopupSubMenuMenuItem('', true);
|
|
||||||
this._summaryItem.icon.icon_name = this._getSummaryIcon();
|
|
||||||
this.addMenuItem(this._summaryItem);
|
|
||||||
|
|
||||||
this._summaryItem.menu.addSettingsAction(_('Network Settings'),
|
|
||||||
'gnome-network-panel.desktop');
|
|
||||||
this._summaryItem.hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setClient(client) {
|
setClient(client) {
|
||||||
@ -1585,21 +1576,6 @@ class NMDeviceSection extends NMSection {
|
|||||||
|
|
||||||
const nItems = this._items.size;
|
const nItems = this._items.size;
|
||||||
this._items.forEach(item => (item.singleDeviceMode = nItems === 1));
|
this._items.forEach(item => (item.singleDeviceMode = nItems === 1));
|
||||||
|
|
||||||
let nDevices = this._itemsSection.box.get_children().reduce(
|
|
||||||
(prev, child) => prev + (child.visible ? 1 : 0), 0);
|
|
||||||
this._summaryItem.label.text = this._getSummaryLabel(nDevices);
|
|
||||||
let shouldSummarize = nDevices > MAX_DEVICE_ITEMS;
|
|
||||||
this._summaryItem.visible = shouldSummarize;
|
|
||||||
this._itemsSection.actor.visible = !shouldSummarize;
|
|
||||||
}
|
|
||||||
|
|
||||||
_getSummaryIcon() {
|
|
||||||
throw new GObject.NotImplementedError();
|
|
||||||
}
|
|
||||||
|
|
||||||
_getSummaryLabel() {
|
|
||||||
throw new GObject.NotImplementedError();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1614,17 +1590,6 @@ class NMWirelessSection extends NMDeviceSection {
|
|||||||
_createDeviceMenuItem(device) {
|
_createDeviceMenuItem(device) {
|
||||||
return new NMWirelessDeviceItem(this._client, device);
|
return new NMWirelessDeviceItem(this._client, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
_getSummaryIcon() {
|
|
||||||
return 'network-wireless-symbolic';
|
|
||||||
}
|
|
||||||
|
|
||||||
_getSummaryLabel(nDevices) {
|
|
||||||
return ngettext(
|
|
||||||
'%s Wi-Fi Connection',
|
|
||||||
'%s Wi-Fi Connections',
|
|
||||||
nDevices).format(nDevices);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class NMWiredSection extends NMDeviceSection {
|
class NMWiredSection extends NMDeviceSection {
|
||||||
@ -1638,17 +1603,6 @@ class NMWiredSection extends NMDeviceSection {
|
|||||||
_createDeviceMenuItem(device) {
|
_createDeviceMenuItem(device) {
|
||||||
return new NMWiredDeviceItem(this._client, device);
|
return new NMWiredDeviceItem(this._client, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
_getSummaryIcon() {
|
|
||||||
return 'network-wired-symbolic';
|
|
||||||
}
|
|
||||||
|
|
||||||
_getSummaryLabel(nDevices) {
|
|
||||||
return ngettext(
|
|
||||||
'%s Wired Connection',
|
|
||||||
'%s Wired Connections',
|
|
||||||
nDevices).format(nDevices);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class NMBluetoothSection extends NMDeviceSection {
|
class NMBluetoothSection extends NMDeviceSection {
|
||||||
@ -1662,17 +1616,6 @@ class NMBluetoothSection extends NMDeviceSection {
|
|||||||
_createDeviceMenuItem(device) {
|
_createDeviceMenuItem(device) {
|
||||||
return new NMBluetoothDeviceItem(this._client, device);
|
return new NMBluetoothDeviceItem(this._client, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
_getSummaryIcon() {
|
|
||||||
return 'network-wireless-symbolic';
|
|
||||||
}
|
|
||||||
|
|
||||||
_getSummaryLabel(nDevices) {
|
|
||||||
return ngettext(
|
|
||||||
'%s Bluetooth Connection',
|
|
||||||
'%s Bluetooth Connections',
|
|
||||||
nDevices).format(nDevices);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class NMModemSection extends NMDeviceSection {
|
class NMModemSection extends NMDeviceSection {
|
||||||
@ -1690,17 +1633,6 @@ class NMModemSection extends NMDeviceSection {
|
|||||||
return new NMModemDeviceItem(this._client, device);
|
return new NMModemDeviceItem(this._client, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
_getSummaryIcon() {
|
|
||||||
return 'network-wireless-symbolic';
|
|
||||||
}
|
|
||||||
|
|
||||||
_getSummaryLabel(nDevices) {
|
|
||||||
return ngettext(
|
|
||||||
'%s Modem Connection',
|
|
||||||
'%s Modem Connections',
|
|
||||||
nDevices).format(nDevices);
|
|
||||||
}
|
|
||||||
|
|
||||||
_sync() {
|
_sync() {
|
||||||
super._sync();
|
super._sync();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user