From f9f9b23dc484b97469c5f191f586cf0717de6f45 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Mon, 7 Nov 2016 21:02:14 -0500 Subject: [PATCH] Fix some runtime warnings - in the sound applet, object construction is too soon to get the theme node, wait until 'style-changed' signal is sent by the main actor. In the menu applet, remove return values of navigateContextMenu() - there is only one user of this function, and they don't check for a value. --- .../cinnamon/applets/menu@cinnamon.org/applet.js | 10 +++++----- .../cinnamon/applets/sound@cinnamon.org/applet.js | 11 ++++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js index 8c95366f3b..6ecf1a8507 100755 --- a/files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js @@ -1493,7 +1493,7 @@ MyApplet.prototype = { if (symbol === Clutter.KEY_Menu || symbol === Clutter.Escape || (ctrlKey && (symbol === Clutter.KEY_Return || symbol === Clutter.KP_Enter))) { actor.activateContextMenus(); - return true; + return; } let goUp = symbol === Clutter.KEY_Up; @@ -1511,11 +1511,11 @@ MyApplet.prototype = { case Clutter.KEY_Page_Up: this._activeContextMenuItem = menuItems[0]; this._activeContextMenuItem.setActive(true); - return true; + return; case Clutter.KEY_Page_Down: this._activeContextMenuItem = menuItems[menuItemsLength - 1]; this._activeContextMenuItem.setActive(true); - return true; + return; } if (!this._activeContextMenuItem) { @@ -1525,12 +1525,12 @@ MyApplet.prototype = { this._activeContextMenuItem = menuItems[goUp ? menuItemsLength - 1 : 0]; this._activeContextMenuItem.setActive(true); } - return true; + return; } else if (this._activeContextMenuItem && (symbol === Clutter.KEY_Return || symbol === Clutter.KP_Enter)) { this._activeContextMenuItem.activate(); this._activeContextMenuItem = null; - return true; + return; } let i = 0; diff --git a/files/usr/share/cinnamon/applets/sound@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/sound@cinnamon.org/applet.js index def94a4c2d..d26ad9caed 100644 --- a/files/usr/share/cinnamon/applets/sound@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/sound@cinnamon.org/applet.js @@ -110,7 +110,7 @@ VolumeSlider.prototype = { this.app_icon = app_icon; if (this.app_icon == null) { - this.iconName = this.isMic? "microphone-sensitivity-none" : "audio-volume-muted"; + this.iconName = this.isMic ? "microphone-sensitivity-none" : "audio-volume-muted"; this.icon = new St.Icon({icon_name: this.iconName, icon_type: St.IconType.SYMBOLIC, icon_size: 16}); } else { @@ -122,13 +122,18 @@ VolumeSlider.prototype = { this.addActor(this._slider, {span: -1, expand: true}); this.label = new St.Label({ text: "" }); - let digitWidth = _getDigitWidth(this.actor) / Pango.SCALE; - this.label.set_width(digitWidth * 5); this.label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE); + this.actor.connect('style-changed', Lang.bind(this, this.onStyleChanged)); + this.connectWithStream(stream); }, + onStyleChanged: function(actor, event) { + let digitWidth = _getDigitWidth(this.actor) / Pango.SCALE; + this.label.set_width(digitWidth * 5); + }, + connectWithStream: function(stream){ if(!stream){ this.actor.hide();