Remove useless old code
This commit is contained in:
parent
cf879a2c46
commit
bd9e3722a2
79
extension.js
79
extension.js
|
@ -476,16 +476,6 @@ class GenericMonitorDBUS {
|
|||
log('No name defined for item');
|
||||
return false;
|
||||
}
|
||||
// if (!item.hasOwnProperty('text') && !item.hasOwnProperty('icon'))
|
||||
// throw new Error('No text not icon defined for item');
|
||||
// if (item.hasOwnProperty('on-click')) {
|
||||
// if (item['on-click'] !== 'signal' && item['on-click'] !== 'delete')
|
||||
// throw new Error('Invalid on-click value');
|
||||
// }
|
||||
// if (item.hasOwnProperty('box')) {
|
||||
// if (item['box'] !== 'left' && item['box'] !== 'center' && item['box'] !== 'right')
|
||||
// throw new Error('Invalid box value');
|
||||
// }
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -501,34 +491,6 @@ class GenericMonitorDBUS {
|
|||
return null;
|
||||
}
|
||||
|
||||
_doClickCallback() {
|
||||
for(let itemIndex in this.actor_clicked) {
|
||||
let item = this.actor_clicked[itemIndex];
|
||||
let right = '';
|
||||
let nbClicks = '';
|
||||
if (item['button'] == 3)
|
||||
right = 'Right';
|
||||
if (item['nbClicks'] > 1)
|
||||
nbClicks = 'Dbl';
|
||||
let signalName = 'on' + right + nbClicks + 'Click';
|
||||
this._dbusImpl.emit_signal(signalName, GLib.Variant.new('(s)',[item['name']]));
|
||||
}
|
||||
this.actor_clicked = {}
|
||||
}
|
||||
|
||||
_actorToMonitorWidget(actor) {
|
||||
for (let groupName in this.monitor_groups) {
|
||||
let group = this.monitor_groups[groupName];
|
||||
for (let itemIndex in group) {
|
||||
let item = group[itemIndex];
|
||||
if (item.widget === actor ||
|
||||
item.icon === actor)
|
||||
return [groupName, item];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
_removeFromArray(array, value) {
|
||||
for(let i=0; i<array.length; i++) {
|
||||
if (array[i] === value) {
|
||||
|
@ -541,33 +503,6 @@ class GenericMonitorDBUS {
|
|||
return array;
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/50100546/how-do-i-detect-clicks-on-the-gnome-appmenu
|
||||
_clicked(actor, event) {
|
||||
let result = this._actorToMonitorWidget(actor);
|
||||
if (result === null)
|
||||
return;
|
||||
|
||||
let groupName = result[0];
|
||||
let monitorWidget = result[1];
|
||||
|
||||
if (monitorWidget.onClick == 'signal') {
|
||||
let actorName = monitorWidget.name + '@' + groupName;
|
||||
if (!this.actor_clicked.hasOwnProperty(actorName)) {
|
||||
let clickItem = {};
|
||||
clickItem['name'] = actorName;
|
||||
clickItem['nbClicks'] = 1;
|
||||
clickItem['button'] = event.get_button();
|
||||
this.actor_clicked[actorName] = clickItem;
|
||||
Mainloop.timeout_add(this.ClutterSettings['double-click-time'],
|
||||
Lang.bind(this, this._doClickCallback));
|
||||
} else {
|
||||
this.actor_clicked[actorName]['nbClicks'] = 2;
|
||||
}
|
||||
} else if (monitorWidget.onClick == 'delete') {
|
||||
this.deleteItem(monitorWidget, groupName);
|
||||
}
|
||||
}
|
||||
|
||||
notify(str) {
|
||||
let parameters = JSON.parse(str);
|
||||
if (!this._checkParameters(parameters))
|
||||
|
@ -605,20 +540,6 @@ class GenericMonitorDBUS {
|
|||
}
|
||||
monitorWidget = new MonitorWidget(item, groupName, this, position);
|
||||
group.push(monitorWidget);
|
||||
// Connect signals
|
||||
// if (onClick !== '') {
|
||||
// if (monitorWidget.widget)
|
||||
// monitorWidget.widget.set_reactive(true);
|
||||
// monitorWidget.widget.connect(
|
||||
// 'button-release-event', Lang.bind(this, this._clicked)
|
||||
// );
|
||||
// if (monitorWidget.icon) {
|
||||
// monitorWidget.icon.set_reactive(true);
|
||||
// monitorWidget.icon.connect(
|
||||
// 'button-release-event', Lang.bind(this, this._clicked)
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
monitorWidget.update(item);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user