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

@ -3,7 +3,6 @@
const { AccountsService, Clutter, Cogl, Gio, GLib,
GnomeDesktop, GObject, Meta, Shell, St } = imports.gi;
const Cairo = imports.cairo;
const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Background = imports.ui.background;
@ -833,12 +832,14 @@ var ScreenShield = class {
let lockTimeout = Math.max(
STANDARD_FADE_TIME,
this._settings.get_uint(LOCK_DELAY_KEY) * 1000);
this._lockTimeoutId = Mainloop.timeout_add(lockTimeout,
() => {
this._lockTimeoutId = 0;
this.lock(false);
return GLib.SOURCE_REMOVE;
});
this._lockTimeoutId = GLib.timeout_add(
GLib.PRIORITY_DEFAULT,
lockTimeout,
() => {
this._lockTimeoutId = 0;
this.lock(false);
return GLib.SOURCE_REMOVE;
});
GLib.Source.set_name_by_id(this._lockTimeoutId, '[gnome-shell] this.lock');
}
@ -1028,7 +1029,7 @@ var ScreenShield = class {
this._arrowActiveWatchId = 0;
if (!this._arrowAnimationId) {
this._arrowAnimationId = Mainloop.timeout_add(6000, this._animateArrows.bind(this));
this._arrowAnimationId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 6000, this._animateArrows.bind(this));
GLib.Source.set_name_by_id(this._arrowAnimationId, '[gnome-shell] this._animateArrows');
this._animateArrows();
}
@ -1040,7 +1041,7 @@ var ScreenShield = class {
_pauseArrowAnimation() {
if (this._arrowAnimationId) {
Mainloop.source_remove(this._arrowAnimationId);
GLib.source_remove(this._arrowAnimationId);
this._arrowAnimationId = 0;
}
@ -1050,7 +1051,7 @@ var ScreenShield = class {
_stopArrowAnimation() {
if (this._arrowAnimationId) {
Mainloop.source_remove(this._arrowAnimationId);
GLib.source_remove(this._arrowAnimationId);
this._arrowAnimationId = 0;
}
if (this._arrowActiveWatchId) {
@ -1097,7 +1098,7 @@ var ScreenShield = class {
if (params.fadeToBlack && params.animateFade) {
// Take a beat
let id = Mainloop.timeout_add(MANUAL_FADE_TIME, () => {
let id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, MANUAL_FADE_TIME, () => {
this._activateFade(this._shortLightbox, MANUAL_FADE_TIME);
return GLib.SOURCE_REMOVE;
});
@ -1240,7 +1241,7 @@ var ScreenShield = class {
}
if (this._lockTimeoutId != 0) {
Mainloop.source_remove(this._lockTimeoutId);
GLib.source_remove(this._lockTimeoutId);
this._lockTimeoutId = 0;
}