Skip to content

Commit

Permalink
Fix the structure of speeds of layout menu items.
Browse files Browse the repository at this point in the history
  • Loading branch information
hedayaty committed Oct 29, 2014
1 parent 84c3e54 commit 504da03
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions layout_menu_item.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ const LayoutMenuItem = new Lang.Class({
* LayoutMenuItem: update_speeds
* update speeds
*/
update_speeds: function(up, down) {
this._down_label.set_text(down);
this._up_label.set_text(up);
update_speeds: function(speed) {
this._down_label.set_text(speed.down);
this._up_label.set_text(speed.up);
},
});

Expand Down
8 changes: 4 additions & 4 deletions net_speed.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ const NetSpeed = new Lang.Class({
// Avoid negetive speed in case of device going down, when device goes down,
if (_up < 0 )_up = 0;
if (_down < 0) _down = 0;
this._speeds.push([
this._speed_to_string(_up / delta, this.digits).join(""), // Upload
this._speed_to_string(_down / delta, this.digits).join("") // Download
]);
this._speeds.push({
up: this._speed_to_string(_up / delta, this.digits).join(""),
down: this._speed_to_string(_down / delta, this.digits).join("")
});
total += _down + _up;
up += _up;
down += _down;
Expand Down
4 changes: 2 additions & 2 deletions net_speed_status_icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const NetSpeedStatusIcon = new Lang.Class({

this._menu_title = new LayoutMenuItem.LayoutMenuItem(_("Device"), this._pref, this._net_speed.menu_label_size);
this._menu_title.connect("activate", Lang.bind(this, this._change_device, ""));
this._menu_title.update_speeds(_("Up"), _("Down"));
this._menu_title.update_speeds({ up: _("Up"), down: _("Down")});
this.menu.addMenuItem(this._menu_title);
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this._layouts = new Array();
Expand Down Expand Up @@ -246,7 +246,7 @@ const NetSpeedStatusIcon = new Lang.Class({
*/
update_speeds : function(speeds) {
for (let i = 0; i < speeds.length; ++i) {
this._layouts[i].update_speeds(speeds[i][0], speeds[i][1]);
this._layouts[i].update_speeds(speeds[i]);
}
},

Expand Down

0 comments on commit 504da03

Please sign in to comment.