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;
if (widgetDict.hasOwnProperty('text')) {
nestedItem = widgetDict['text'];
widget = this._createText(nestedItem);
widget = this._createLabel(nestedItem);
} else if (widgetDict.hasOwnProperty('picture')) {
nestedItem = widgetDict['picture'];
widget = this._createPicture(nestedItem);
@ -426,7 +426,7 @@ class MonitorWidget extends PanelMenu.Button {
return this._createText(itemValues);
}
_createText(item) {
__createText(item, isLabel) {
if (!item.hasOwnProperty('text')) {
log('Text must have a \'text\' value');
return null;
@ -439,13 +439,25 @@ class MonitorWidget extends PanelMenu.Button {
if (item['text'] === '') {
return null;
} 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);
return widget;
}
}
_createText(item) {
return this.__createText(item, false);
}
_createLabel(item) {
return this.__createText(item, true);
}
_createIconOld(item) {
var itemValues = {};
itemValues = { 'path':item['icon'] };