js: Name all the timeouts and idles

With very uninventive names. Names now, good names later.

https://bugzilla.gnome.org/show_bug.cgi?id=727983
This commit is contained in:
Bastien Nocera 2014-04-10 19:26:52 +02:00
parent 85f811f147
commit cd2bd7685a
31 changed files with 105 additions and 44 deletions

View File

@ -483,7 +483,7 @@ const LoginDialog = new Lang.Class({
}, },
_ensureUserListLoaded: function() { _ensureUserListLoaded: function() {
if (!this._userManager.is_loaded) if (!this._userManager.is_loaded) {
this._userManagerLoadedId = this._userManager.connect('notify::is-loaded', this._userManagerLoadedId = this._userManager.connect('notify::is-loaded',
Lang.bind(this, function() { Lang.bind(this, function() {
if (this._userManager.is_loaded) { if (this._userManager.is_loaded) {
@ -492,8 +492,10 @@ const LoginDialog = new Lang.Class({
this._userManagerLoadedId = 0; this._userManagerLoadedId = 0;
} }
})); }));
else } else {
GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, this._loadUserList)); let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, this._loadUserList));
GLib.Source.set_name_by_id(id, '[gnome-shell] _loadUserList');
}
}, },
_updateDisableUserList: function() { _updateDisableUserList: function() {
@ -686,10 +688,11 @@ const LoginDialog = new Lang.Class({
}, },
onUpdateScope: this, onUpdateScope: this,
onComplete: function() { onComplete: function() {
Mainloop.idle_add(Lang.bind(this, function() { let id = Mainloop.idle_add(Lang.bind(this, function() {
this._greeter.call_start_session_when_ready_sync(serviceName, true, null); this._greeter.call_start_session_when_ready_sync(serviceName, true, null);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(id, '[gnome-shell] this._greeter.call_start_session_when_ready_sync');
}, },
onCompleteScope: this }); onCompleteScope: this });
}, },
@ -745,6 +748,7 @@ const LoginDialog = new Lang.Class({
hold.release(); hold.release();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });
GLib.Source.set_name_by_id(this._timedLoginIdleTimeOutId, '[gnome-shell] this._timedLoginAnimationTime');
return hold; return hold;
}, },

View File

@ -252,6 +252,7 @@ const ShellUserVerifier = new Lang.Class({
this._queueMessageTimeout(); this._queueMessageTimeout();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(this._messageQueueTimeoutId, '[gnome-shell] this._queueMessageTimeout');
}, },
_queueMessage: function(message, messageType) { _queueMessage: function(message, messageType) {

View File

@ -305,6 +305,7 @@ const AppSwitcherPopup = new Lang.Class({
this._thumbnailTimeoutId = Mainloop.timeout_add ( this._thumbnailTimeoutId = Mainloop.timeout_add (
THUMBNAIL_POPUP_TIME, THUMBNAIL_POPUP_TIME,
Lang.bind(this, this._timeoutPopupThumbnails)); Lang.bind(this, this._timeoutPopupThumbnails));
GLib.Source.set_name_by_id(this._thumbnailTimeoutId, '[gnome-shell] this._timeoutPopupThumbnails');
} }
}, },
@ -556,6 +557,7 @@ const AppSwitcher = new Lang.Class({
this._mouseTimeOutId = 0; this._mouseTimeOutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(this._mouseTimeOutId, '[gnome-shell] this._enterItem');
} else } else
this._itemEntered(index); this._itemEntered(index);
}, },

View File

@ -34,6 +34,7 @@ const Animation = new Lang.Class({
this._showFrame(0); this._showFrame(0);
this._timeoutId = Mainloop.timeout_add(this._speed, Lang.bind(this, this._update)); this._timeoutId = Mainloop.timeout_add(this._speed, Lang.bind(this, this._update));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._update');
} }
this._isPlaying = true; this._isPlaying = true;

View File

