more NM patches
- From: Dan Winship <danw gnome org>
- To: gnome-shell-list <gnome-shell-list gnome org>
- Subject: more NM patches
- Date: Fri, 25 Mar 2011 14:15:33 -0400
>From 187e28c9f094c02db5f820f134d2328dc602db53 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw gnome org>
Date: Fri, 25 Mar 2011 10:04:28 -0400
Subject: [PATCH 1/4] boxpointer: reposition after a size change
If the BoxPointer changes size (eg, when opening the "More" section of
the network menu), reposition it to make sure it's still aligned
correctly and still completely on-screen.
This is not the right fix for this problem (and causes the menu to be
drawn in the wrong position for one frame). The right fix would
involve a ClutterConstraint, but that would be more invasive, and can
happen post-3.0.0.
---
js/ui/boxpointer.js | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js
index 99de6f1..71ea0e9 100644
--- a/js/ui/boxpointer.js
+++ b/js/ui/boxpointer.js
@@ -2,6 +2,7 @@
const Clutter = imports.gi.Clutter;
const Lang = imports.lang;
+const Meta = imports.gi.Meta;
const St = imports.gi.St;
const Shell = imports.gi.Shell;
@@ -176,6 +177,13 @@ BoxPointer.prototype = {
break;
}
this.bin.allocate(childBox, flags);
+
+ if (this._sourceActor) {
+ Meta.later_add (Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
+ function () {
+ this._reposition(this._sourceActor, this._gap, this._alignment);
+ }));
+ }
},
_drawBorder: function(area) {
@@ -306,6 +314,14 @@ BoxPointer.prototype = {
// so that we can query the correct size.
this.actor.show();
+ this._sourceActor = sourceActor;
+ this._gap = gap;
+ this._alignment = alignment;
+
+ this._reposition(sourceActor, gap, alignment);
+ },
+
+ _reposition: function(sourceActor, gap, alignment) {
// Position correctly relative to the sourceActor
let sourceNode = sourceActor.get_theme_node();
let sourceContentBox = sourceNode.get_content_box(sourceActor.get_allocation_box());
--
1.7.4.1
>From 13ee953bf38c1b7e72f1e7873b8368e188132da1 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw gnome org>
Date: Fri, 25 Mar 2011 10:14:55 -0400
Subject: [PATCH 2/4] popupMenu: fix relayout after submenu open/close
Because of the GtkSizeGroup-like trickiness we're doing with
PopupMenuItems, we need to force Clutter to discard its cached size
requests for them any time the menu itself changes size.
---
js/ui/popupMenu.js | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 97a9c4d..9bfa7ea 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -765,6 +765,7 @@ PopupMenuBase.prototype = {
} else {
this.box = new St.BoxLayout({ vertical: true });
}
+ this.box.connect_after('queue-relayout', Lang.bind(this, this._menuQueueRelayout));
this.isOpen = false;
@@ -893,6 +894,13 @@ PopupMenuBase.prototype = {
}
},
+ // Because of the above column-width funniness, we need to do a
+ // queue-relayout on every item whenever the menu itself changes
+ // size, to force clutter to drop its cached size requests
+ _menuQueueRelayout: function() {
+ this.box.get_children().map(function (actor) { actor.queue_relayout(); });
+ },
+
addActor: function(actor) {
this.box.add(actor);
},
--
1.7.4.1
>From e8a5abbf3cd37a93b97593d6f6e78b55de39e62a Mon Sep 17 00:00:00 2001
From: Dan Winship <danw gnome org>
Date: Fri, 25 Mar 2011 10:59:45 -0400
Subject: [PATCH 3/4] gnome-shell.css: fix padding/alignment of menu toggle switches
We do not support scaling background-images, so setting the
toggle-switch size to anything other than the natural size of the
image just results in it getting padding, which makes it look
improperly aligned.
---
data/theme/gnome-shell.css | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 1909da9..1ae4165 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -167,8 +167,8 @@ StTooltip StLabel {
/* Switches (to be used in menus) */
.toggle-switch {
- width: 4.5em;
- height: 1.5em;
+ width: 65px;
+ height: 22px;
}
.toggle-switch-us {
--
1.7.4.1
>From d85df9a1c930db40a87d22c1d68a23dd4cf073b1 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw gnome org>
Date: Fri, 25 Mar 2011 11:27:56 -0400
Subject: [PATCH 4/4] network: add security icons to WEP/WPA wireless networks
---
data/theme/gnome-shell.css | 4 ++++
js/ui/status/network.js | 22 +++++++++++++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 1ae4165..e9aefb1 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -185,6 +185,10 @@ StTooltip StLabel {
background-image: url("toggle-on-intl.svg");
}
+.nm-menu-item-icons {
+ spacing: .5em;
+}
+
/* Panel */
#panel {
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 7990332..0bf6380 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -92,16 +92,32 @@ function NMNetworkMenuItem() {
}
NMNetworkMenuItem.prototype = {
- __proto__: PopupMenu.PopupImageMenuItem.prototype,
+ __proto__: PopupMenu.PopupBaseMenuItem.prototype,
_init: function(accessPoints, title, params) {
+ PopupMenu.PopupBaseMenuItem.prototype._init.call(this, params);
+
accessPoints = sortAccessPoints(accessPoints);
this.bestAP = accessPoints[0];
let ssid = this.bestAP.get_ssid();
title = title || NetworkManager.utils_ssid_to_utf8(ssid) || _("<unknown>");
- PopupMenu.PopupImageMenuItem.prototype._init.call(this, title, this._getIcon(), params);
+ this._label = new St.Label({ text: title });
+ this.addActor(this._label);
+ this._icons = new St.BoxLayout({ style_class: 'nm-menu-item-icons' });
+ this.addActor(this._icons, { align: St.Align.END });
+
+ this._signalIcon = new St.Icon({ icon_name: this._getIcon(),
+ style_class: 'popup-menu-icon' });
+ this._icons.add_actor(this._signalIcon);
+
+ if (this.bestAP._secType != NMAccessPointSecurity.UNKNOWN &&
+ this.bestAP._secType != NMAccessPointSecurity.NONE) {
+ this._secureIcon = new St.Icon({ icon_name: 'network-wireless-encrypted',
+ style_class: 'popup-menu-icon' });
+ this._icons.add_actor(this._secureIcon);
+ }
this._accessPoints = [ ];
for (let i = 0; i < accessPoints.length; i++) {
@@ -120,7 +136,7 @@ NMNetworkMenuItem.prototype = {
if (strength > this.bestAP.strength)
this.bestAP = ap;
- this.setIcon(this._getIcon());
+ this._signalIcon.icon_name = this._getIcon();
},
_getIcon: function() {
--
1.7.4.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]