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 getIBusManager */ /* exported getIBusManager */
const { Gio, GLib, IBus } = imports.gi; const { Gio, GLib, IBus } = imports.gi;
const Mainloop = imports.mainloop;
const Signals = imports.signals; const Signals = imports.signals;
const IBusCandidatePopup = imports.ui.ibusCandidatePopup; const IBusCandidatePopup = imports.ui.ibusCandidatePopup;
@ -216,21 +215,23 @@ var IBusManager = class {
return; return;
if (this._preloadEnginesId != 0) { if (this._preloadEnginesId != 0) {
Mainloop.source_remove(this._preloadEnginesId); GLib.source_remove(this._preloadEnginesId);
this._preloadEnginesId = 0; this._preloadEnginesId = 0;
} }
this._preloadEnginesId = this._preloadEnginesId =
Mainloop.timeout_add_seconds(this._PRELOAD_ENGINES_DELAY_TIME, GLib.timeout_add_seconds(
() => { GLib.PRIORITY_DEFAULT,
this._ibus.preload_engines_async( this._PRELOAD_ENGINES_DELAY_TIME,
ids, () => {
-1, this._ibus.preload_engines_async(
null, ids,
null); -1,
this._preloadEnginesId = 0; null,
return GLib.SOURCE_REMOVE; null);
}); this._preloadEnginesId = 0;
return GLib.SOURCE_REMOVE;
});
} }
}; };
Signals.addSignalMethods(IBusManager.prototype); Signals.addSignalMethods(IBusManager.prototype);

View File

