From 4c7aef0ea40c7e3be6ed63bf75755c40d1bebd96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9za=20B=C3=BAza?= Date: Sun, 16 Sep 2018 20:48:12 +0200 Subject: [PATCH] Fix disappeared icons on the detailed panel Icons could not be added to the popup panel, because of two reasons: - A bug in the extension caused icon to be undefined - Gnome Shell rejects adding the same into as child actor to more than one parent. This commit fixes both issues. --- System_Monitor@bghome.gmail.com/factory.js | 6 +++--- System_Monitor@bghome.gmail.com/view.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/System_Monitor@bghome.gmail.com/factory.js b/System_Monitor@bghome.gmail.com/factory.js index 02741d3..fb3fb9f 100644 --- a/System_Monitor@bghome.gmail.com/factory.js +++ b/System_Monitor@bghome.gmail.com/factory.js @@ -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'; @@ -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; } @@ -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: diff --git a/System_Monitor@bghome.gmail.com/view.js b/System_Monitor@bghome.gmail.com/view.js index e97c340..4e4ef88 100644 --- a/System_Monitor@bghome.gmail.com/view.js +++ b/System_Monitor@bghome.gmail.com/view.js @@ -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];