cleanup: Stop using Mainloop module

It is deprecated in favor of the regular GLib functions.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/718
This commit is contained in:
Florian Müllner
2019-08-19 20:50:33 +02:00
parent 4525ad346d
commit 2fc4987c73
30 changed files with 151 additions and 165 deletions

View File

@ -2,7 +2,6 @@
/* exported getPointerWatcher */
const { GLib, Meta } = imports.gi;
const Mainloop = imports.mainloop;
// We stop polling if the user is idle for more than this amount of time
var IDLE_TIME = 1000;
@ -87,7 +86,7 @@ var PointerWatcher = class {
_updateTimeout() {
if (this._timeoutId) {
Mainloop.source_remove(this._timeoutId);
GLib.source_remove(this._timeoutId);
this._timeoutId = 0;
}
@ -98,8 +97,8 @@ var PointerWatcher = class {
for (let i = 1; i < this._watches.length; i++)
minInterval = Math.min(this._watches[i].interval, minInterval);
this._timeoutId = Mainloop.timeout_add(minInterval,
this._onTimeout.bind(this));
this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, minInterval,
this._onTimeout.bind(this));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
}