[gnome-shell/wip/aggregate-menu: 51/99] network: Simplify connections to the firmware signal
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/aggregate-menu: 51/99] network: Simplify connections to the firmware signal
- Date: Wed, 12 Jun 2013 20:16:21 +0000 (UTC)
commit 0fa50ae376ee94e612e1bf313c5a8c0c77c49ff4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Jun 11 21:06:58 2013 -0400
network: Simplify connections to the firmware signal
The status item will go away soon, so make sure the one-time
fire is given its own function. At the same time, only connect
to the signal when the situation actually matters.
js/ui/status/network.js | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index da2808c..85b4011 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -376,6 +376,14 @@ const NMDevice = new Lang.Class({
// in the majority of cases (wired, wwan)
},
+ _firmwareChanged: function() {
+ if (this._firmwareChangedId) {
+ GObject.Object.prototype.disconnect.call(this._device, this._firmwareChangedId);
+ this._firmwareChangedId = 0;
+ }
+ this._substateChanged();
+ },
+
getStatusLabel: function() {
if (!this._device)
return null;
@@ -403,9 +411,10 @@ const NMDevice = new Lang.Class({
// This state is actually a compound of various states (generically unavailable,
// firmware missing), that are exposed by different properties (whose state may
// or may not updated when we receive state-changed).
- if (!this._firmwareChangedId)
- this._firmwareChangedId = this._device.connect('notify::firmware-missing', Lang.bind(this,
this._substateChanged));
if (this._device.firmware_missing) {
+ if (!this._firmwareChangedId)
+ this._firmwareChangedId = this._device.connect('notify::firmware-missing',
Lang.bind(this, this._firmwareChanged));
+
/* Translators: this is for devices that require some kind of firmware or kernel
module, which is missing */
return _("firmware missing");
@@ -522,11 +531,6 @@ const NMDevice = new Lang.Class({
},
_updateStatusItem: function() {
- if (this._firmwareChangedId) {
- GObject.Object.prototype.disconnect.call(this._device, this._firmwareChangedId);
- this._firmwareChangedId = 0;
- }
-
this.statusItem.setStatus(this.getStatusLabel());
this.statusItem.setToggleState(this.connected);
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]