Skip to content

Commit

Permalink
Merge pull request #54 from elvetemedve/feature/fixes
Browse files Browse the repository at this point in the history
Feature/fixes
  • Loading branch information
Géza Búza authored Sep 16, 2018
2 parents 9086ff3 + 2ed1859 commit 125a362
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
6 changes: 3 additions & 3 deletions [email protected]/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ AbstractFactory.registerObject('meter-area-widget', MeterAreaWidgetFactory);

const MeterWidgetFactory = function() {};

MeterWidgetFactory.prototype.create = function(type, options, icon) {
MeterWidgetFactory.prototype.create = function(type, icon) {
let title, meter_widget;
if (type == PrefsKeys.CPU_METER) {
title = 'CPU';
Expand All @@ -190,7 +190,7 @@ MeterWidgetFactory.prototype.create = function(type, options, icon) {

meter_widget.addTitleItem(new Widget.ResourceTitleItem(title, icon, 'loading...'));
for (var i = 0; i < 3; i++) {
meter_widget.addMenuItem(AbstractFactory.create('meter-widget-item', type, options));
meter_widget.addMenuItem(AbstractFactory.create('meter-widget-item', type));
}
return meter_widget;
}
Expand All @@ -200,7 +200,7 @@ AbstractFactory.registerObject('meter-widget', MeterWidgetFactory);

const MeterWidgetItemFactory = function() {};

MeterWidgetItemFactory.prototype.create = function(type, options) {
MeterWidgetItemFactory.prototype.create = function(type) {
switch (type) {
case PrefsKeys.CPU_METER:
case PrefsKeys.MEMORY_METER:
Expand Down
11 changes: 11 additions & 0 deletions [email protected]/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,18 @@
text-align: right;
}

.item-label
{
min-width: 8em;
max-width: 12em;
}

.bytes-text {
min-width: 4em;
text-align: right;
}

.meter-area-container {
max-width: 1800px;
max-height: 1000px;
}
4 changes: 3 additions & 1 deletion [email protected]/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ var Menu = new Lang.Class({
meter.addObserver(icon);
this._layout.insert_child_at_index(icon, this.available_meters.indexOf(type));
this._icons[type] = icon;
return icon;
return FactoryModule.AbstractFactory.create('icon', type, {}, can_show_activity);
},
_destroyIcon: function(type) {
let icon = this._icons[type];
Expand Down Expand Up @@ -191,6 +191,8 @@ var Menu = new Lang.Class({
if (this._meters[type]) {
this._meters[type].removeObserver(meter_widget);
}
this._widget_area_container.removeMeter(meter_widget);
meter_widget.destroy();
delete this._meter_widgets[type];
},
destroy: function() {
Expand Down
13 changes: 3 additions & 10 deletions [email protected]/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ var MeterAreaContainer = new Lang.Class({
Name: "MeterAreaContainer",
Extends: PopupMenu.PopupBaseMenuItem,

_init: function() {
this.parent({"style_class": "meter-area-container"});
},
addMeter: function(meter, position) {
if (!meter instanceof MeterContainer) {
throw new TypeError("First argument of addMeter() method must be instance of MeterContainer.");
Expand Down Expand Up @@ -303,16 +306,6 @@ const MeterContainer = new Lang.Class({
},
update: function(state) {
this._label_item.setSummaryText(Math.round(state.percent) + ' %');
},
destroy: function() {
let actors = this.get_children();
for (let i = 0; i < actors.length; i++) {
let actor = actors[i];
this.remove_actor(actor);
actor.destroy();
actor = null;
}
this.parent();
}
});

Expand Down

0 comments on commit 125a362

Please sign in to comment.