Skip to content

Commit

Permalink
Fix some runtime warnings - in the sound applet, object construction …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
mtwebster committed Nov 8, 2016
1 parent 1eb4a55 commit f9f9b23
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
10 changes: 5 additions & 5 deletions files/usr/share/cinnamon/applets/[email protected]/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -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;
Expand Down
11 changes: 8 additions & 3 deletions files/usr/share/cinnamon/applets/[email protected]/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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();
Expand Down

0 comments on commit f9f9b23

Please sign in to comment.