@ -3,7 +3,6 @@
WindowCyclerPopup */ WindowCyclerPopup */
const { Atk, Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; const { Atk, Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Mainloop = imports.mainloop;
const Main = imports.ui.main; const Main = imports.ui.main;
const SwitcherPopup = imports.ui.switcherPopup; const SwitcherPopup = imports.ui.switcherPopup;
@ -292,7 +291,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
if (this._thumbnails) if (this._thumbnails)
this._destroyThumbnails(); this._destroyThumbnails();
if (this._thumbnailTimeoutId != 0) 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) { if (this._thumbnailTimeoutId != 0) {
Mainloop.source_remove(this._thumbnailTimeoutId); GLib.source_remove(this._thumbnailTimeoutId);
this._thumbnailTimeoutId = 0; this._thumbnailTimeoutId = 0;
} }
@ -344,7 +343,8 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
this._thumbnails.highlight(window, forceAppFocus); this._thumbnails.highlight(window, forceAppFocus);
} else if (this._items[this._selectedIndex].cachedWindows.length > 1 && } else if (this._items[this._selectedIndex].cachedWindows.length > 1 &&
!forceAppFocus) { !forceAppFocus) {
this._thumbnailTimeoutId = Mainloop.timeout_add ( this._thumbnailTimeoutId = GLib.timeout_add(
GLib.PRIORITY_DEFAULT,
THUMBNAIL_POPUP_TIME, THUMBNAIL_POPUP_TIME,
this._timeoutPopupThumbnails.bind(this)); this._timeoutPopupThumbnails.bind(this));
GLib.Source.set_name_by_id(this._thumbnailTimeoutId, '[gnome-shell] this._timeoutPopupThumbnails'); GLib.Source.set_name_by_id(this._thumbnailTimeoutId, '[gnome-shell] this._timeoutPopupThumbnails');
@ -712,7 +712,7 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
_onDestroy() { _onDestroy() {
if (this._mouseTimeOutId != 0) if (this._mouseTimeOutId != 0)
Mainloop.source_remove(this._mouseTimeOutId); GLib.source_remove(this._mouseTimeOutId);
this.icons.forEach(icon => { this.icons.forEach(icon => {
icon.app.disconnect(icon._stateChangedId); icon.app.disconnect(icon._stateChangedId);
@ -791,14 +791,16 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
// activation when the thumbnail list is open // activation when the thumbnail list is open
_onItemEnter(index) { _onItemEnter(index) {
if (this._mouseTimeOutId != 0) if (this._mouseTimeOutId != 0)
Mainloop.source_remove(this._mouseTimeOutId); GLib.source_remove(this._mouseTimeOutId);
if (this._altTabPopup.thumbnailsVisible) { if (this._altTabPopup.thumbnailsVisible) {
this._mouseTimeOutId = Mainloop.timeout_add(APP_ICON_HOVER_TIMEOUT, this._mouseTimeOutId = GLib.timeout_add(
() => { GLib.PRIORITY_DEFAULT,
this._enterItem(index); APP_ICON_HOVER_TIMEOUT,
this._mouseTimeOutId = 0; () => {
return GLib.SOURCE_REMOVE; this._enterItem(index);
}); this._mouseTimeOutId = 0;
return GLib.SOURCE_REMOVE;
});
GLib.Source.set_name_by_id(this._mouseTimeOutId, '[gnome-shell] this._enterItem'); GLib.Source.set_name_by_id(this._mouseTimeOutId, '[gnome-shell] this._enterItem');
} else { } else {
this._itemEntered(index); this._itemEntered(index);

View File

@ -2,7 +2,6 @@
/* exported Animation, AnimatedIcon, Spinner */ /* exported Animation, AnimatedIcon, Spinner */
const { Clutter, GLib, Gio, St } = imports.gi; const { Clutter, GLib, Gio, St } = imports.gi;
const Mainloop = imports.mainloop;
var ANIMATED_ICON_UPDATE_TIMEOUT = 16; var ANIMATED_ICON_UPDATE_TIMEOUT = 16;
var SPINNER_ANIMATION_TIME = 300; var SPINNER_ANIMATION_TIME = 300;
@ -45,7 +44,7 @@ var Animation = class {
stop() { stop() {
if (this._timeoutId > 0) { if (this._timeoutId > 0) {
Mainloop.source_remove(this._timeoutId); GLib.source_remove(this._timeoutId);
this._timeoutId = 0; this._timeoutId = 0;
} }

View File

@ -3,7 +3,6 @@
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Signals = imports.signals; const Signals = imports.signals;
const Mainloop = imports.mainloop;
const AppFavorites = imports.ui.appFavorites; const AppFavorites = imports.ui.appFavorites;
const BoxPointer = imports.ui.boxpointer; const BoxPointer = imports.ui.boxpointer;
@ -1639,14 +1638,14 @@ var FolderIcon = class FolderIcon {
_removeMenuTimeout() { _removeMenuTimeout() {
if (this._popupTimeoutId > 0) { if (this._popupTimeoutId > 0) {
Mainloop.source_remove(this._popupTimeoutId); GLib.source_remove(this._popupTimeoutId);
this._popupTimeoutId = 0; this._popupTimeoutId = 0;
} }
} }
_setPopupTimeout() { _setPopupTimeout() {
this._removeMenuTimeout(); 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._popupTimeoutId = 0;
this._popupRenamePopup(); this._popupRenamePopup();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
@ -2076,7 +2075,7 @@ var AppIcon = class AppIcon {
_removeMenuTimeout() { _removeMenuTimeout() {
if (this._menuTimeoutId > 0) { if (this._menuTimeoutId > 0) {
Mainloop.source_remove(this._menuTimeoutId); GLib.source_remove(this._menuTimeoutId);
this._menuTimeoutId = 0; this._menuTimeoutId = 0;
} }
} }
@ -2090,7 +2089,7 @@ var AppIcon = class AppIcon {
_setPopupTimeout() { _setPopupTimeout() {
this._removeMenuTimeout(); 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._menuTimeoutId = 0;
this.popupMenu(); this.popupMenu();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;

View File

@ -2,7 +2,6 @@
/* exported Component */ /* exported Component */
const { Gio, GLib } = imports.gi; const { Gio, GLib } = imports.gi;
const Mainloop = imports.mainloop;
const Params = imports.misc.params; const Params = imports.misc.params;
const GnomeSession = imports.misc.gnomeSession; const GnomeSession = imports.misc.gnomeSession;
@ -39,7 +38,7 @@ var AutomountManager = class {
this._driveDisconnectedId = this._volumeMonitor.connect('drive-disconnected', this._onDriveDisconnected.bind(this)); this._driveDisconnectedId = this._volumeMonitor.connect('drive-disconnected', this._onDriveDisconnected.bind(this));
this._driveEjectButtonId = this._volumeMonitor.connect('drive-eject-button', this._onDriveEjectButton.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'); GLib.Source.set_name_by_id(this._mountAllId, '[gnome-shell] this._startupMountAll');
} }
@ -51,7 +50,7 @@ var AutomountManager = class {
this._volumeMonitor.disconnect(this._driveEjectButtonId); this._volumeMonitor.disconnect(this._driveEjectButtonId);
if (this._mountAllId > 0) { if (this._mountAllId > 0) {
Mainloop.source_remove(this._mountAllId); GLib.source_remove(this._mountAllId);
this._mountAllId = 0; this._mountAllId = 0;
} }
} }
@ -220,7 +219,7 @@ var AutomountManager = class {
_onVolumeRemoved(monitor, volume) { _onVolumeRemoved(monitor, volume) {
if (volume._allowAutorunExpireId && volume._allowAutorunExpireId > 0) { if (volume._allowAutorunExpireId && volume._allowAutorunExpireId > 0) {
Mainloop.source_remove(volume._allowAutorunExpireId); GLib.source_remove(volume._allowAutorunExpireId);
delete volume._allowAutorunExpireId; delete volume._allowAutorunExpireId;
} }
this._volumeQueue = this._volumeQueue =
@ -249,7 +248,7 @@ var AutomountManager = class {
} }
_allowAutorunExpire(volume) { _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; volume.allowAutorun = false;
delete volume._allowAutorunExpireId; delete volume._allowAutorunExpireId;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;

View File

@ -3,7 +3,6 @@
const { Clutter, Gio, GLib, GObject, St } = imports.gi; const { Clutter, Gio, GLib, GObject, St } = imports.gi;
const Lang = imports.lang; const Lang = imports.lang;
const Mainloop = imports.mainloop;
var Tpl = null; var Tpl = null;
var Tp = 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 // Wait a bit before notifying for the received message, a handler
// could ack it in the meantime. // could ack it in the meantime.
if (this._notifyTimeoutId != 0) if (this._notifyTimeoutId != 0)
Mainloop.source_remove(this._notifyTimeoutId); GLib.source_remove(this._notifyTimeoutId);
this._notifyTimeoutId = Mainloop.timeout_add(500, this._notifyTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500,
this._notifyTimeout.bind(this)); this._notifyTimeout.bind(this));
GLib.Source.set_name_by_id(this._notifyTimeoutId, '[gnome-shell] this._notifyTimeout'); GLib.Source.set_name_by_id(this._notifyTimeoutId, '[gnome-shell] this._notifyTimeout');
} }
@ -641,7 +640,7 @@ var ChatNotification = class extends MessageTray.Notification {
destroy(reason) { destroy(reason) {
if (this._timestampTimeoutId) if (this._timestampTimeoutId)
Mainloop.source_remove(this._timestampTimeoutId); GLib.source_remove(this._timestampTimeoutId);
this._timestampTimeoutId = 0; this._timestampTimeoutId = 0;
super.destroy(reason); super.destroy(reason);
} }
@ -729,7 +728,7 @@ var ChatNotification = class extends MessageTray.Notification {
// Reset the old message timeout // Reset the old message timeout
if (this._timestampTimeoutId) if (this._timestampTimeoutId)
Mainloop.source_remove(this._timestampTimeoutId); GLib.source_remove(this._timestampTimeoutId);
this._timestampTimeoutId = 0; this._timestampTimeoutId = 0;
let message = { realMessage: props.group != 'meta', let message = { realMessage: props.group != 'meta',
@ -747,7 +746,8 @@ var ChatNotification = class extends MessageTray.Notification {
} else { } else {
// Schedule a new timestamp in SCROLLBACK_IMMEDIATE_TIME // Schedule a new timestamp in SCROLLBACK_IMMEDIATE_TIME
// from the timestamp of the message. // 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), SCROLLBACK_IMMEDIATE_TIME - (currentTime - timestamp),
this.appendTimestamp.bind(this)); this.appendTimestamp.bind(this));
GLib.Source.set_name_by_id(this._timestampTimeoutId, '[gnome-shell] this.appendTimestamp'); 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. // Remove composing timeout.
if (this._composingTimeoutId > 0) { if (this._composingTimeoutId > 0) {
Mainloop.source_remove(this._composingTimeoutId); GLib.source_remove(this._composingTimeoutId);
this._composingTimeoutId = 0; this._composingTimeoutId = 0;
} }
if (text != '') { if (text != '') {
this.notification.source.setChatState(Tp.ChannelChatState.COMPOSING); 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, COMPOSING_STOP_TIMEOUT,
this._composingStopTimeout.bind(this)); this._composingStopTimeout.bind(this));
GLib.Source.set_name_by_id(this._composingTimeoutId, '[gnome-shell] this._composingStopTimeout'); GLib.Source.set_name_by_id(this._composingTimeoutId, '[gnome-shell] this._composingStopTimeout');

View File

@ -2,7 +2,6 @@
/* exported Dash */ /* exported Dash */
const { Clutter, GLib, GObject, Meta, Shell, St } = imports.gi; const { Clutter, GLib, GObject, Meta, Shell, St } = imports.gi;
const Mainloop = imports.mainloop;
const Signals = imports.signals; const Signals = imports.signals;
const AppDisplay = imports.ui.appDisplay; const AppDisplay = imports.ui.appDisplay;
@ -500,7 +499,7 @@ var Dash = class Dash {
// that the notify::hover handler does everything we need to. // that the notify::hover handler does everything we need to.
if (opened) { if (opened) {
if (this._showLabelTimeoutId > 0) { if (this._showLabelTimeoutId > 0) {
Mainloop.source_remove(this._showLabelTimeoutId); GLib.source_remove(this._showLabelTimeoutId);
this._showLabelTimeoutId = 0; this._showLabelTimeoutId = 0;
} }
@ -514,7 +513,7 @@ var Dash = class Dash {
if (shouldShow) { if (shouldShow) {
if (this._showLabelTimeoutId == 0) { if (this._showLabelTimeoutId == 0) {
let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT; 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; this._labelShowing = true;
item.showLabel(); item.showLabel();
@ -523,17 +522,17 @@ var Dash = class Dash {
}); });
GLib.Source.set_name_by_id(this._showLabelTimeoutId, '[gnome-shell] item.showLabel'); GLib.Source.set_name_by_id(this._showLabelTimeoutId, '[gnome-shell] item.showLabel');
if (this._resetHoverTimeoutId > 0) { if (this._resetHoverTimeoutId > 0) {
Mainloop.source_remove(this._resetHoverTimeoutId); GLib.source_remove(this._resetHoverTimeoutId);
this._resetHoverTimeoutId = 0; this._resetHoverTimeoutId = 0;
} }
} }
} else { } else {
if (this._showLabelTimeoutId > 0) if (this._showLabelTimeoutId > 0)
Mainloop.source_remove(this._showLabelTimeoutId); GLib.source_remove(this._showLabelTimeoutId);
this._showLabelTimeoutId = 0; this._showLabelTimeoutId = 0;
item.hideLabel(); item.hideLabel();
if (this._labelShowing) { 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._labelShowing = false;
this._resetHoverTimeoutId = 0; this._resetHoverTimeoutId = 0;

View File

@ -17,8 +17,6 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>. * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/ */
const Mainloop = imports.mainloop;
const { AccountsService, Clutter, Gio, const { AccountsService, Clutter, Gio,
GLib, GObject, Pango, Polkit, Shell, St } = imports.gi; GLib, GObject, Pango, Polkit, Shell, St } = imports.gi;
@ -565,7 +563,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
let startTime = GLib.get_monotonic_time(); let startTime = GLib.get_monotonic_time();
this._secondsLeft = this._totalSecondsToStayOpen; 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 currentTime = GLib.get_monotonic_time();
let secondsElapsed = ((currentTime - startTime) / 1000000); let secondsElapsed = ((currentTime - startTime) / 1000000);
@ -587,7 +585,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
_stopTimer() { _stopTimer() {
if (this._timerId > 0) { if (this._timerId > 0) {
Mainloop.source_remove(this._timerId); GLib.source_remove(this._timerId);
this._timerId = 0; this._timerId = 0;
} }

View File

@ -3,7 +3,6 @@
const { Clutter, Cogl, Gio, GLib, const { Clutter, Cogl, Gio, GLib,
GObject, Meta, Pango, Shell, St } = imports.gi; GObject, Meta, Pango, Shell, St } = imports.gi;
const Mainloop = imports.mainloop;
const Signals = imports.signals; const Signals = imports.signals;
const System = imports.system; const System = imports.system;
@ -20,7 +19,6 @@ const CHEVRON = '>>> ';
/* Imports...feel free to add here as needed */ /* Imports...feel free to add here as needed */
var commandHeader = 'const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; ' + var commandHeader = 'const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; ' +
'const Main = imports.ui.main; ' + 'const Main = imports.ui.main; ' +
'const Mainloop = imports.mainloop; ' +
/* Utility functions...we should probably be able to use these /* Utility functions...we should probably be able to use these
* in the shell core code too. */ * in the shell core code too. */
'const stage = global.stage; ' + 'const stage = global.stage; ' +
@ -821,7 +819,7 @@ var LookingGlass = class LookingGlass {
gcIcon.connect('button-press-event', () => { gcIcon.connect('button-press-event', () => {
gcIcon.icon_name = 'user-trash'; gcIcon.icon_name = 'user-trash';
System.gc(); System.gc();
this._timeoutId = Mainloop.timeout_add(500, () => { this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, () => {
gcIcon.icon_name = 'user-trash-full'; gcIcon.icon_name = 'user-trash-full';
this._timeoutId = 0; this._timeoutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;

View File

@ -2,7 +2,6 @@
const { Atspi, Clutter, GDesktopEnums, const { Atspi, Clutter, GDesktopEnums,
Gio, GLib, GObject, Meta, Shell, St } = imports.gi; Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Mainloop = imports.mainloop;
const Signals = imports.signals; const Signals = imports.signals;
const Background = imports.ui.background; const Background = imports.ui.background;
@ -1144,7 +1143,7 @@ var ZoomRegion = class ZoomRegion {
_clearScrollContentsTimer() { _clearScrollContentsTimer() {
if (this._scrollContentsTimerId != 0) { if (this._scrollContentsTimerId != 0) {
Mainloop.source_remove(this._scrollContentsTimerId); GLib.source_remove(this._scrollContentsTimerId);
this._scrollContentsTimerId = 0; this._scrollContentsTimerId = 0;
} }
} }
@ -1156,7 +1155,7 @@ var ZoomRegion = class ZoomRegion {
} }
this._clearScrollContentsTimer(); 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); this._scrollContentsToDelayed(x, y);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });

View File

@ -9,7 +9,6 @@
initializeDeferredWork, getThemeStylesheet, setThemeStylesheet */ initializeDeferredWork, getThemeStylesheet, setThemeStylesheet */
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Mainloop = imports.mainloop;
const AccessDialog = imports.ui.accessDialog; const AccessDialog = imports.ui.accessDialog;
const AudioDeviceSelection = imports.ui.audioDeviceSelection; const AudioDeviceSelection = imports.ui.audioDeviceSelection;
@ -620,7 +619,7 @@ function _runDeferredWork(workId) {
_deferredWorkQueue.splice(index, 1); _deferredWorkQueue.splice(index, 1);
_deferredWorkData[workId].callback(); _deferredWorkData[workId].callback();
if (_deferredWorkQueue.length == 0 && _deferredTimeoutId > 0) { if (_deferredWorkQueue.length == 0 && _deferredTimeoutId > 0) {
Mainloop.source_remove(_deferredTimeoutId); GLib.source_remove(_deferredTimeoutId);
_deferredTimeoutId = 0; _deferredTimeoutId = 0;
} }
} }
@ -708,7 +707,7 @@ function queueDeferredWork(workId) {
_queueBeforeRedraw(workId); _queueBeforeRedraw(workId);
return; return;
} else if (_deferredTimeoutId == 0) { } else if (_deferredTimeoutId == 0) {
_deferredTimeoutId = Mainloop.timeout_add_seconds(DEFERRED_TIMEOUT_SECONDS, () => { _deferredTimeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, DEFERRED_TIMEOUT_SECONDS, () => {
_runAllDeferredWork(); _runAllDeferredWork();
_deferredTimeoutId = 0; _deferredTimeoutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;

View File

@ -4,7 +4,6 @@
SystemNotificationSource, MessageTray */ SystemNotificationSource, MessageTray */
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Mainloop = imports.mainloop;
const Signals = imports.signals; const Signals = imports.signals;
const Calendar = imports.ui.calendar; const Calendar = imports.ui.calendar;
@ -1091,7 +1090,7 @@ var MessageTray = class MessageTray {
_resetNotificationLeftTimeout() { _resetNotificationLeftTimeout() {
this._useLongerNotificationLeftTimeout = false; this._useLongerNotificationLeftTimeout = false;
if (this._notificationLeftTimeoutId) { if (this._notificationLeftTimeoutId) {
Mainloop.source_remove(this._notificationLeftTimeoutId); GLib.source_remove(this._notificationLeftTimeoutId);
this._notificationLeftTimeoutId = 0; this._notificationLeftTimeoutId = 0;
this._notificationLeftMouseX = -1; this._notificationLeftMouseX = -1;
this._notificationLeftMouseY = -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. // 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. // 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; 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'); 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 &&
x > this._notificationLeftMouseX - MOUSE_LEFT_ACTOR_THRESHOLD) { x > this._notificationLeftMouseX - MOUSE_LEFT_ACTOR_THRESHOLD) {
this._notificationLeftMouseX = -1; this._notificationLeftMouseX = -1;
this._notificationLeftTimeoutId = Mainloop.timeout_add(LONGER_HIDE_TIMEOUT, this._notificationLeftTimeoutId = GLib.timeout_add(
this._onNotificationLeftTimeout.bind(this)); GLib.PRIORITY_DEFAULT,
LONGER_HIDE_TIMEOUT,
this._onNotificationLeftTimeout.bind(this));
GLib.Source.set_name_by_id(this._notificationLeftTimeoutId, '[gnome-shell] this._onNotificationLeftTimeout'); GLib.Source.set_name_by_id(this._notificationLeftTimeoutId, '[gnome-shell] this._onNotificationLeftTimeout');
} else { } else {
this._notificationLeftTimeoutId = 0; this._notificationLeftTimeoutId = 0;
@ -1345,13 +1346,13 @@ var MessageTray = class MessageTray {
_updateNotificationTimeout(timeout) { _updateNotificationTimeout(timeout) {
if (this._notificationTimeoutId) { if (this._notificationTimeoutId) {
Mainloop.source_remove(this._notificationTimeoutId); GLib.source_remove(this._notificationTimeoutId);
this._notificationTimeoutId = 0; this._notificationTimeoutId = 0;
} }
if (timeout > 0) { if (timeout > 0) {
this._notificationTimeoutId = this._notificationTimeoutId =
Mainloop.timeout_add(timeout, GLib.timeout_add(GLib.PRIORITY_DEFAULT, timeout,
this._notificationTimeout.bind(this)); this._notificationTimeout.bind(this));
GLib.Source.set_name_by_id(this._notificationTimeoutId, '[gnome-shell] this._notificationTimeout'); GLib.Source.set_name_by_id(this._notificationTimeoutId, '[gnome-shell] this._notificationTimeout');
} }
} }

View File

@ -2,7 +2,6 @@
/* exported NotificationDaemon */ /* exported NotificationDaemon */
const { GdkPixbuf, Gio, GLib, Shell, St } = imports.gi; const { GdkPixbuf, Gio, GLib, Shell, St } = imports.gi;
const Mainloop = imports.mainloop;
const Config = imports.misc.config; const Config = imports.misc.config;
const Main = imports.ui.main; const Main = imports.ui.main;
@ -171,7 +170,7 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
// Ignore replacesId since we already sent back a // Ignore replacesId since we already sent back a
// NotificationClosed for that id. // NotificationClosed for that id.
id = this._nextNotificationId++; id = this._nextNotificationId++;
let idleId = Mainloop.idle_add(() => { let idleId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED); this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });

View File

@ -2,7 +2,6 @@
/* exported OsdWindowManager */ /* exported OsdWindowManager */
const { Clutter, GLib, GObject, Meta, St } = imports.gi; const { Clutter, GLib, GObject, Meta, St } = imports.gi;
const Mainloop = imports.mainloop;
const BarLevel = imports.ui.barLevel; const BarLevel = imports.ui.barLevel;
const Layout = imports.ui.layout; const Layout = imports.ui.layout;
@ -143,9 +142,9 @@ var OsdWindow = class {
} }
if (this._hideTimeoutId) if (this._hideTimeoutId)
Mainloop.source_remove(this._hideTimeoutId); GLib.source_remove(this._hideTimeoutId);
this._hideTimeoutId = Mainloop.timeout_add(HIDE_TIMEOUT, this._hideTimeoutId = GLib.timeout_add(
this._hide.bind(this)); GLib.PRIORITY_DEFAULT, HIDE_TIMEOUT, this._hide.bind(this));
GLib.Source.set_name_by_id(this._hideTimeoutId, '[gnome-shell] this._hide'); GLib.Source.set_name_by_id(this._hideTimeoutId, '[gnome-shell] this._hide');
} }
@ -153,7 +152,7 @@ var OsdWindow = class {
if (!this._hideTimeoutId) if (!this._hideTimeoutId)
return; return;
Mainloop.source_remove(this._hideTimeoutId); GLib.source_remove(this._hideTimeoutId);
this._hide(); this._hide();
} }

View File

@ -2,7 +2,6 @@
/* exported Overview */ /* exported Overview */
const { Clutter, GLib, Meta, Shell, St } = imports.gi; const { Clutter, GLib, Meta, Shell, St } = imports.gi;
const Mainloop = imports.mainloop;
const Signals = imports.signals; const Signals = imports.signals;
const Background = imports.ui.background; const Background = imports.ui.background;
@ -300,7 +299,7 @@ var Overview = class {
_resetWindowSwitchTimeout() { _resetWindowSwitchTimeout() {
if (this._windowSwitchTimeoutId != 0) { if (this._windowSwitchTimeoutId != 0) {
Mainloop.source_remove(this._windowSwitchTimeoutId); GLib.source_remove(this._windowSwitchTimeoutId);
this._windowSwitchTimeoutId = 0; this._windowSwitchTimeoutId = 0;
} }
} }
@ -323,7 +322,9 @@ var Overview = class {
if (targetIsWindow) { if (targetIsWindow) {
this._lastHoveredWindow = dragEvent.targetActor._delegate.metaWindow; 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; this._windowSwitchTimeoutId = 0;
Main.activateWindow(dragEvent.targetActor._delegate.metaWindow, Main.activateWindow(dragEvent.targetActor._delegate.metaWindow,

View File

@ -3,7 +3,6 @@
const { Atk, Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; const { Atk, Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Cairo = imports.cairo; const Cairo = imports.cairo;
const Mainloop = imports.mainloop;
const Animation = imports.ui.animation; const Animation = imports.ui.animation;
const Config = imports.misc.config; const Config = imports.misc.config;
@ -451,8 +450,8 @@ class ActivitiesButton extends PanelMenu.Button {
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
if (this._xdndTimeOut != 0) if (this._xdndTimeOut != 0)
Mainloop.source_remove(this._xdndTimeOut); GLib.source_remove(this._xdndTimeOut);
this._xdndTimeOut = Mainloop.timeout_add(BUTTON_DND_ACTIVATION_TIMEOUT, () => { this._xdndTimeOut = GLib.timeout_add(GLib.PRIORITY_DEFAULT, BUTTON_DND_ACTIVATION_TIMEOUT, () => {
this._xdndToggleOverview(); this._xdndToggleOverview();
}); });
GLib.Source.set_name_by_id(this._xdndTimeOut, '[gnome-shell] 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()) if (pickedActor == this && Main.overview.shouldToggleByCornerOrButton())
Main.overview.toggle(); Main.overview.toggle();
Mainloop.source_remove(this._xdndTimeOut); GLib.source_remove(this._xdndTimeOut);
this._xdndTimeOut = 0; this._xdndTimeOut = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
} }

View File

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

View File

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

View File

@ -4,7 +4,6 @@
collectStatistics, runPerfScript */ collectStatistics, runPerfScript */
const { Gio, GLib, Meta, Shell } = imports.gi; const { Gio, GLib, Meta, Shell } = imports.gi;
const Mainloop = imports.mainloop;
const Main = imports.ui.main; const Main = imports.ui.main;
const Params = imports.misc.params; const Params = imports.misc.params;
@ -41,7 +40,7 @@ const { loadInterfaceXML } = imports.misc.fileUtils;
*/ */
function sleep(milliseconds) { function sleep(milliseconds) {
return new Promise(resolve => { return new Promise(resolve => {
let id = Mainloop.timeout_add(milliseconds, () => { let id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, milliseconds, () => {
resolve(); resolve();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });

View File

@ -2,7 +2,6 @@
/* exported SessionMode, listModes */ /* exported SessionMode, listModes */
const GLib = imports.gi.GLib; const GLib = imports.gi.GLib;
const Mainloop = imports.mainloop;
const Signals = imports.signals; const Signals = imports.signals;
const FileUtils = imports.misc.fileUtils; const FileUtils = imports.misc.fileUtils;
@ -141,15 +140,16 @@ function _loadModes() {
function listModes() { function listModes() {
_loadModes(); _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); let names = Object.getOwnPropertyNames(_modes);
for (let i = 0; i < names.length; i++) for (let i = 0; i < names.length; i++)
if (_modes[names[i]].isPrimary) if (_modes[names[i]].isPrimary)
print(names[i]); print(names[i]);
Mainloop.quit('listModes'); loop.quit();
}); });
GLib.Source.set_name_by_id(id, '[gnome-shell] listModes'); GLib.Source.set_name_by_id(id, '[gnome-shell] listModes');
Mainloop.run('listModes'); loop.run();
} }
var SessionMode = class { var SessionMode = class {

View File

@ -2,7 +2,6 @@
/* exported ATIndicator */ /* exported ATIndicator */
const { Gio, GLib, GObject, St } = imports.gi; const { Gio, GLib, GObject, St } = imports.gi;
const Mainloop = imports.mainloop;
const PanelMenu = imports.ui.panelMenu; const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu; const PopupMenu = imports.ui.popupMenu;
@ -96,7 +95,7 @@ class ATIndicator extends PanelMenu.Button {
if (this._syncMenuVisibilityIdle) if (this._syncMenuVisibilityIdle)
return; 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'); GLib.Source.set_name_by_id(this._syncMenuVisibilityIdle, '[gnome-shell] this._syncMenuVisibility');
} }

View File

@ -1,7 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported NMApplet */ /* exported NMApplet */
const { Clutter, Gio, GLib, GObject, NM, St } = imports.gi; const { Clutter, Gio, GLib, GObject, NM, St } = imports.gi;
const Mainloop = imports.mainloop;
const Signals = imports.signals; const Signals = imports.signals;
const Animation = imports.ui.animation; const Animation = imports.ui.animation;
@ -719,7 +718,7 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
this._updateSensitivity(); this._updateSensitivity();
this._syncView(); 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'); GLib.Source.set_name_by_id(this._scanTimeoutId, '[gnome-shell] this._onScanTimeout');
this._onScanTimeout(); this._onScanTimeout();
@ -757,7 +756,7 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
} }
if (this._scanTimeoutId) { if (this._scanTimeoutId) {
Mainloop.source_remove(this._scanTimeoutId); GLib.source_remove(this._scanTimeoutId);
this._scanTimeoutId = 0; this._scanTimeoutId = 0;
} }
} }

View File

@ -2,7 +2,6 @@
/* exported SwitcherPopup, SwitcherList */ /* exported SwitcherPopup, SwitcherList */
const { Clutter, GLib, GObject, Meta, St } = imports.gi; const { Clutter, GLib, GObject, Meta, St } = imports.gi;
const Mainloop = imports.mainloop;
const Main = imports.ui.main; 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 // We delay showing the popup so that fast Alt+Tab users aren't
// disturbed by the popup briefly flashing. // disturbed by the popup briefly flashing.
this._initialDelayTimeoutId = Mainloop.timeout_add(POPUP_DELAY_TIMEOUT, this._initialDelayTimeoutId = GLib.timeout_add(
() => { GLib.PRIORITY_DEFAULT,
Main.osdWindowManager.hideAll(); POPUP_DELAY_TIMEOUT,
this.opacity = 255; () => {
this._initialDelayTimeoutId = 0; Main.osdWindowManager.hideAll();
return GLib.SOURCE_REMOVE; this.opacity = 255;
}); this._initialDelayTimeoutId = 0;
return GLib.SOURCE_REMOVE;
});
GLib.Source.set_name_by_id(this._initialDelayTimeoutId, '[gnome-shell] Main.osdWindow.cancel'); GLib.Source.set_name_by_id(this._initialDelayTimeoutId, '[gnome-shell] Main.osdWindow.cancel');
return true; return true;
} }
@ -249,9 +250,9 @@ var SwitcherPopup = GObject.registerClass({
this.mouseActive = false; this.mouseActive = false;
if (this._motionTimeoutId != 0) 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'); GLib.Source.set_name_by_id(this._motionTimeoutId, '[gnome-shell] this._mouseTimedOut');
} }
@ -263,14 +264,16 @@ var SwitcherPopup = GObject.registerClass({
_resetNoModsTimeout() { _resetNoModsTimeout() {
if (this._noModsTimeoutId != 0) if (this._noModsTimeoutId != 0)
Mainloop.source_remove(this._noModsTimeoutId); GLib.source_remove(this._noModsTimeoutId);
this._noModsTimeoutId = Mainloop.timeout_add(NO_MODS_TIMEOUT, this._noModsTimeoutId = GLib.timeout_add(
() => { GLib.PRIORITY_DEFAULT,
this._finish(global.get_current_time()); NO_MODS_TIMEOUT,
this._noModsTimeoutId = 0; () => {
return GLib.SOURCE_REMOVE; this._finish(global.get_current_time());
}); this._noModsTimeoutId = 0;
return GLib.SOURCE_REMOVE;
});
} }
_popModal() { _popModal() {
@ -302,11 +305,11 @@ var SwitcherPopup = GObject.registerClass({
this._popModal(); this._popModal();
if (this._motionTimeoutId != 0) if (this._motionTimeoutId != 0)
Mainloop.source_remove(this._motionTimeoutId); GLib.source_remove(this._motionTimeoutId);
if (this._initialDelayTimeoutId != 0) if (this._initialDelayTimeoutId != 0)
Mainloop.source_remove(this._initialDelayTimeoutId); GLib.source_remove(this._initialDelayTimeoutId);
if (this._noModsTimeoutId != 0) if (this._noModsTimeoutId != 0)
Mainloop.source_remove(this._noModsTimeoutId); GLib.source_remove(this._noModsTimeoutId);
} }
_select(num) { _select(num) {

View File

@ -2,7 +2,6 @@
/* exported WindowManager */ /* exported WindowManager */
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Mainloop = imports.mainloop;
const Signals = imports.signals; const Signals = imports.signals;
const AltTab = imports.ui.altTab; const AltTab = imports.ui.altTab;
@ -71,13 +70,13 @@ class DisplayChangeDialog extends ModalDialog.ModalDialog {
action: this._onSuccess.bind(this), action: this._onSuccess.bind(this),
default: true }); 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'); GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._tick');
} }
close(timestamp) { close(timestamp) {
if (this._timeoutId > 0) { if (this._timeoutId > 0) {
Mainloop.source_remove(this._timeoutId); GLib.source_remove(this._timeoutId);
this._timeoutId = 0; this._timeoutId = 0;
} }
@ -281,9 +280,9 @@ var WorkspaceTracker = class {
keepWorkspaceAlive(workspace, duration) { keepWorkspaceAlive(workspace, duration) {
if (workspace._keepAliveId) 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; workspace._keepAliveId = 0;
this._queueCheckWorkspaces(); this._queueCheckWorkspaces();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
@ -294,7 +293,7 @@ var WorkspaceTracker = class {
_windowRemoved(workspace, window) { _windowRemoved(workspace, window) {
workspace._lastRemovedWindow = window; workspace._lastRemovedWindow = window;
this._queueCheckWorkspaces(); 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) { if (workspace._lastRemovedWindow == window) {
workspace._lastRemovedWindow = null; workspace._lastRemovedWindow = null;
this._queueCheckWorkspaces(); this._queueCheckWorkspaces();

View File

@ -2,7 +2,6 @@
/* exported Workspace */ /* exported Workspace */
const { Atk, Clutter, GLib, GObject, Meta, Pango, Shell, St } = imports.gi; const { Atk, Clutter, GLib, GObject, Meta, Pango, Shell, St } = imports.gi;
const Mainloop = imports.mainloop;
const Signals = imports.signals; const Signals = imports.signals;
const DND = imports.ui.dnd; const DND = imports.ui.dnd;
@ -636,7 +635,7 @@ var WindowOverlay = class {
_onDestroy() { _onDestroy() {
if (this._idleHideOverlayId > 0) { if (this._idleHideOverlayId > 0) {
Mainloop.source_remove(this._idleHideOverlayId); GLib.source_remove(this._idleHideOverlayId);
this._idleHideOverlayId = 0; this._idleHideOverlayId = 0;
} }
this._windowClone.metaWindow.disconnect(this._updateCaptionId); this._windowClone.metaWindow.disconnect(this._updateCaptionId);
@ -688,7 +687,7 @@ var WindowOverlay = class {
_onHideChrome() { _onHideChrome() {
if (this._idleHideOverlayId == 0) { 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'); GLib.Source.set_name_by_id(this._idleHideOverlayId, '[gnome-shell] this._idleHideOverlay');
} }
} }
@ -705,7 +704,7 @@ var WindowOverlay = class {
hideOverlay() { hideOverlay() {
if (this._idleHideOverlayId > 0) { if (this._idleHideOverlayId > 0) {
Mainloop.source_remove(this._idleHideOverlayId); GLib.source_remove(this._idleHideOverlayId);
this._idleHideOverlayId = 0; this._idleHideOverlayId = 0;
} }
this.closeButton.hide(); this.closeButton.hide();
@ -1269,7 +1268,7 @@ var Workspace = class {
_realRecalculateWindowPositions(flags) { _realRecalculateWindowPositions(flags) {
if (this._repositionWindowsId > 0) { if (this._repositionWindowsId > 0) {
Mainloop.source_remove(this._repositionWindowsId); GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0; this._repositionWindowsId = 0;
} }
@ -1479,7 +1478,7 @@ var Workspace = class {
// remove old handler // remove old handler
if (this._repositionWindowsId > 0) { if (this._repositionWindowsId > 0) {
Mainloop.source_remove(this._repositionWindowsId); GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0; this._repositionWindowsId = 0;
} }
@ -1489,7 +1488,7 @@ var Workspace = class {
this._cursorY = y; this._cursorY = y;
this._currentLayout = null; 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)); this._delayedWindowRepositioning.bind(this));
GLib.Source.set_name_by_id(this._repositionWindowsId, '[gnome-shell] this._delayedWindowRepositioning'); GLib.Source.set_name_by_id(this._repositionWindowsId, '[gnome-shell] this._delayedWindowRepositioning');
} }
@ -1503,7 +1502,7 @@ var Workspace = class {
if (!win) { if (!win) {
// Newly-created windows are added to a workspace before // Newly-created windows are added to a workspace before
// the compositor finds out about them... // the compositor finds out about them...
let id = Mainloop.idle_add(() => { let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
if (this.actor && if (this.actor &&
metaWin.get_compositor_private() && metaWin.get_compositor_private() &&
metaWin.get_workspace() == this.metaWorkspace) metaWin.get_workspace() == this.metaWorkspace)
@ -1649,7 +1648,7 @@ var Workspace = class {
this._windows[i].remove_all_transitions(); this._windows[i].remove_all_transitions();
if (this._repositionWindowsId > 0) { if (this._repositionWindowsId > 0) {
Mainloop.source_remove(this._repositionWindowsId); GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0; this._repositionWindowsId = 0;
} }
@ -1734,7 +1733,7 @@ var Workspace = class {
this._windows[i].remove_all_transitions(); this._windows[i].remove_all_transitions();
if (this._repositionWindowsId > 0) { if (this._repositionWindowsId > 0) {
Mainloop.source_remove(this._repositionWindowsId); GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0; this._repositionWindowsId = 0;
} }
this._overviewHiddenId = Main.overview.connect('hidden', this._doneLeavingOverview.bind(this)); this._overviewHiddenId = Main.overview.connect('hidden', this._doneLeavingOverview.bind(this));
@ -1795,7 +1794,7 @@ var Workspace = class {
global.display.disconnect(this._windowLeftMonitorId); global.display.disconnect(this._windowLeftMonitorId);
if (this._repositionWindowsId > 0) { if (this._repositionWindowsId > 0) {
Mainloop.source_remove(this._repositionWindowsId); GLib.source_remove(this._repositionWindowsId);
this._repositionWindowsId = 0; this._repositionWindowsId = 0;
} }

View File

@ -2,7 +2,6 @@
/* exported WorkspaceSwitcherPopup */ /* exported WorkspaceSwitcherPopup */
const { Clutter, GLib, GObject, Meta, St } = imports.gi; const { Clutter, GLib, GObject, Meta, St } = imports.gi;
const Mainloop = imports.mainloop;
const Main = imports.ui.main; const Main = imports.ui.main;
@ -195,14 +194,14 @@ class WorkspaceSwitcherPopup extends St.Widget {
this._redisplay(); this._redisplay();
if (this._timeoutId != 0) if (this._timeoutId != 0)
Mainloop.source_remove(this._timeoutId); GLib.source_remove(this._timeoutId);
this._timeoutId = Mainloop.timeout_add(DISPLAY_TIMEOUT, this._onTimeout.bind(this)); 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'); GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
this._show(); this._show();
} }
_onTimeout() { _onTimeout() {
Mainloop.source_remove(this._timeoutId); GLib.source_remove(this._timeoutId);
this._timeoutId = 0; this._timeoutId = 0;
this._container.ease({ this._container.ease({
opacity: 0.0, opacity: 0.0,
@ -215,7 +214,7 @@ class WorkspaceSwitcherPopup extends St.Widget {
_onDestroy() { _onDestroy() {
if (this._timeoutId) if (this._timeoutId)
Mainloop.source_remove(this._timeoutId); GLib.source_remove(this._timeoutId);
this._timeoutId = 0; this._timeoutId = 0;
let workspaceManager = global.workspace_manager; let workspaceManager = global.workspace_manager;

View File

@ -2,7 +2,6 @@
/* exported WorkspaceThumbnail, ThumbnailsBox */ /* exported WorkspaceThumbnail, ThumbnailsBox */
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Mainloop = imports.mainloop;
const Signals = imports.signals; const Signals = imports.signals;
const Background = imports.ui.background; const Background = imports.ui.background;
@ -389,7 +388,7 @@ var WorkspaceThumbnail = GObject.registerClass({
if (!win) { if (!win) {
// Newly-created windows are added to a workspace before // Newly-created windows are added to a workspace before
// the compositor finds out about them... // the compositor finds out about them...
let id = Mainloop.idle_add(() => { let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
if (!this._removed && if (!this._removed &&
metaWin.get_compositor_private() && metaWin.get_compositor_private() &&
metaWin.get_workspace() == this.metaWorkspace) metaWin.get_workspace() == this.metaWorkspace)

View File

@ -3,7 +3,6 @@
const UI = imports.testcommon.ui; const UI = imports.testcommon.ui;
const { Clutter, GLib, St } = imports.gi; const { Clutter, GLib, St } = imports.gi;
const Mainloop = imports.mainloop;
const DELAY = 2000; const DELAY = 2000;
@ -59,14 +58,14 @@ function test() {
resize_animated(label1); resize_animated(label1);
resize_animated(label2); resize_animated(label2);
Mainloop.timeout_add(DELAY, () => { GLib.timeout_add(GLib.PRIORITY_DEFAULT, DELAY, () => {
log(label1 + label1.get_size()); log(label1 + label1.get_size());
resize_animated(label1); resize_animated(label1);
resize_animated(label2); resize_animated(label2);
return true; return true;
}); });
Mainloop.timeout_add(2 * DELAY, () => { GLib.timeout_add(GLib.PRIORITY_DEFAULT, 2 * DELAY, () => {
iter += 1; iter += 1;
iter %= shadowStyles.length; iter %= shadowStyles.length;
label1.set_style(get_css_style(shadowStyles[iter])); label1.set_style(get_css_style(shadowStyles[iter]));

View File

@ -2,8 +2,7 @@
const UI = imports.testcommon.ui; const UI = imports.testcommon.ui;
const { Clutter, St } = imports.gi; const { Clutter, GLib, St } = imports.gi;
const Mainloop = imports.mainloop;
function test() { function test() {
let stage = new Clutter.Stage({ width: 400, height: 400 }); 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;', let entryHintBoth = new St.Entry({ style: 'border: 1px solid black; text-shadow: 0 2px red;',
hint_actor: hintActor2 }); hint_actor: hintActor2 });
let idx = 0; let idx = 0;
Mainloop.timeout_add_seconds(1, function() { GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, function() {
idx++; idx++;
if (idx % 2 == 0) if (idx % 2 == 0)

View File

@ -2,8 +2,7 @@
imports.gi.versions.Gtk = '3.0'; imports.gi.versions.Gtk = '3.0';
const Gtk = imports.gi.Gtk; const { GLib, Gtk } = imports.gi;
const Mainloop = imports.mainloop;
function nextTitle() { function nextTitle() {
let length = Math.random() * 20; let length = Math.random() * 20;
@ -26,7 +25,7 @@ function main() {
}); });
win.present(); win.present();
Mainloop.timeout_add(5000, function() { GLib.timeout_add(GLib.PRIORITY_DEFAULT, 5000, function() {
win.title = nextTitle(); win.title = nextTitle();
return true; return true;
}); });