[gnome-shell] cleanup: Stop using Mainloop module
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] cleanup: Stop using Mainloop module
- Date: Thu, 12 Sep 2019 19:22:41 +0000 (UTC)
commit 2fc4987c7377feeb1c98f6233e5e1b43303e6eb4
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Aug 19 20:50:33 2019 +0200
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
js/misc/ibusManager.js | 25 ++++++++++---------
js/ui/altTab.js | 26 ++++++++++---------
js/ui/animation.js | 3 +--
js/ui/appDisplay.js | 9 +++----
js/ui/components/automountManager.js | 9 +++----
js/ui/components/telepathyClient.js | 17 +++++++------
js/ui/dash.js | 11 ++++----
js/ui/endSessionDialog.js | 6 ++---
js/ui/lookingGlass.js | 4 +--
js/ui/magnifier.js | 5 ++--
js/ui/main.js | 5 ++--
js/ui/messageTray.js | 17 +++++++------
js/ui/notificationDaemon.js | 3 +--
js/ui/osdWindow.js | 9 +++----
js/ui/overview.js | 7 +++---
js/ui/panel.js | 7 +++---
js/ui/pointerWatcher.js | 7 +++---
js/ui/screenShield.js | 25 ++++++++++---------
js/ui/scripting.js | 3 +--
js/ui/sessionMode.js | 8 +++---
js/ui/status/accessibility.js | 3 +--
js/ui/status/network.js | 5 ++--
js/ui/switcherPopup.js | 43 +++++++++++++++++---------------
js/ui/windowManager.js | 11 ++++----
js/ui/workspace.js | 21 ++++++++--------
js/ui/workspaceSwitcherPopup.js | 9 +++----
js/ui/workspaceThumbnail.js | 3 +--
tests/interactive/box-shadow-animated.js | 5 ++--
tests/interactive/entry.js | 5 ++--
tests/interactive/test-title.js | 5 ++--
30 files changed, 151 insertions(+), 165 deletions(-)
---
diff --git a/js/misc/ibusManager.js b/js/misc/ibusManager.js
index 210315e043..2011321eeb 100644
--- a/js/misc/ibusManager.js
+++ b/js/misc/ibusManager.js
@@ -2,7 +2,6 @@
/* exported getIBusManager */
const { Gio, GLib, IBus } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const IBusCandidatePopup = imports.ui.ibusCandidatePopup;
@@ -216,21 +215,23 @@ var IBusManager = class {
return;
if (this._preloadEnginesId != 0) {
- Mainloop.source_remove(this._preloadEnginesId);
+ GLib.source_remove(this._preloadEnginesId);
this._preloadEnginesId = 0;
}
this._preloadEnginesId =
- Mainloop.timeout_add_seconds(this._PRELOAD_ENGINES_DELAY_TIME,
- () => {
- this._ibus.preload_engines_async(
- ids,
- -1,
- null,
- null);
- this._preloadEnginesId = 0;
- return GLib.SOURCE_REMOVE;
- });
+ GLib.timeout_add_seconds(
+ GLib.PRIORITY_DEFAULT,
+ this._PRELOAD_ENGINES_DELAY_TIME,
+ () => {
+ this._ibus.preload_engines_async(
+ ids,
+ -1,
+ null,
+ null);
+ this._preloadEnginesId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
}
};
Signals.addSignalMethods(IBusManager.prototype);
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index 55c680877f..f846d10200 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -3,7 +3,6 @@
WindowCyclerPopup */
const { Atk, Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Main = imports.ui.main;
const SwitcherPopup = imports.ui.switcherPopup;
@@ -292,7 +291,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
if (this._thumbnails)
this._destroyThumbnails();
if (this._thumbnailTimeoutId != 0)
- Mainloop.source_remove(this._thumbnailTimeoutId);
+ GLib.source_remove(this._thumbnailTimeoutId);
}
/**
@@ -327,7 +326,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
}
if (this._thumbnailTimeoutId != 0) {
- Mainloop.source_remove(this._thumbnailTimeoutId);
+ GLib.source_remove(this._thumbnailTimeoutId);
this._thumbnailTimeoutId = 0;
}
@@ -344,7 +343,8 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
this._thumbnails.highlight(window, forceAppFocus);
} else if (this._items[this._selectedIndex].cachedWindows.length > 1 &&
!forceAppFocus) {
- this._thumbnailTimeoutId = Mainloop.timeout_add (
+ this._thumbnailTimeoutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT,
THUMBNAIL_POPUP_TIME,
this._timeoutPopupThumbnails.bind(this));
GLib.Source.set_name_by_id(this._thumbnailTimeoutId, '[gnome-shell]
this._timeoutPopupThumbnails');
@@ -712,7 +712,7 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
_onDestroy() {
if (this._mouseTimeOutId != 0)
- Mainloop.source_remove(this._mouseTimeOutId);
+ GLib.source_remove(this._mouseTimeOutId);
this.icons.forEach(icon => {
icon.app.disconnect(icon._stateChangedId);
@@ -791,14 +791,16 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
// activation when the thumbnail list is open
_onItemEnter(index) {
if (this._mouseTimeOutId != 0)
- Mainloop.source_remove(this._mouseTimeOutId);
+ GLib.source_remove(this._mouseTimeOutId);
if (this._altTabPopup.thumbnailsVisible) {
- this._mouseTimeOutId = Mainloop.timeout_add(APP_ICON_HOVER_TIMEOUT,
- () => {
- this._enterItem(index);
- this._mouseTimeOutId = 0;
- return GLib.SOURCE_REMOVE;
- });
+ this._mouseTimeOutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT,
+ APP_ICON_HOVER_TIMEOUT,
+ () => {
+ this._enterItem(index);
+ this._mouseTimeOutId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(this._mouseTimeOutId, '[gnome-shell] this._enterItem');
} else {
this._itemEntered(index);
diff --git a/js/ui/animation.js b/js/ui/animation.js
index 528fb8220f..a1f257efce 100644
--- a/js/ui/animation.js
+++ b/js/ui/animation.js
@@ -2,7 +2,6 @@
/* exported Animation, AnimatedIcon, Spinner */
const { Clutter, GLib, Gio, St } = imports.gi;
-const Mainloop = imports.mainloop;
var ANIMATED_ICON_UPDATE_TIMEOUT = 16;
var SPINNER_ANIMATION_TIME = 300;
@@ -45,7 +44,7 @@ var Animation = class {
stop() {
if (this._timeoutId > 0) {
- Mainloop.source_remove(this._timeoutId);
+ GLib.source_remove(this._timeoutId);
this._timeoutId = 0;
}
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index f5cf549cdc..6cc0e154fb 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -3,7 +3,6 @@
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Signals = imports.signals;
-const Mainloop = imports.mainloop;
const AppFavorites = imports.ui.appFavorites;
const BoxPointer = imports.ui.boxpointer;
@@ -1639,14 +1638,14 @@ var FolderIcon = class FolderIcon {
_removeMenuTimeout() {
if (this._popupTimeoutId > 0) {
- Mainloop.source_remove(this._popupTimeoutId);
+ GLib.source_remove(this._popupTimeoutId);
this._popupTimeoutId = 0;
}
}
_setPopupTimeout() {
this._removeMenuTimeout();
- this._popupTimeoutId = Mainloop.timeout_add(MENU_POPUP_TIMEOUT, () => {
+ this._popupTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, MENU_POPUP_TIMEOUT, () => {
this._popupTimeoutId = 0;
this._popupRenamePopup();
return GLib.SOURCE_REMOVE;
@@ -2076,7 +2075,7 @@ var AppIcon = class AppIcon {
_removeMenuTimeout() {
if (this._menuTimeoutId > 0) {
- Mainloop.source_remove(this._menuTimeoutId);
+ GLib.source_remove(this._menuTimeoutId);
this._menuTimeoutId = 0;
}
}
@@ -2090,7 +2089,7 @@ var AppIcon = class AppIcon {
_setPopupTimeout() {
this._removeMenuTimeout();
- this._menuTimeoutId = Mainloop.timeout_add(MENU_POPUP_TIMEOUT, () => {
+ this._menuTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, MENU_POPUP_TIMEOUT, () => {
this._menuTimeoutId = 0;
this.popupMenu();
return GLib.SOURCE_REMOVE;
diff --git a/js/ui/components/automountManager.js b/js/ui/components/automountManager.js
index 399a41986f..c9ae392d5e 100644
--- a/js/ui/components/automountManager.js
+++ b/js/ui/components/automountManager.js
@@ -2,7 +2,6 @@
/* exported Component */
const { Gio, GLib } = imports.gi;
-const Mainloop = imports.mainloop;
const Params = imports.misc.params;
const GnomeSession = imports.misc.gnomeSession;
@@ -39,7 +38,7 @@ var AutomountManager = class {
this._driveDisconnectedId = this._volumeMonitor.connect('drive-disconnected',
this._onDriveDisconnected.bind(this));
this._driveEjectButtonId = this._volumeMonitor.connect('drive-eject-button',
this._onDriveEjectButton.bind(this));
- this._mountAllId = Mainloop.idle_add(this._startupMountAll.bind(this));
+ this._mountAllId = GLib.idle_add(GLib.PRIORITY_DEFAULT, this._startupMountAll.bind(this));
GLib.Source.set_name_by_id(this._mountAllId, '[gnome-shell] this._startupMountAll');
}
@@ -51,7 +50,7 @@ var AutomountManager = class {
this._volumeMonitor.disconnect(this._driveEjectButtonId);
if (this._mountAllId > 0) {
- Mainloop.source_remove(this._mountAllId);
+ GLib.source_remove(this._mountAllId);
this._mountAllId = 0;
}
}
@@ -220,7 +219,7 @@ var AutomountManager = class {
_onVolumeRemoved(monitor, volume) {
if (volume._allowAutorunExpireId && volume._allowAutorunExpireId > 0) {
- Mainloop.source_remove(volume._allowAutorunExpireId);
+ GLib.source_remove(volume._allowAutorunExpireId);
delete volume._allowAutorunExpireId;
}
this._volumeQueue =
@@ -249,7 +248,7 @@ var AutomountManager = class {
}
_allowAutorunExpire(volume) {
- let id = Mainloop.timeout_add_seconds(AUTORUN_EXPIRE_TIMEOUT_SECS, () => {
+ let id = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, AUTORUN_EXPIRE_TIMEOUT_SECS, () => {
volume.allowAutorun = false;
delete volume._allowAutorunExpireId;
return GLib.SOURCE_REMOVE;
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index 71311467d8..6d4915d53c 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -3,7 +3,6 @@
const { Clutter, Gio, GLib, GObject, St } = imports.gi;
const Lang = imports.lang;
-const Mainloop = imports.mainloop;
var Tpl = null;
var Tp = null;
@@ -546,8 +545,8 @@ var ChatSource = class extends MessageTray.Source {
// Wait a bit before notifying for the received message, a handler
// could ack it in the meantime.
if (this._notifyTimeoutId != 0)
- Mainloop.source_remove(this._notifyTimeoutId);
- this._notifyTimeoutId = Mainloop.timeout_add(500,
+ GLib.source_remove(this._notifyTimeoutId);
+ this._notifyTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500,
this._notifyTimeout.bind(this));
GLib.Source.set_name_by_id(this._notifyTimeoutId, '[gnome-shell] this._notifyTimeout');
}
@@ -641,7 +640,7 @@ var ChatNotification = class extends MessageTray.Notification {
destroy(reason) {
if (this._timestampTimeoutId)
- Mainloop.source_remove(this._timestampTimeoutId);
+ GLib.source_remove(this._timestampTimeoutId);
this._timestampTimeoutId = 0;
super.destroy(reason);
}
@@ -729,7 +728,7 @@ var ChatNotification = class extends MessageTray.Notification {
// Reset the old message timeout
if (this._timestampTimeoutId)
- Mainloop.source_remove(this._timestampTimeoutId);
+ GLib.source_remove(this._timestampTimeoutId);
this._timestampTimeoutId = 0;
let message = { realMessage: props.group != 'meta',
@@ -747,7 +746,8 @@ var ChatNotification = class extends MessageTray.Notification {
} else {
// Schedule a new timestamp in SCROLLBACK_IMMEDIATE_TIME
// from the timestamp of the message.
- this._timestampTimeoutId = Mainloop.timeout_add_seconds(
+ this._timestampTimeoutId = GLib.timeout_add_seconds(
+ GLib.PRIORITY_DEFAULT,
SCROLLBACK_IMMEDIATE_TIME - (currentTime - timestamp),
this.appendTimestamp.bind(this));
GLib.Source.set_name_by_id(this._timestampTimeoutId, '[gnome-shell] this.appendTimestamp');
@@ -952,14 +952,15 @@ var ChatNotificationBanner = class extends MessageTray.NotificationBanner {
// Remove composing timeout.
if (this._composingTimeoutId > 0) {
- Mainloop.source_remove(this._composingTimeoutId);
+ GLib.source_remove(this._composingTimeoutId);
this._composingTimeoutId = 0;
}
if (text != '') {
this.notification.source.setChatState(Tp.ChannelChatState.COMPOSING);
- this._composingTimeoutId = Mainloop.timeout_add_seconds(
+ this._composingTimeoutId = GLib.timeout_add_seconds(
+ GLib.PRIORITY_DEFAULT,
COMPOSING_STOP_TIMEOUT,
this._composingStopTimeout.bind(this));
GLib.Source.set_name_by_id(this._composingTimeoutId, '[gnome-shell] this._composingStopTimeout');
diff --git a/js/ui/dash.js b/js/ui/dash.js
index c866dabbfa..3d95ddab2d 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -2,7 +2,6 @@
/* exported Dash */
const { Clutter, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const AppDisplay = imports.ui.appDisplay;
@@ -500,7 +499,7 @@ var Dash = class Dash {
// that the notify::hover handler does everything we need to.
if (opened) {
if (this._showLabelTimeoutId > 0) {
- Mainloop.source_remove(this._showLabelTimeoutId);
+ GLib.source_remove(this._showLabelTimeoutId);
this._showLabelTimeoutId = 0;
}
@@ -514,7 +513,7 @@ var Dash = class Dash {
if (shouldShow) {
if (this._showLabelTimeoutId == 0) {
let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT;
- this._showLabelTimeoutId = Mainloop.timeout_add(timeout,
+ this._showLabelTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, timeout,
() => {
this._labelShowing = true;
item.showLabel();
@@ -523,17 +522,17 @@ var Dash = class Dash {
});
GLib.Source.set_name_by_id(this._showLabelTimeoutId, '[gnome-shell] item.showLabel');
if (this._resetHoverTimeoutId > 0) {
- Mainloop.source_remove(this._resetHoverTimeoutId);
+ GLib.source_remove(this._resetHoverTimeoutId);
this._resetHoverTimeoutId = 0;
}
}
} else {
if (this._showLabelTimeoutId > 0)
- Mainloop.source_remove(this._showLabelTimeoutId);
+ GLib.source_remove(this._showLabelTimeoutId);
this._showLabelTimeoutId = 0;
item.hideLabel();
if (this._labelShowing) {
- this._resetHoverTimeoutId = Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT,
+ this._resetHoverTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, DASH_ITEM_HOVER_TIMEOUT,
() => {
this._labelShowing = false;
this._resetHoverTimeoutId = 0;
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index f51eb7bee0..6267152f14 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -17,8 +17,6 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-const Mainloop = imports.mainloop;
-
const { AccountsService, Clutter, Gio,
GLib, GObject, Pango, Polkit, Shell, St } = imports.gi;
@@ -565,7 +563,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
let startTime = GLib.get_monotonic_time();
this._secondsLeft = this._totalSecondsToStayOpen;
- this._timerId = Mainloop.timeout_add_seconds(1, () => {
+ this._timerId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => {
let currentTime = GLib.get_monotonic_time();
let secondsElapsed = ((currentTime - startTime) / 1000000);
@@ -587,7 +585,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
_stopTimer() {
if (this._timerId > 0) {
- Mainloop.source_remove(this._timerId);
+ GLib.source_remove(this._timerId);
this._timerId = 0;
}
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 1143dedb52..9f692f4aa7 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -3,7 +3,6 @@
const { Clutter, Cogl, Gio, GLib,
GObject, Meta, Pango, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const System = imports.system;
@@ -20,7 +19,6 @@ const CHEVRON = '>>> ';
/* Imports...feel free to add here as needed */
var commandHeader = 'const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; ' +
'const Main = imports.ui.main; ' +
- 'const Mainloop = imports.mainloop; ' +
/* Utility functions...we should probably be able to use these
* in the shell core code too. */
'const stage = global.stage; ' +
@@ -821,7 +819,7 @@ var LookingGlass = class LookingGlass {
gcIcon.connect('button-press-event', () => {
gcIcon.icon_name = 'user-trash';
System.gc();
- this._timeoutId = Mainloop.timeout_add(500, () => {
+ this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, () => {
gcIcon.icon_name = 'user-trash-full';
this._timeoutId = 0;
return GLib.SOURCE_REMOVE;
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index 379ff5b4dc..9d3ad6473c 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -2,7 +2,6 @@
const { Atspi, Clutter, GDesktopEnums,
Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Background = imports.ui.background;
@@ -1144,7 +1143,7 @@ var ZoomRegion = class ZoomRegion {
_clearScrollContentsTimer() {
if (this._scrollContentsTimerId != 0) {
- Mainloop.source_remove(this._scrollContentsTimerId);
+ GLib.source_remove(this._scrollContentsTimerId);
this._scrollContentsTimerId = 0;
}
}
@@ -1156,7 +1155,7 @@ var ZoomRegion = class ZoomRegion {
}
this._clearScrollContentsTimer();
- this._scrollContentsTimerId = Mainloop.timeout_add(POINTER_REST_TIME, () => {
+ this._scrollContentsTimerId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, POINTER_REST_TIME, () => {
this._scrollContentsToDelayed(x, y);
return GLib.SOURCE_REMOVE;
});
diff --git a/js/ui/main.js b/js/ui/main.js
index d5d18b2ced..4300dba670 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -9,7 +9,6 @@
initializeDeferredWork, getThemeStylesheet, setThemeStylesheet */
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const AccessDialog = imports.ui.accessDialog;
const AudioDeviceSelection = imports.ui.audioDeviceSelection;
@@ -620,7 +619,7 @@ function _runDeferredWork(workId) {
_deferredWorkQueue.splice(index, 1);
_deferredWorkData[workId].callback();
if (_deferredWorkQueue.length == 0 && _deferredTimeoutId > 0) {
- Mainloop.source_remove(_deferredTimeoutId);
+ GLib.source_remove(_deferredTimeoutId);
_deferredTimeoutId = 0;
}
}
@@ -708,7 +707,7 @@ function queueDeferredWork(workId) {
_queueBeforeRedraw(workId);
return;
} else if (_deferredTimeoutId == 0) {
- _deferredTimeoutId = Mainloop.timeout_add_seconds(DEFERRED_TIMEOUT_SECONDS, () => {
+ _deferredTimeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, DEFERRED_TIMEOUT_SECONDS, () =>
{
_runAllDeferredWork();
_deferredTimeoutId = 0;
return GLib.SOURCE_REMOVE;
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 801b28818b..eca670b123 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -4,7 +4,6 @@
SystemNotificationSource, MessageTray */
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Calendar = imports.ui.calendar;
@@ -1091,7 +1090,7 @@ var MessageTray = class MessageTray {
_resetNotificationLeftTimeout() {
this._useLongerNotificationLeftTimeout = false;
if (this._notificationLeftTimeoutId) {
- Mainloop.source_remove(this._notificationLeftTimeoutId);
+ GLib.source_remove(this._notificationLeftTimeoutId);
this._notificationLeftTimeoutId = 0;
this._notificationLeftMouseX = -1;
this._notificationLeftMouseY = -1;
@@ -1137,7 +1136,7 @@ var MessageTray = class MessageTray {
// We wait for a longer period if the notification popped up where the mouse pointer was already
positioned.
// That gives the user more time to mouse away from the notification and mouse back in in order
to expand it.
let timeout = this._useLongerNotificationLeftTimeout ? LONGER_HIDE_TIMEOUT : HIDE_TIMEOUT;
- this._notificationLeftTimeoutId = Mainloop.timeout_add(timeout,
this._onNotificationLeftTimeout.bind(this));
+ this._notificationLeftTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, timeout,
this._onNotificationLeftTimeout.bind(this));
GLib.Source.set_name_by_id(this._notificationLeftTimeoutId, '[gnome-shell]
this._onNotificationLeftTimeout');
}
}
@@ -1166,8 +1165,10 @@ var MessageTray = class MessageTray {
x < this._notificationLeftMouseX + MOUSE_LEFT_ACTOR_THRESHOLD &&
x > this._notificationLeftMouseX - MOUSE_LEFT_ACTOR_THRESHOLD) {
this._notificationLeftMouseX = -1;
- this._notificationLeftTimeoutId = Mainloop.timeout_add(LONGER_HIDE_TIMEOUT,
-
this._onNotificationLeftTimeout.bind(this));
+ this._notificationLeftTimeoutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT,
+ LONGER_HIDE_TIMEOUT,
+ this._onNotificationLeftTimeout.bind(this));
GLib.Source.set_name_by_id(this._notificationLeftTimeoutId, '[gnome-shell]
this._onNotificationLeftTimeout');
} else {
this._notificationLeftTimeoutId = 0;
@@ -1345,13 +1346,13 @@ var MessageTray = class MessageTray {
_updateNotificationTimeout(timeout) {
if (this._notificationTimeoutId) {
- Mainloop.source_remove(this._notificationTimeoutId);
+ GLib.source_remove(this._notificationTimeoutId);
this._notificationTimeoutId = 0;
}
if (timeout > 0) {
this._notificationTimeoutId =
- Mainloop.timeout_add(timeout,
- this._notificationTimeout.bind(this));
+ GLib.timeout_add(GLib.PRIORITY_DEFAULT, timeout,
+ this._notificationTimeout.bind(this));
GLib.Source.set_name_by_id(this._notificationTimeoutId, '[gnome-shell]
this._notificationTimeout');
}
}
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 580174c65a..34b149628d 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -2,7 +2,6 @@
/* exported NotificationDaemon */
const { GdkPixbuf, Gio, GLib, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Config = imports.misc.config;
const Main = imports.ui.main;
@@ -171,7 +170,7 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
// Ignore replacesId since we already sent back a
// NotificationClosed for that id.
id = this._nextNotificationId++;
- let idleId = Mainloop.idle_add(() => {
+ let idleId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
return GLib.SOURCE_REMOVE;
});
diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js
index 0f85dce385..8c92347909 100644
--- a/js/ui/osdWindow.js
+++ b/js/ui/osdWindow.js
@@ -2,7 +2,6 @@
/* exported OsdWindowManager */
const { Clutter, GLib, GObject, Meta, St } = imports.gi;
-const Mainloop = imports.mainloop;
const BarLevel = imports.ui.barLevel;
const Layout = imports.ui.layout;
@@ -143,9 +142,9 @@ var OsdWindow = class {
}
if (this._hideTimeoutId)
- Mainloop.source_remove(this._hideTimeoutId);
- this._hideTimeoutId = Mainloop.timeout_add(HIDE_TIMEOUT,
- this._hide.bind(this));
+ GLib.source_remove(this._hideTimeoutId);
+ this._hideTimeoutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT, HIDE_TIMEOUT, this._hide.bind(this));
GLib.Source.set_name_by_id(this._hideTimeoutId, '[gnome-shell] this._hide');
}
@@ -153,7 +152,7 @@ var OsdWindow = class {
if (!this._hideTimeoutId)
return;
- Mainloop.source_remove(this._hideTimeoutId);
+ GLib.source_remove(this._hideTimeoutId);
this._hide();
}
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 49907b9d29..f8b603305b 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -2,7 +2,6 @@
/* exported Overview */
const { Clutter, GLib, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Background = imports.ui.background;
@@ -300,7 +299,7 @@ var Overview = class {
_resetWindowSwitchTimeout() {
if (this._windowSwitchTimeoutId != 0) {
- Mainloop.source_remove(this._windowSwitchTimeoutId);
+ GLib.source_remove(this._windowSwitchTimeoutId);
this._windowSwitchTimeoutId = 0;
}
}
@@ -323,7 +322,9 @@ var Overview = class {
if (targetIsWindow) {
this._lastHoveredWindow = dragEvent.targetActor._delegate.metaWindow;
- this._windowSwitchTimeoutId = Mainloop.timeout_add(DND_WINDOW_SWITCH_TIMEOUT,
+ this._windowSwitchTimeoutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT,
+ DND_WINDOW_SWITCH_TIMEOUT,
() => {
this._windowSwitchTimeoutId = 0;
Main.activateWindow(dragEvent.targetActor._delegate.metaWindow,
diff --git a/js/ui/panel.js b/js/ui/panel.js
index b5da454320..49c0038fac 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -3,7 +3,6 @@
const { Atk, Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Cairo = imports.cairo;
-const Mainloop = imports.mainloop;
const Animation = imports.ui.animation;
const Config = imports.misc.config;
@@ -451,8 +450,8 @@ class ActivitiesButton extends PanelMenu.Button {
return DND.DragMotionResult.CONTINUE;
if (this._xdndTimeOut != 0)
- Mainloop.source_remove(this._xdndTimeOut);
- this._xdndTimeOut = Mainloop.timeout_add(BUTTON_DND_ACTIVATION_TIMEOUT, () => {
+ GLib.source_remove(this._xdndTimeOut);
+ this._xdndTimeOut = GLib.timeout_add(GLib.PRIORITY_DEFAULT, BUTTON_DND_ACTIVATION_TIMEOUT, () => {
this._xdndToggleOverview();
});
GLib.Source.set_name_by_id(this._xdndTimeOut, '[gnome-shell] this._xdndToggleOverview');
@@ -496,7 +495,7 @@ class ActivitiesButton extends PanelMenu.Button {
if (pickedActor == this && Main.overview.shouldToggleByCornerOrButton())
Main.overview.toggle();
- Mainloop.source_remove(this._xdndTimeOut);
+ GLib.source_remove(this._xdndTimeOut);
this._xdndTimeOut = 0;
return GLib.SOURCE_REMOVE;
}
diff --git a/js/ui/pointerWatcher.js b/js/ui/pointerWatcher.js
index 6c61fe64bf..9dbdcf623c 100644
--- a/js/ui/pointerWatcher.js
+++ b/js/ui/pointerWatcher.js
@@ -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');
}
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index 8e4fba1ee0..898e999faa 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -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;
}
diff --git a/js/ui/scripting.js b/js/ui/scripting.js
index 5e779e6a88..7a14fcf551 100644
--- a/js/ui/scripting.js
+++ b/js/ui/scripting.js
@@ -4,7 +4,6 @@
collectStatistics, runPerfScript */
const { Gio, GLib, Meta, Shell } = imports.gi;
-const Mainloop = imports.mainloop;
const Main = imports.ui.main;
const Params = imports.misc.params;
@@ -41,7 +40,7 @@ const { loadInterfaceXML } = imports.misc.fileUtils;
*/
function sleep(milliseconds) {
return new Promise(resolve => {
- let id = Mainloop.timeout_add(milliseconds, () => {
+ let id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, milliseconds, () => {
resolve();
return GLib.SOURCE_REMOVE;
});
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index f8b38f609f..583780111a 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -2,7 +2,6 @@
/* exported SessionMode, listModes */
const GLib = imports.gi.GLib;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const FileUtils = imports.misc.fileUtils;
@@ -141,15 +140,16 @@ function _loadModes() {
function listModes() {
_loadModes();
- let id = Mainloop.idle_add(() => {
+ let loop = new GLib.MainLoop(null, false);
+ let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
let names = Object.getOwnPropertyNames(_modes);
for (let i = 0; i < names.length; i++)
if (_modes[names[i]].isPrimary)
print(names[i]);
- Mainloop.quit('listModes');
+ loop.quit();
});
GLib.Source.set_name_by_id(id, '[gnome-shell] listModes');
- Mainloop.run('listModes');
+ loop.run();
}
var SessionMode = class {
diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js
index ad2c2b406e..56d7802b3f 100644
--- a/js/ui/status/accessibility.js
+++ b/js/ui/status/accessibility.js
@@ -2,7 +2,6 @@
/* exported ATIndicator */
const { Gio, GLib, GObject, St } = imports.gi;
-const Mainloop = imports.mainloop;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
@@ -96,7 +95,7 @@ class ATIndicator extends PanelMenu.Button {
if (this._syncMenuVisibilityIdle)
return;
- this._syncMenuVisibilityIdle = Mainloop.idle_add(this._syncMenuVisibility.bind(this));
+ this._syncMenuVisibilityIdle = GLib.idle_add(GLib.PRIORITY_DEFAULT,
this._syncMenuVisibility.bind(this));
GLib.Source.set_name_by_id(this._syncMenuVisibilityIdle, '[gnome-shell] this._syncMenuVisibility');
}
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 4bb012d889..93f95a226c 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1,7 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported NMApplet */
const { Clutter, Gio, GLib, GObject, NM, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Animation = imports.ui.animation;
@@ -719,7 +718,7 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
this._updateSensitivity();
this._syncView();
- this._scanTimeoutId = Mainloop.timeout_add_seconds(15, this._onScanTimeout.bind(this));
+ this._scanTimeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 15,
this._onScanTimeout.bind(this));
GLib.Source.set_name_by_id(this._scanTimeoutId, '[gnome-shell] this._onScanTimeout');
this._onScanTimeout();
@@ -757,7 +756,7 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
}
if (this._scanTimeoutId) {
- Mainloop.source_remove(this._scanTimeoutId);
+ GLib.source_remove(this._scanTimeoutId);
this._scanTimeoutId = 0;
}
}
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index c311026c3d..9bb690c6eb 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -2,7 +2,6 @@
/* exported SwitcherPopup, SwitcherList */
const { Clutter, GLib, GObject, Meta, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Main = imports.ui.main;
@@ -142,13 +141,15 @@ var SwitcherPopup = GObject.registerClass({
// We delay showing the popup so that fast Alt+Tab users aren't
// disturbed by the popup briefly flashing.
- this._initialDelayTimeoutId = Mainloop.timeout_add(POPUP_DELAY_TIMEOUT,
- () => {
- Main.osdWindowManager.hideAll();
- this.opacity = 255;
- this._initialDelayTimeoutId = 0;
- return GLib.SOURCE_REMOVE;
- });
+ this._initialDelayTimeoutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT,
+ POPUP_DELAY_TIMEOUT,
+ () => {
+ Main.osdWindowManager.hideAll();
+ this.opacity = 255;
+ this._initialDelayTimeoutId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
GLib.Source.set_name_by_id(this._initialDelayTimeoutId, '[gnome-shell] Main.osdWindow.cancel');
return true;
}
@@ -249,9 +250,9 @@ var SwitcherPopup = GObject.registerClass({
this.mouseActive = false;
if (this._motionTimeoutId != 0)
- Mainloop.source_remove(this._motionTimeoutId);
+ GLib.source_remove(this._motionTimeoutId);
- this._motionTimeoutId = Mainloop.timeout_add(DISABLE_HOVER_TIMEOUT, this._mouseTimedOut.bind(this));
+ this._motionTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, DISABLE_HOVER_TIMEOUT,
this._mouseTimedOut.bind(this));
GLib.Source.set_name_by_id(this._motionTimeoutId, '[gnome-shell] this._mouseTimedOut');
}
@@ -263,14 +264,16 @@ var SwitcherPopup = GObject.registerClass({
_resetNoModsTimeout() {
if (this._noModsTimeoutId != 0)
- Mainloop.source_remove(this._noModsTimeoutId);
+ GLib.source_remove(this._noModsTimeoutId);
- this._noModsTimeoutId = Mainloop.timeout_add(NO_MODS_TIMEOUT,
- () => {
- this._finish(global.get_current_time());
- this._noModsTimeoutId = 0;
- return GLib.SOURCE_REMOVE;
- });
+ this._noModsTimeoutId = GLib.timeout_add(
+ GLib.PRIORITY_DEFAULT,
+ NO_MODS_TIMEOUT,
+ () => {
+ this._finish(global.get_current_time());
+ this._noModsTimeoutId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
}
_popModal() {
@@ -302,11 +305,11 @@ var SwitcherPopup = GObject.registerClass({
this._popModal();
if (this._motionTimeoutId != 0)
- Mainloop.source_remove(this._motionTimeoutId);
+ GLib.source_remove(this._motionTimeoutId);
if (this._initialDelayTimeoutId != 0)
- Mainloop.source_remove(this._initialDelayTimeoutId);
+ GLib.source_remove(this._initialDelayTimeoutId);
if (this._noModsTimeoutId != 0)
- Mainloop.source_remove(this._noModsTimeoutId);
+ GLib.source_remove(this._noModsTimeoutId);
}
_select(num) {
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index ca9c31fd60..7559b6f30f 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -2,7 +2,6 @@
/* exported WindowManager */
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const AltTab = imports.ui.altTab;
@@ -71,13 +70,13 @@ class DisplayChangeDialog extends ModalDialog.ModalDialog {
action: this._onSuccess.bind(this),
default: true });
- this._timeoutId = Mainloop.timeout_add(ONE_SECOND, this._tick.bind(this));
+ this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, ONE_SECOND, this._tick.bind(this));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._tick');
}
close(timestamp) {
if (this._timeoutId > 0) {
- Mainloop.source_remove(this._timeoutId);
+ GLib.source_remove(this._timeoutId);
this._timeoutId = 0;
}
@@ -281,9 +280,9 @@ var WorkspaceTracker = class {
keepWorkspaceAlive(workspace, duration) {
if (workspace._keepAliveId)
- Mainloop.source_remove(workspace._keepAliveId);
+ GLib.source_remove(workspace._keepAliveId);
- workspace._keepAliveId = Mainloop.timeout_add(duration, () => {
+ workspace._keepAliveId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, duration, () => {
workspace._keepAliveId = 0;
this._queueCheckWorkspaces();
return GLib.SOURCE_REMOVE;
@@ -294,7 +293,7 @@ var WorkspaceTracker = class {
_windowRemoved(workspace, window) {
workspace._lastRemovedWindow = window;
this._queueCheckWorkspaces();
- let id = Mainloop.timeout_add(LAST_WINDOW_GRACE_TIME, () => {
+ let id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, LAST_WINDOW_GRACE_TIME, () => {
if (workspace._lastRemovedWindow == window) {
workspace._lastRemovedWindow = null;
this._queueCheckWorkspaces();
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index a8f57fd173..d866e843f9 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -2,7 +2,6 @@
/* exported Workspace */
const { Atk, Clutter, GLib, GObject, Meta, Pango, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const DND = imports.ui.dnd;
@@ -636,7 +635,7 @@ var WindowOverlay = class {
_onDestroy() {
if (this._idleHideOverlayId > 0) {
- Mainloop.source_remove(this._idleHideOverlayId);
+ GLib.source_remove(this._idleHideOverlayId);
this._idleHideOverlayId = 0;
}
this._windowClone.metaWindow.disconnect(this._updateCaptionId);
@@ -688,7 +687,7 @@ var WindowOverlay = class {
_onHideChrome() {
if (this._idleHideOverlayId == 0) {
- this._idleHideOverlayId = Mainloop.timeout_add(WINDOW_OVERLAY_IDLE_HIDE_TIMEOUT,
this._idleHideOverlay.bind(this));
+ this._idleHideOverlayId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
WINDOW_OVERLAY_IDLE_HIDE_TIMEOUT, this._idleHideOverlay.bind(this));
GLib.Source.set_name_by_id(this._idleHideOverlayId, '[gnome-shell] this._idleHideOverlay');
}
}
@@ -705,7 +704,7 @@ var WindowOverlay = class {
hideOverlay() {
if (this._idleHideOverlayId > 0) {
- Mainloop.source_remove(this._idleHideOverlayId);
+ GLib.source_remove(this._idleHideOverlayId);
this._idleHideOverlayId = 0;
}
this.closeButton.hide();
@@ -1269,7 +1268,7 @@ var Workspace = class {
_realRecalculateWindowPositions(flags) {
if (this._repositionWindowsId > 0) {
- Mainloop.source_remove(this._repositionWindowsId);
+ GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0;
}
@@ -1479,7 +1478,7 @@ var Workspace = class {
// remove old handler
if (this._repositionWindowsId > 0) {
- Mainloop.source_remove(this._repositionWindowsId);
+ GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0;
}
@@ -1489,7 +1488,7 @@ var Workspace = class {
this._cursorY = y;
this._currentLayout = null;
- this._repositionWindowsId = Mainloop.timeout_add(WINDOW_REPOSITIONING_DELAY,
+ this._repositionWindowsId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, WINDOW_REPOSITIONING_DELAY,
this._delayedWindowRepositioning.bind(this));
GLib.Source.set_name_by_id(this._repositionWindowsId, '[gnome-shell]
this._delayedWindowRepositioning');
}
@@ -1503,7 +1502,7 @@ var Workspace = class {
if (!win) {
// Newly-created windows are added to a workspace before
// the compositor finds out about them...
- let id = Mainloop.idle_add(() => {
+ let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
if (this.actor &&
metaWin.get_compositor_private() &&
metaWin.get_workspace() == this.metaWorkspace)
@@ -1649,7 +1648,7 @@ var Workspace = class {
this._windows[i].remove_all_transitions();
if (this._repositionWindowsId > 0) {
- Mainloop.source_remove(this._repositionWindowsId);
+ GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0;
}
@@ -1734,7 +1733,7 @@ var Workspace = class {
this._windows[i].remove_all_transitions();
if (this._repositionWindowsId > 0) {
- Mainloop.source_remove(this._repositionWindowsId);
+ GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0;
}
this._overviewHiddenId = Main.overview.connect('hidden', this._doneLeavingOverview.bind(this));
@@ -1795,7 +1794,7 @@ var Workspace = class {
global.display.disconnect(this._windowLeftMonitorId);
if (this._repositionWindowsId > 0) {
- Mainloop.source_remove(this._repositionWindowsId);
+ GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0;
}
diff --git a/js/ui/workspaceSwitcherPopup.js b/js/ui/workspaceSwitcherPopup.js
index d5519fa8b6..ee2ea92ad7 100644
--- a/js/ui/workspaceSwitcherPopup.js
+++ b/js/ui/workspaceSwitcherPopup.js
@@ -2,7 +2,6 @@
/* exported WorkspaceSwitcherPopup */
const { Clutter, GLib, GObject, Meta, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Main = imports.ui.main;
@@ -195,14 +194,14 @@ class WorkspaceSwitcherPopup extends St.Widget {
this._redisplay();
if (this._timeoutId != 0)
- Mainloop.source_remove(this._timeoutId);
- this._timeoutId = Mainloop.timeout_add(DISPLAY_TIMEOUT, this._onTimeout.bind(this));
+ GLib.source_remove(this._timeoutId);
+ this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, DISPLAY_TIMEOUT,
this._onTimeout.bind(this));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
this._show();
}
_onTimeout() {
- Mainloop.source_remove(this._timeoutId);
+ GLib.source_remove(this._timeoutId);
this._timeoutId = 0;
this._container.ease({
opacity: 0.0,
@@ -215,7 +214,7 @@ class WorkspaceSwitcherPopup extends St.Widget {
_onDestroy() {
if (this._timeoutId)
- Mainloop.source_remove(this._timeoutId);
+ GLib.source_remove(this._timeoutId);
this._timeoutId = 0;
let workspaceManager = global.workspace_manager;
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index fd60c31d2c..0c9bed12ab 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -2,7 +2,6 @@
/* exported WorkspaceThumbnail, ThumbnailsBox */
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Background = imports.ui.background;
@@ -389,7 +388,7 @@ var WorkspaceThumbnail = GObject.registerClass({
if (!win) {
// Newly-created windows are added to a workspace before
// the compositor finds out about them...
- let id = Mainloop.idle_add(() => {
+ let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
if (!this._removed &&
metaWin.get_compositor_private() &&
metaWin.get_workspace() == this.metaWorkspace)
diff --git a/tests/interactive/box-shadow-animated.js b/tests/interactive/box-shadow-animated.js
index 5facee3dc4..cf117a7f3a 100644
--- a/tests/interactive/box-shadow-animated.js
+++ b/tests/interactive/box-shadow-animated.js
@@ -3,7 +3,6 @@
const UI = imports.testcommon.ui;
const { Clutter, GLib, St } = imports.gi;
-const Mainloop = imports.mainloop;
const DELAY = 2000;
@@ -59,14 +58,14 @@ function test() {
resize_animated(label1);
resize_animated(label2);
- Mainloop.timeout_add(DELAY, () => {
+ GLib.timeout_add(GLib.PRIORITY_DEFAULT, DELAY, () => {
log(label1 + label1.get_size());
resize_animated(label1);
resize_animated(label2);
return true;
});
- Mainloop.timeout_add(2 * DELAY, () => {
+ GLib.timeout_add(GLib.PRIORITY_DEFAULT, 2 * DELAY, () => {
iter += 1;
iter %= shadowStyles.length;
label1.set_style(get_css_style(shadowStyles[iter]));
diff --git a/tests/interactive/entry.js b/tests/interactive/entry.js
index 2f0abeab1a..9ae010604e 100644
--- a/tests/interactive/entry.js
+++ b/tests/interactive/entry.js
@@ -2,8 +2,7 @@
const UI = imports.testcommon.ui;
-const { Clutter, St } = imports.gi;
-const Mainloop = imports.mainloop;
+const { Clutter, GLib, St } = imports.gi;
function test() {
let stage = new Clutter.Stage({ width: 400, height: 400 });
@@ -39,7 +38,7 @@ function test() {
let entryHintBoth = new St.Entry({ style: 'border: 1px solid black; text-shadow: 0 2px red;',
hint_actor: hintActor2 });
let idx = 0;
- Mainloop.timeout_add_seconds(1, function() {
+ GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, function() {
idx++;
if (idx % 2 == 0)
diff --git a/tests/interactive/test-title.js b/tests/interactive/test-title.js
index 9df90218a2..0a468ddd50 100755
--- a/tests/interactive/test-title.js
+++ b/tests/interactive/test-title.js
@@ -2,8 +2,7 @@
imports.gi.versions.Gtk = '3.0';
-const Gtk = imports.gi.Gtk;
-const Mainloop = imports.mainloop;
+const { GLib, Gtk } = imports.gi;
function nextTitle() {
let length = Math.random() * 20;
@@ -26,7 +25,7 @@ function main() {
});
win.present();
- Mainloop.timeout_add(5000, function() {
+ GLib.timeout_add(GLib.PRIORITY_DEFAULT, 5000, function() {
win.title = nextTitle();
return true;
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]