Permalink
Browse files

Merge pull request #1204 from autarkper/applet-redraw-regression-fix2

Alternative fix to regression caused by pull request #1186
  • Loading branch information...
2 parents b6c5f7c + dc4f6a4 commit 7e4e574919fcabefebcb1670ac7f9b371a34ca16 @clefebvre clefebvre committed Sep 27, 2012
Showing with 25 additions and 23 deletions.
  1. +23 −15 files/usr/share/cinnamon/applets/network@cinnamon.org/applet.js
  2. +2 −8 js/ui/applet.js
@@ -1613,7 +1613,8 @@ MyApplet.prototype = {
this.menu = new Applet.AppletPopupMenu(this, orientation);
this.menuManager.addMenu(this.menu);
- this.set_applet_icon_symbolic_name('network-offline');
+ this._currentIconName = undefined;
+ this._setIcon('network-offline');
this._client = NMClient.Client.new();
@@ -1728,6 +1729,13 @@ MyApplet.prototype = {
}
},
+ _setIcon: function(name) {
+ if (this._currentIconName !== name) {
+ this.set_applet_icon_symbolic_name(name);
+ this._currentIconName = name;
+ }
+ },
+
on_applet_clicked: function(event) {
this.menu.toggle();
},
@@ -2074,7 +2082,7 @@ MyApplet.prototype = {
this.actor.show();
if (!this._client.networking_enabled) {
- this.set_applet_icon_symbolic_name('network-offline');
+ this._setIcon('network-offline');
this._hideDevices();
this._statusItem.label.text = _("Networking is disabled");
this._statusSection.actor.show();
@@ -2094,31 +2102,31 @@ MyApplet.prototype = {
let hasMobileIcon = false;
if (!mc) {
- this.set_applet_icon_symbolic_name('network-offline');
+ this._setIcon('network-offline');
this.set_applet_tooltip(_("No connection"));
} else if (mc.state == NetworkManager.ActiveConnectionState.ACTIVATING) {
this._updateFrequencySeconds = FAST_PERIODIC_UPDATE_FREQUENCY_SECONDS;
switch (mc._section) {
case NMConnectionCategory.WWAN:
- this.set_applet_icon_symbolic_name('network-cellular-acquiring');
+ this._setIcon('network-cellular-acquiring');
this.set_applet_tooltip(_("Connecting to the cellular network..."));
break;
case NMConnectionCategory.WIRELESS:
- this.set_applet_icon_symbolic_name('network-wireless-acquiring');
+ this._setIcon('network-wireless-acquiring');
this.set_applet_tooltip(_("Connecting to the wireless network..."));
break;
case NMConnectionCategory.WIRED:
- this.set_applet_icon_symbolic_name('network-wired-acquiring');
+ this._setIcon('network-wired-acquiring');
this.set_applet_tooltip(_("Connecting to the wired network..."));
break;
case NMConnectionCategory.VPN:
- this.set_applet_icon_symbolic_name('network-vpn-acquiring');
+ this._setIcon('network-vpn-acquiring');
this.set_applet_tooltip(_("Connecting to the VPN..."));
break;
default:
// fallback to a generic connected icon
// (it could be a private connection of some other user)
- this.set_applet_icon_symbolic_name('network-wired-acquiring');
+ this._setIcon('network-wired-acquiring');
this.set_applet_tooltip(_("Connecting to the network..."));
}
} else {
@@ -2134,10 +2142,10 @@ MyApplet.prototype = {
log('An active wireless connection, in infrastructure mode, involves no access point?');
break;
}
- this.set_applet_icon_symbolic_name('network-wireless-connected');
+ this._setIcon('network-wireless-connected');
this.set_applet_tooltip(_("Connected to the wireless network"));
} else {
- this.set_applet_icon_symbolic_name('network-wireless-signal-' + signalToIcon(ap.strength));
+ this._setIcon('network-wireless-signal-' + signalToIcon(ap.strength));
this.set_applet_tooltip(_("Wireless connection") + ": " + ap.get_ssid() + " ("+ ap.strength +"%)");
hasApIcon = true;
}
@@ -2147,7 +2155,7 @@ MyApplet.prototype = {
break;
}
case NMConnectionCategory.WIRED:
- this.set_applet_icon_symbolic_name('network-wired');
+ this._setIcon('network-wired');
this.set_applet_tooltip(_("Connected to the wired network"));
break;
case NMConnectionCategory.WWAN:
@@ -2158,23 +2166,23 @@ MyApplet.prototype = {
}
if (!dev.mobileDevice) {
// this can happen for bluetooth in PAN mode
- this.set_applet_icon_symbolic_name('network-cellular-connected');
+ this._setIcon('network-cellular-connected');
this.set_applet_tooltip(_("Connected to the cellular network"));
break;
}
- this.set_applet_icon_symbolic_name('network-cellular-signal-' + signalToIcon(dev.mobileDevice.signal_quality));
+ this._setIcon('network-cellular-signal-' + signalToIcon(dev.mobileDevice.signal_quality));
this.set_applet_tooltip(_("Connected to the cellular network"));
hasMobileIcon = true;
break;
case NMConnectionCategory.VPN:
- this.set_applet_icon_symbolic_name('network-vpn');
+ this._setIcon('network-vpn');
this.set_applet_tooltip(_("Connected to the VPN"));
break;
default:
// fallback to a generic connected icon
// (it could be a private connection of some other user)
- this.set_applet_icon_symbolic_name('network-wired');
+ this._setIcon('network-wired');
this.set_applet_tooltip(_("Connected to the network"));
break;
}
View
@@ -169,10 +169,8 @@ Applet.prototype = {
},
set_applet_tooltip: function (text) {
- if (this._applet_tooltip_text !== text) {
- this._applet_tooltip.set_text(text);
- this._applet_tooltip_text = text;
- }
+ this._applet_tooltip_text = text;
+ this._applet_tooltip.set_text(text);
},
on_applet_clicked: function(event) {
@@ -283,10 +281,6 @@ IconApplet.prototype = {
},
set_applet_icon_symbolic_name: function (icon_name) {
- if (this.__icon_name === icon_name) {
- return;
- }
-
if (this._scaleMode) {
let height = (this._panelHeight / DEFAULT_PANEL_HEIGHT) * PANEL_SYMBOLIC_ICON_DEFAULT_HEIGHT;
this._applet_icon = new St.Icon({icon_name: icon_name, icon_size: height, icon_type: St.IconType.SYMBOLIC, reactive: true, track_hover: true, style_class: 'system-status-icon' });

0 comments on commit 7e4e574

Please sign in to comment.