[gnome-shell/wip/message-tray-menu: 24/25] network: Remove overflow implementation
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/message-tray-menu: 24/25] network: Remove overflow implementation
- Date: Thu, 25 Apr 2013 19:06:19 +0000 (UTC)
commit f12700d949b1e13c6e7a015615567ad4b6f2a508
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Apr 25 14:03:46 2013 -0400
network: Remove overflow implementation
js/ui/status/network.js | 65 ++--------------------------------------------
1 files changed, 3 insertions(+), 62 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 55b4d44..d897d98 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -41,10 +41,6 @@ const NM80211Mode = NetworkManager['80211Mode'];
const NM80211ApFlags = NetworkManager['80211ApFlags'];
const NM80211ApSecurityFlags = NetworkManager['80211ApSecurityFlags'];
-// number of wireless networks that should be visible
-// (the remaining are placed into More…)
-const NUM_VISIBLE_NETWORKS = 5;
-
function macToArray(string) {
return string.split(':').map(function(el) {
return parseInt(el, 16);
@@ -309,7 +305,6 @@ const NMDevice = new Lang.Class({
this._activeConnection = null;
this._activeConnectionItem = null;
this._autoConnectionItem = null;
- this._overflowItem = null;
this.statusItem = new PopupMenu.PopupSwitchMenuItem('', this.connected, { style_class:
'popup-subtitle-menu-item' });
this._statusChanged = this.statusItem.connect('toggled', Lang.bind(this, function(item, state) {
@@ -512,7 +507,6 @@ const NMDevice = new Lang.Class({
this.section.removeAll();
this._autoConnectionItem = null;
this._activeConnectionItem = null;
- this._overflowItem = null;
for (let i = 0; i < this._connections.length; i++) {
this._connections[i].item = null;
}
@@ -540,14 +534,7 @@ const NMDevice = new Lang.Class({
continue;
obj.item = this._createConnectionItem(obj);
- if (j + activeOffset >= NUM_VISIBLE_NETWORKS) {
- if (!this._overflowItem) {
- this._overflowItem = new PopupMenu.PopupSubMenuMenuItem(_("More…"));
- this.section.addMenuItem(this._overflowItem);
- }
- this._overflowItem.menu.addMenuItem(obj.item);
- } else
- this.section.addMenuItem(obj.item);
+ this.section.addMenuItem(obj.item);
}
} else if (this._autoConnectionName) {
this._autoConnectionItem = new PopupMenu.PopupMenuItem(this._autoConnectionName);
@@ -871,7 +858,6 @@ const NMDeviceWireless = new Lang.Class({
_init: function(client, device, connections) {
this.category = NMConnectionCategory.WIRELESS;
- this._overflowItem = null;
this._networks = [ ];
// breaking the layers with this, but cannot call
@@ -1201,31 +1187,6 @@ const NMDeviceWireless = new Lang.Class({
if (apObj.item)
apObj.item.destroy();
- if (this._overflowItem) {
- if (!apObj.isMore) {
- // we removed an item in the main menu, and we have a more submenu
- // we need to extract the first item in more and move it to the submenu
-
- let item = this._overflowItem.menu.firstMenuItem;
- if (item && item._apObj) {
- item.destroy();
- // clear the cycle, and allow the construction of the new item
- item._apObj.item = null;
-
- this._createNetworkItem(item._apObj, NUM_VISIBLE_NETWORKS-1);
- } else {
- log('The more... menu was existing and empty! This should not happen');
- }
- }
-
- // This can happen if the removed connection is from the overflow
- // menu, or if we just moved the last connection out from the menu
- if (this._overflowItem.menu.numMenuItems == 0) {
- this._overflowItem.destroy();
- this._overflowItem = null;
- }
- }
-
this._networks.splice(res.network, 1);
} else {
let okPrev = true, okNext = true;
@@ -1259,10 +1220,8 @@ const NMDeviceWireless = new Lang.Class({
_clearSection: function() {
this.parent();
-
for (let i = 0; i < this._networks.length; i++)
this._networks[i].item = null;
- this._overflowItem = null;
},
removeConnection: function(connection) {
@@ -1420,17 +1379,7 @@ const NMDeviceWireless = new Lang.Class({
}
apObj.item._apObj = apObj;
- if (position < NUM_VISIBLE_NETWORKS) {
- apObj.isMore = false;
- this.section.addMenuItem(apObj.item, position);
- } else {
- if (!this._overflowItem) {
- this._overflowItem = new PopupMenu.PopupSubMenuMenuItem(_("More…"));
- this.section.addMenuItem(this._overflowItem);
- }
- this._overflowItem.menu.addMenuItem(apObj.item, position - NUM_VISIBLE_NETWORKS);
- apObj.isMore = true;
- }
+ this.section.addMenuItem(apObj.item, position);
},
_createSection: function() {
@@ -1614,15 +1563,7 @@ const NMVPNSection = new Lang.Class({
for(let j = 0; j < this._connections.length; ++j) {
let obj = this._connections[j];
obj.item = this._createConnectionItem(obj);
-
- if (j >= NUM_VISIBLE_NETWORKS) {
- if (!this._overflowItem) {
- this._overflowItem = new PopupMenu.PopupSubMenuMenuItem(_("More…"));
- this.section.addMenuItem(this._overflowItem);
- }
- this._overflowItem.menu.addMenuItem(obj.item);
- } else
- this.section.addMenuItem(obj.item);
+ this.section.addMenuItem(obj.item);
}
} else {
this.section.actor.hide()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]