Popup text must be labels not buttons

This commit is contained in:
Grégory Soutadé 2021-01-31 20:18:11 +01:00
parent 83609b58ab
commit 9943a9075f

View File

@ -388,7 +388,7 @@ class MonitorWidget extends PanelMenu.Button {
let nestedItem = null; let nestedItem = null;
if (widgetDict.hasOwnProperty('text')) { if (widgetDict.hasOwnProperty('text')) {
nestedItem = widgetDict['text']; nestedItem = widgetDict['text'];
widget = this._createText(nestedItem); widget = this._createLabel(nestedItem);
} else if (widgetDict.hasOwnProperty('picture')) { } else if (widgetDict.hasOwnProperty('picture')) {
nestedItem = widgetDict['picture']; nestedItem = widgetDict['picture'];
widget = this._createPicture(nestedItem); widget = this._createPicture(nestedItem);
@ -426,7 +426,7 @@ class MonitorWidget extends PanelMenu.Button {
return this._createText(itemValues); return this._createText(itemValues);
} }
_createText(item) { __createText(item, isLabel) {
if (!item.hasOwnProperty('text')) { if (!item.hasOwnProperty('text')) {
log('Text must have a \'text\' value'); log('Text must have a \'text\' value');
return null; return null;
@ -439,13 +439,25 @@ class MonitorWidget extends PanelMenu.Button {
if (item['text'] === '') { if (item['text'] === '') {
return null; return null;
} else { } else {
const widget = new St.Button({ label: item['text'] }); let widget = null;
if (isLabel)
widget = new St.Label({ text: item['text'] });
else
widget = new St.Button({ label: item['text'] });
widget.set_style(style); widget.set_style(style);
return widget; return widget;
} }
} }
_createText(item) {
return this.__createText(item, false);
}
_createLabel(item) {
return this.__createText(item, true);
}
_createIconOld(item) { _createIconOld(item) {
var itemValues = {}; var itemValues = {};
itemValues = { 'path':item['icon'] }; itemValues = { 'path':item['icon'] };