@ -1402,6 +1402,7 @@ const AppIcon = new Lang.Class({
this.popupMenu(); this.popupMenu();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(this._menuTimeoutId, '[gnome-shell] this.popupMenu');
} else if (button == 3) { } else if (button == 3) {
this.popupMenu(); this.popupMenu();
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;

View File

@ -271,10 +271,11 @@ const BackgroundCache = new Lang.Class({
if (this._animationFilename == params.filename) { if (this._animationFilename == params.filename) {
if (params.onLoaded) { if (params.onLoaded) {
GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() { let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
params.onLoaded(this._animation); params.onLoaded(this._animation);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
} }
} }
@ -286,10 +287,11 @@ const BackgroundCache = new Lang.Class({
this._animation = animation; this._animation = animation;
if (params.onLoaded) { if (params.onLoaded) {
GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() { let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
params.onLoaded(this._animation); params.onLoaded(this._animation);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
} }
})); }));
} }
@ -386,10 +388,11 @@ const Background = new Lang.Class({
this.isLoaded = true; this.isLoaded = true;
GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() { let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
this.emit('loaded'); this.emit('loaded');
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(id, '[gnome-shell] this.emit');
}, },
_loadPattern: function() { _loadPattern: function() {
@ -532,6 +535,7 @@ const Background = new Lang.Class({
this._updateAnimation(); this._updateAnimation();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(this._updateAnimationTimeoutId, '[gnome-shell] this._updateAnimation');
}, },
_loadAnimation: function(filename) { _loadAnimation: function(filename) {

View File

@ -43,6 +43,7 @@ const AutomountManager = new Lang.Class({
this._driveEjectButtonId = this._volumeMonitor.connect('drive-eject-button', Lang.bind(this, this._onDriveEjectButton)); this._driveEjectButtonId = this._volumeMonitor.connect('drive-eject-button', Lang.bind(this, this._onDriveEjectButton));
this._mountAllId = Mainloop.idle_add(Lang.bind(this, this._startupMountAll)); this._mountAllId = Mainloop.idle_add(Lang.bind(this, this._startupMountAll));
GLib.Source.set_name_by_id(this._mountAllId, '[gnome-shell] this._startupMountAll');
}, },
disable: function() { disable: function() {
@ -234,10 +235,11 @@ const AutomountManager = new Lang.Class({
}, },
_allowAutorunExpire: function(volume) { _allowAutorunExpire: function(volume) {
Mainloop.timeout_add_seconds(AUTORUN_EXPIRE_TIMEOUT_SECS, function() { let id = Mainloop.timeout_add_seconds(AUTORUN_EXPIRE_TIMEOUT_SECS, function() {
volume.allowAutorun = false; volume.allowAutorun = false;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });
GLib.Source.set_name_by_id(id, '[gnome-shell] volume.allowAutorun');
} }
}); });
const Component = AutomountManager; const Component = AutomountManager;

View File

@ -681,6 +681,7 @@ const ChatSource = new Lang.Class({
Mainloop.source_remove(this._notifyTimeoutId); Mainloop.source_remove(this._notifyTimeoutId);
this._notifyTimeoutId = Mainloop.timeout_add(500, this._notifyTimeoutId = Mainloop.timeout_add(500,
Lang.bind(this, this._notifyTimeout)); Lang.bind(this, this._notifyTimeout));
GLib.Source.set_name_by_id(this._notifyTimeoutId, '[gnome-shell] this._notifyTimeout');
}, },
_notifyTimeout: function() { _notifyTimeout: function() {
@ -924,14 +925,16 @@ const ChatNotification = new Lang.Class({
realMessage: group != 'meta' }); realMessage: group != 'meta' });
if (!props.noTimestamp) { if (!props.noTimestamp) {
if (timestamp < currentTime - SCROLLBACK_IMMEDIATE_TIME) if (timestamp < currentTime - SCROLLBACK_IMMEDIATE_TIME) {
this.appendTimestamp(); this.appendTimestamp();
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 = Mainloop.timeout_add_seconds(
SCROLLBACK_IMMEDIATE_TIME - (currentTime - timestamp), SCROLLBACK_IMMEDIATE_TIME - (currentTime - timestamp),
Lang.bind(this, this.appendTimestamp)); Lang.bind(this, this.appendTimestamp));
GLib.Source.set_name_by_id(this._timestampTimeoutId, '[gnome-shell] this.appendTimestamp');
}
} }
this._filterMessages(); this._filterMessages();
@ -1100,6 +1103,7 @@ const ChatNotification = new Lang.Class({
this._composingTimeoutId = Mainloop.timeout_add_seconds( this._composingTimeoutId = Mainloop.timeout_add_seconds(
COMPOSING_STOP_TIMEOUT, COMPOSING_STOP_TIMEOUT,
Lang.bind(this, this._composingStopTimeout)); Lang.bind(this, this._composingStopTimeout));
GLib.Source.set_name_by_id(this._composingTimeoutId, '[gnome-shell] this._composingStopTimeout');
} else { } else {
this.source.setChatState(Tp.ChannelChatState.ACTIVE); this.source.setChatState(Tp.ChannelChatState.ACTIVE);
} }

View File

@ -582,6 +582,7 @@ const Dash = new Lang.Class({
this._showLabelTimeoutId = 0; this._showLabelTimeoutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
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); Mainloop.source_remove(this._resetHoverTimeoutId);
this._resetHoverTimeoutId = 0; this._resetHoverTimeoutId = 0;
@ -599,6 +600,7 @@ const Dash = new Lang.Class({
this._resetHoverTimeoutId = 0; this._resetHoverTimeoutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(this._resetHoverTimeoutId, '[gnome-shell] this._labelShowing');
} }
} }
}, },

View File

@ -395,6 +395,7 @@ const _Draggable = new Lang.Class({
this._updateHoverId = GLib.idle_add(GLib.PRIORITY_DEFAULT, this._updateHoverId = GLib.idle_add(GLib.PRIORITY_DEFAULT,
Lang.bind(this, this._updateDragHover)); Lang.bind(this, this._updateDragHover));
GLib.Source.set_name_by_id(this._updateHoverId, '[gnome-shell] this._updateDragHover');
}, },
_updateDragPosition : function (event) { _updateDragPosition : function (event) {

View File

@ -551,6 +551,7 @@ const EndSessionDialog = new Lang.Class({
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(this._timerId, '[gnome-shell] this._confirm');
}, },
_stopTimer: function() { _stopTimer: function() {

View File

@ -266,12 +266,14 @@ const Keyboard = new Lang.Class({
return; return;
} }
if (!this._showIdleId) if (!this._showIdleId) {
this._showIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, this._showIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE,
Lang.bind(this, function() { Lang.bind(this, function() {
this.Show(time); this.Show(time);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(this._showIdleId, '[gnome-shell] this.Show');
}
}, },
_createLayersForGroup: function (gname) { _createLayersForGroup: function (gname) {
@ -500,6 +502,7 @@ const Keyboard = new Lang.Class({
this._show(monitor); this._show(monitor);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer');
}, },
_show: function(monitor) { _show: function(monitor) {
@ -526,6 +529,7 @@ const Keyboard = new Lang.Class({
this._hide(); this._hide();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer');
}, },
_hide: function() { _hide: function() {

View File

@ -628,10 +628,11 @@ const LayoutManager = new Lang.Class({
// until the event loop is uncontended and idle. // until the event loop is uncontended and idle.
// This helps to prevent us from running the animation // This helps to prevent us from running the animation
// when the system is bogged down // when the system is bogged down
GLib.idle_add(GLib.PRIORITY_LOW, Lang.bind(this, function() { let id = GLib.idle_add(GLib.PRIORITY_LOW, Lang.bind(this, function() {
this._startupAnimation(); this._startupAnimation();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(id, '[gnome-shell] this._startupAnimation');
}, },
_startupAnimation: function() { _startupAnimation: function() {

View File

@ -846,6 +846,7 @@ const LookingGlass = new Lang.Class({
Mainloop.source_remove(this._timeoutId); Mainloop.source_remove(this._timeoutId);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] gcIcon.icon_name = \'gnome-fs-trash-full\'');
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
})); }));

View File

@ -608,5 +608,6 @@ function queueDeferredWork(workId) {
_deferredTimeoutId = 0; _deferredTimeoutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });
GLib.Source.set_name_by_id(_deferredTimeoutId, '[gnome-shell] _runAllDeferredWork');
} }
} }

View File

@ -1987,6 +1987,7 @@ const MessageTray = new Lang.Class({
this._trayDwellTimeoutId = Mainloop.timeout_add(TRAY_DWELL_TIME, this._trayDwellTimeoutId = Mainloop.timeout_add(TRAY_DWELL_TIME,
Lang.bind(this, this._trayDwellTimeout)); Lang.bind(this, this._trayDwellTimeout));
GLib.Source.set_name_by_id(this._trayDwellTimeoutId, '[gnome-shell] this._trayDwellTimeout');
} }
this._trayDwelling = true; this._trayDwelling = true;
} else { } else {
@ -2316,6 +2317,7 @@ const MessageTray = new Lang.Class({
// 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 * 1000 : HIDE_TIMEOUT * 1000; let timeout = this._useLongerNotificationLeftTimeout ? LONGER_HIDE_TIMEOUT * 1000 : HIDE_TIMEOUT * 1000;
this._notificationLeftTimeoutId = Mainloop.timeout_add(timeout, Lang.bind(this, this._onNotificationLeftTimeout)); this._notificationLeftTimeoutId = Mainloop.timeout_add(timeout, Lang.bind(this, this._onNotificationLeftTimeout));
GLib.Source.set_name_by_id(this._notificationLeftTimeoutId, '[gnome-shell] this._onNotificationLeftTimeout');
} }
}, },
@ -2351,6 +2353,7 @@ const MessageTray = new Lang.Class({
this._notificationLeftMouseX = -1; this._notificationLeftMouseX = -1;
this._notificationLeftTimeoutId = Mainloop.timeout_add(LONGER_HIDE_TIMEOUT * 1000, this._notificationLeftTimeoutId = Mainloop.timeout_add(LONGER_HIDE_TIMEOUT * 1000,
Lang.bind(this, this._onNotificationLeftTimeout)); Lang.bind(this, this._onNotificationLeftTimeout));
GLib.Source.set_name_by_id(this._notificationLeftTimeoutId, '[gnome-shell] this._onNotificationLeftTimeout');
} else { } else {
this._notificationLeftTimeoutId = 0; this._notificationLeftTimeoutId = 0;
this._useLongerNotificationLeftTimeout = false; this._useLongerNotificationLeftTimeout = false;
@ -2668,10 +2671,12 @@ const MessageTray = new Lang.Class({
Mainloop.source_remove(this._notificationTimeoutId); Mainloop.source_remove(this._notificationTimeoutId);
this._notificationTimeoutId = 0; this._notificationTimeoutId = 0;
} }
if (timeout > 0) if (timeout > 0) {
this._notificationTimeoutId = this._notificationTimeoutId =
Mainloop.timeout_add(timeout, Mainloop.timeout_add(timeout,
Lang.bind(this, this._notificationTimeout)); Lang.bind(this, this._notificationTimeout));
GLib.Source.set_name_by_id(this._notificationTimeoutId, '[gnome-shell] this._notificationTimeout');
}
}, },
_notificationTimeout: function() { _notificationTimeout: function() {

View File

@ -244,11 +244,12 @@ const FdoNotificationDaemon = new Lang.Class({
// 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++;
Mainloop.idle_add(Lang.bind(this, let idle_id = Mainloop.idle_add(Lang.bind(this,
function () { function () {
this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED); this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(idle_id, '[gnome-shell] this._emitNotificationClosed');
return invocation.return_value(GLib.Variant.new('(u)', [id])); return invocation.return_value(GLib.Variant.new('(u)', [id]));
} }

View File

@ -156,6 +156,7 @@ const OsdWindow = new Lang.Class({
Mainloop.source_remove(this._hideTimeoutId); Mainloop.source_remove(this._hideTimeoutId);
this._hideTimeoutId = Mainloop.timeout_add(HIDE_TIMEOUT, this._hideTimeoutId = Mainloop.timeout_add(HIDE_TIMEOUT,
Lang.bind(this, this._hide)); Lang.bind(this, this._hide));
GLib.Source.set_name_by_id(this._hideTimeoutId, '[gnome-shell] this._hide');
}, },
cancel: function() { cancel: function() {

View File

@ -365,6 +365,7 @@ const Overview = new Lang.Class({
this._lastHoveredWindow = null; this._lastHoveredWindow = null;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(this._windowSwitchTimeoutId, '[gnome-shell] Main.activateWindow');
} }
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;

View File

@ -595,6 +595,7 @@ const ActivitiesButton = new Lang.Class({
Mainloop.source_remove(this._xdndTimeOut); Mainloop.source_remove(this._xdndTimeOut);
this._xdndTimeOut = Mainloop.timeout_add(BUTTON_DND_ACTIVATION_TIMEOUT, this._xdndTimeOut = Mainloop.timeout_add(BUTTON_DND_ACTIVATION_TIMEOUT,
Lang.bind(this, this._xdndToggleOverview, actor)); Lang.bind(this, this._xdndToggleOverview, actor));
GLib.Source.set_name_by_id(this._xdndTimeOut, '[gnome-shell] this._xdndToggleOverview');
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
}, },

View File

@ -107,6 +107,7 @@ const PointerWatcher = new Lang.Class({
this._timeoutId = Mainloop.timeout_add(minInterval, this._timeoutId = Mainloop.timeout_add(minInterval,
Lang.bind(this, this._onTimeout)); Lang.bind(this, this._onTimeout));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
}, },
_onTimeout: function() { _onTimeout: function() {

View File

@ -850,6 +850,7 @@ const ScreenShield = new Lang.Class({
this.lock(false); this.lock(false);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(this._lockTimeoutId, '[gnome-shell] this.lock');
} }
this._activateFade(this._longLightbox, STANDARD_FADE_TIME); this._activateFade(this._longLightbox, STANDARD_FADE_TIME);
@ -1041,6 +1042,7 @@ const ScreenShield = new Lang.Class({
if (!this._arrowAnimationId) { if (!this._arrowAnimationId) {
this._arrowAnimationId = Mainloop.timeout_add(6000, Lang.bind(this, this._animateArrows)); this._arrowAnimationId = Mainloop.timeout_add(6000, Lang.bind(this, this._animateArrows));
GLib.Source.set_name_by_id(this._arrowAnimationId, '[gnome-shell] this._animateArrows');
this._animateArrows(); this._animateArrows();
} }
@ -1108,10 +1110,11 @@ const ScreenShield = new Lang.Class({
if (params.fadeToBlack && params.animateFade) { if (params.fadeToBlack && params.animateFade) {
// Take a beat // Take a beat
Mainloop.timeout_add(1000 * MANUAL_FADE_TIME, Lang.bind(this, function() { let id = Mainloop.timeout_add(1000 * MANUAL_FADE_TIME, Lang.bind(this, function() {
this._activateFade(this._shortLightbox, MANUAL_FADE_TIME); this._activateFade(this._shortLightbox, MANUAL_FADE_TIME);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(id, '[gnome-shell] this._activateFade');
} else { } else {
if (params.fadeToBlack) if (params.fadeToBlack)
this._activateFade(this._shortLightbox, 0); this._activateFade(this._shortLightbox, 0);

View File

@ -39,11 +39,12 @@ const Main = imports.ui.main;
function sleep(milliseconds) { function sleep(milliseconds) {
let cb; let cb;
Mainloop.timeout_add(milliseconds, function() { let id = Mainloop.timeout_add(milliseconds, function() {
if (cb) if (cb)
cb(); cb();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });
GLib.Source.set_name_by_id(id, '[gnome-shell] sleep');
return function(callback) { return function(callback) {
cb = callback; cb = callback;

View File

@ -140,13 +140,14 @@ function _loadModes() {
function listModes() { function listModes() {
_loadModes(); _loadModes();
Mainloop.idle_add(function() { let id = Mainloop.idle_add(function() {
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'); Mainloop.quit('listModes');
}); });
GLib.Source.set_name_by_id(id, '[gnome-shell] listModes');
Mainloop.run('listModes'); Mainloop.run('listModes');
} }

View File

@ -103,6 +103,7 @@ const ATIndicator = new Lang.Class({
return; return;
this._syncMenuVisbilityIdle = Mainloop.idle_add(Lang.bind(this, this._syncMenuVisibility)); this._syncMenuVisbilityIdle = Mainloop.idle_add(Lang.bind(this, this._syncMenuVisibility));
GLib.Source.set_name_by_id(this._syncMenuVisbilityIdle, '[gnome-shell] this._syncMenuVisibility');
}, },
_buildItemExtended: function(string, initial_value, writable, on_set) { _buildItemExtended: function(string, initial_value, writable, on_set) {

View File

@ -166,6 +166,7 @@ const SwitcherPopup = new Lang.Class({
this._initialDelayTimeoutId = 0; this._initialDelayTimeoutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(this._initialDelayTimeoutId, '[gnome-shell] Main.osdWindow.cancel');
return true; return true;
}, },
@ -250,6 +251,7 @@ const SwitcherPopup = new Lang.Class({
Mainloop.source_remove(this._motionTimeoutId); Mainloop.source_remove(this._motionTimeoutId);
this._motionTimeoutId = Mainloop.timeout_add(DISABLE_HOVER_TIMEOUT, Lang.bind(this, this._mouseTimedOut)); this._motionTimeoutId = Mainloop.timeout_add(DISABLE_HOVER_TIMEOUT, Lang.bind(this, this._mouseTimedOut));
GLib.Source.set_name_by_id(this._motionTimeoutId, '[gnome-shell] this._mouseTimedOut');
}, },
_mouseTimedOut: function() { _mouseTimedOut: function() {

View File

@ -383,9 +383,11 @@ const ViewSelector = new Lang.Class({
this._iconClickedId = this._entry.connect('secondary-icon-clicked', this._iconClickedId = this._entry.connect('secondary-icon-clicked',
Lang.bind(this, this.reset)); Lang.bind(this, this.reset));
if (this._searchTimeoutId == 0) if (this._searchTimeoutId == 0) {
this._searchTimeoutId = Mainloop.timeout_add(150, this._searchTimeoutId = Mainloop.timeout_add(150,
Lang.bind(this, this._doSearch)); Lang.bind(this, this._doSearch));
GLib.Source.set_name_by_id(this._searchTimeoutId, '[gnome-shell] this._doSearch');
}
} else { } else {
if (this._iconClickedId > 0) { if (this._iconClickedId > 0) {
this._entry.disconnect(this._iconClickedId); this._entry.disconnect(this._iconClickedId);

View File

@ -82,6 +82,7 @@ const DisplayChangeDialog = new Lang.Class({
{ expand: false, x_fill: false, x_align: St.Align.END }); { expand: false, x_fill: false, x_align: St.Align.END });
this._timeoutId = Mainloop.timeout_add(ONE_SECOND, Lang.bind(this, this._tick)); this._timeoutId = Mainloop.timeout_add(ONE_SECOND, Lang.bind(this, this._tick));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._tick');
}, },
close: function(timestamp) { close: function(timestamp) {
@ -271,18 +272,20 @@ const WorkspaceTracker = new Lang.Class({
this._queueCheckWorkspaces(); this._queueCheckWorkspaces();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(workspace._keepAliveId, '[gnome-shell] this._queueCheckWorkspaces');
}, },
_windowRemoved: function(workspace, window) { _windowRemoved: function(workspace, window) {
workspace._lastRemovedWindow = window; workspace._lastRemovedWindow = window;
this._queueCheckWorkspaces(); this._queueCheckWorkspaces();
Mainloop.timeout_add(LAST_WINDOW_GRACE_TIME, Lang.bind(this, function() { let id = Mainloop.timeout_add(LAST_WINDOW_GRACE_TIME, Lang.bind(this, function() {
if (workspace._lastRemovedWindow == window) { if (workspace._lastRemovedWindow == window) {
workspace._lastRemovedWindow = null; workspace._lastRemovedWindow = null;
this._queueCheckWorkspaces(); this._queueCheckWorkspaces();
} }
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(id, '[gnome-shell] this._queueCheckWorkspaces');
}, },
_windowLeftMonitor: function(metaScreen, monitorIndex, metaWin) { _windowLeftMonitor: function(metaScreen, monitorIndex, metaWin) {

View File

@ -594,11 +594,12 @@ const WindowOverlay = new Lang.Class({
// use an idle handler to avoid mapping problems - // use an idle handler to avoid mapping problems -
// see comment in Workspace._windowAdded // see comment in Workspace._windowAdded
Mainloop.idle_add(Lang.bind(this, let id = Mainloop.idle_add(Lang.bind(this,
function() { function() {
this._windowClone.emit('selected'); this._windowClone.emit('selected');
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(id, '[gnome-shell] this._windowClone.emit');
} }
}, },
@ -669,8 +670,10 @@ const WindowOverlay = new Lang.Class({
}, },
_onLeave: function() { _onLeave: function() {
if (this._idleToggleCloseId == 0) if (this._idleToggleCloseId == 0) {
this._idleToggleCloseId = Mainloop.timeout_add(750, Lang.bind(this, this._idleToggleCloseButton)); this._idleToggleCloseId = Mainloop.timeout_add(750, Lang.bind(this, this._idleToggleCloseButton));
GLib.Source.set_name_by_id(this._idleToggleCloseId, '[gnome-shell] this._idleToggleCloseButton');
}
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
}, },
@ -1418,6 +1421,7 @@ const Workspace = new Lang.Class({
this._currentLayout = null; this._currentLayout = null;
this._repositionWindowsId = Mainloop.timeout_add(750, this._repositionWindowsId = Mainloop.timeout_add(750,
Lang.bind(this, this._delayedWindowRepositioning)); Lang.bind(this, this._delayedWindowRepositioning));
GLib.Source.set_name_by_id(this._repositionWindowsId, '[gnome-shell] this._delayedWindowRepositioning');
}, },
_doAddWindow : function(metaWin) { _doAddWindow : function(metaWin) {
@ -1429,14 +1433,15 @@ const Workspace = new Lang.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...
Mainloop.idle_add(Lang.bind(this, let id = Mainloop.idle_add(Lang.bind(this,
function () { function () {
if (this.actor && if (this.actor &&
metaWin.get_compositor_private() && metaWin.get_compositor_private() &&
metaWin.get_workspace() == this.metaWorkspace) metaWin.get_workspace() == this.metaWorkspace)
this._doAddWindow(metaWin); this._doAddWindow(metaWin);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(id, '[gnome-shell] this._doAddWindow');
return; return;
} }

View File

@ -52,6 +52,7 @@ const WorkspaceSwitcherPopup = new Lang.Class({
this._globalSignals.push(global.screen.connect('workspace-removed', Lang.bind(this, this._redisplay))); this._globalSignals.push(global.screen.connect('workspace-removed', Lang.bind(this, this._redisplay)));
this._timeoutId = Mainloop.timeout_add(DISPLAY_TIMEOUT, Lang.bind(this, this._onTimeout)); this._timeoutId = Mainloop.timeout_add(DISPLAY_TIMEOUT, Lang.bind(this, this._onTimeout));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
}, },
_getPreferredHeight : function (actor, forWidth, alloc) { _getPreferredHeight : function (actor, forWidth, alloc) {
@ -145,6 +146,7 @@ const WorkspaceSwitcherPopup = new Lang.Class({
if (this._timeoutId != 0) if (this._timeoutId != 0)
Mainloop.source_remove(this._timeoutId); Mainloop.source_remove(this._timeoutId);
this._timeoutId = Mainloop.timeout_add(DISPLAY_TIMEOUT, Lang.bind(this, this._onTimeout)); this._timeoutId = Mainloop.timeout_add(DISPLAY_TIMEOUT, Lang.bind(this, this._onTimeout));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
this._show(); this._show();
}, },

View File

@ -386,14 +386,15 @@ const WorkspaceThumbnail = new Lang.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...
Mainloop.idle_add(Lang.bind(this, let id = Mainloop.idle_add(Lang.bind(this,
function () { function () {
if (!this._removed && if (!this._removed &&
metaWin.get_compositor_private() && metaWin.get_compositor_private() &&
metaWin.get_workspace() == this.metaWorkspace) metaWin.get_workspace() == this.metaWorkspace)
this._doAddWindow(metaWin); this._doAddWindow(metaWin);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); }));
GLib.Source.set_name_by_id(id, '[gnome-shell] this._doAddWindow');
return; return;
} }