[gnome-shell] js: Name all the timeouts and idles



commit cd2bd7685a3f1253a2224161daa23f3b1c273106
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Apr 10 19:26:52 2014 +0200

    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

 js/gdm/loginDialog.js                |   12 ++++++++----
 js/gdm/util.js                       |    1 +
 js/ui/altTab.js                      |    2 ++
 js/ui/animation.js                   |    1 +
 js/ui/appDisplay.js                  |    1 +
 js/ui/background.js                  |   10 +++++++---
 js/ui/components/automountManager.js |    4 +++-
 js/ui/components/telepathyClient.js  |    8 ++++++--
 js/ui/dash.js                        |    2 ++
 js/ui/dnd.js                         |    1 +
 js/ui/endSessionDialog.js            |    1 +
 js/ui/keyboard.js                    |   16 ++++++++++------
 js/ui/layout.js                      |    3 ++-
 js/ui/lookingGlass.js                |    1 +
 js/ui/main.js                        |    1 +
 js/ui/messageTray.js                 |    7 ++++++-
 js/ui/notificationDaemon.js          |   11 ++++++-----
 js/ui/osdWindow.js                   |    1 +
 js/ui/overview.js                    |    1 +
 js/ui/panel.js                       |    1 +
 js/ui/pointerWatcher.js              |    1 +
 js/ui/screenShield.js                |    5 ++++-
 js/ui/scripting.js                   |    3 ++-
 js/ui/sessionMode.js                 |    3 ++-
 js/ui/status/accessibility.js        |    1 +
 js/ui/switcherPopup.js               |    2 ++
 js/ui/viewSelector.js                |    4 +++-
 js/ui/windowManager.js               |    5 ++++-
 js/ui/workspace.js                   |   33 +++++++++++++++++++--------------
 js/ui/workspaceSwitcherPopup.js      |    2 ++
 js/ui/workspaceThumbnail.js          |    5 +++--
 31 files changed, 105 insertions(+), 44 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 0b8940a..e66789d 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -483,7 +483,7 @@ const LoginDialog = new Lang.Class({
     },
 
     _ensureUserListLoaded: function() {
-        if (!this._userManager.is_loaded)
+        if (!this._userManager.is_loaded) {
             this._userManagerLoadedId = this._userManager.connect('notify::is-loaded',
                                                                   Lang.bind(this, function() {
                                                                       if (this._userManager.is_loaded) {
@@ -492,8 +492,10 @@ const LoginDialog = new Lang.Class({
                                                                           this._userManagerLoadedId = 0;
                                                                       }
                                                                   }));
-        else
-            GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, this._loadUserList));
+        } else {
+            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() {
@@ -686,10 +688,11 @@ const LoginDialog = new Lang.Class({
                            },
                            onUpdateScope: this,
                            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);
                                    return GLib.SOURCE_REMOVE;
                                }));
+                               GLib.Source.set_name_by_id(id, '[gnome-shell] 
this._greeter.call_start_session_when_ready_sync');
                            },
                            onCompleteScope: this });
     },
@@ -745,6 +748,7 @@ const LoginDialog = new Lang.Class({
                                                                          hold.release();
                                                                          return GLib.SOURCE_REMOVE;
                                                                      });
+        GLib.Source.set_name_by_id(this._timedLoginIdleTimeOutId, '[gnome-shell] 
this._timedLoginAnimationTime');
         return hold;
     },
 
diff --git a/js/gdm/util.js b/js/gdm/util.js
index a3329e0..678b3ba 100644
--- a/js/gdm/util.js
+++ b/js/gdm/util.js
@@ -252,6 +252,7 @@ const ShellUserVerifier = new Lang.Class({
                                                            this._queueMessageTimeout();
                                                            return GLib.SOURCE_REMOVE;
                                                        }));
+        GLib.Source.set_name_by_id(this._messageQueueTimeoutId, '[gnome-shell] this._queueMessageTimeout');
     },
 
     _queueMessage: function(message, messageType) {
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index e318375..40fae87 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -305,6 +305,7 @@ const AppSwitcherPopup = new Lang.Class({
             this._thumbnailTimeoutId = Mainloop.timeout_add (
                 THUMBNAIL_POPUP_TIME,
                 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;
                                                                             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 54a5e9c..91538c2 100644
--- a/js/ui/animation.js
+++ b/js/ui/animation.js
@@ -34,6 +34,7 @@ const Animation = new Lang.Class({
                 this._showFrame(0);
 
             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;
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 90fac87..b908d1b 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1402,6 +1402,7 @@ const AppIcon = new Lang.Class({
                     this.popupMenu();
                     return GLib.SOURCE_REMOVE;
                 }));
+            GLib.Source.set_name_by_id(this._menuTimeoutId, '[gnome-shell] this.popupMenu');
         } else if (button == 3) {
             this.popupMenu();
             return Clutter.EVENT_STOP;
diff --git a/js/ui/background.js b/js/ui/background.js
index d36aeb1..284c488 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -271,10 +271,11 @@ const BackgroundCache = new Lang.Class({
 
         if (this._animationFilename == params.filename) {
             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);
                     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;
 
                            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);
                                    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;
 
-        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');
             return GLib.SOURCE_REMOVE;
         }));
+        GLib.Source.set_name_by_id(id, '[gnome-shell] this.emit');
     },
 
     _loadPattern: function() {
@@ -532,6 +535,7 @@ const Background = new Lang.Class({
                                                                     this._updateAnimation();
                                                                     return GLib.SOURCE_REMOVE;
                                                                 }));
+        GLib.Source.set_name_by_id(this._updateAnimationTimeoutId, '[gnome-shell] this._updateAnimation');
     },
 
     _loadAnimation: function(filename) {
diff --git a/js/ui/components/automountManager.js b/js/ui/components/automountManager.js
index 64b745e..531d59d 100644
--- a/js/ui/components/automountManager.js
+++ b/js/ui/components/automountManager.js
@@ -43,6 +43,7 @@ const AutomountManager = new Lang.Class({
         this._driveEjectButtonId = this._volumeMonitor.connect('drive-eject-button', Lang.bind(this, 
this._onDriveEjectButton));
 
         this._mountAllId = Mainloop.idle_add(Lang.bind(this, this._startupMountAll));
+        GLib.Source.set_name_by_id(this._mountAllId, '[gnome-shell] this._startupMountAll');
     },
 
     disable: function() {
@@ -234,10 +235,11 @@ const AutomountManager = new Lang.Class({
     },
 
     _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;
             return GLib.SOURCE_REMOVE;
         });
+        GLib.Source.set_name_by_id(id, '[gnome-shell] volume.allowAutorun');
     }
 });
 const Component = AutomountManager;
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index 49f1e3e..c42f58e 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -681,6 +681,7 @@ const ChatSource = new Lang.Class({
             Mainloop.source_remove(this._notifyTimeoutId);
         this._notifyTimeoutId = Mainloop.timeout_add(500,
             Lang.bind(this, this._notifyTimeout));
+        GLib.Source.set_name_by_id(this._notifyTimeoutId, '[gnome-shell] this._notifyTimeout');
     },
 
     _notifyTimeout: function() {
@@ -924,14 +925,16 @@ const ChatNotification = new Lang.Class({
                                 realMessage: group != 'meta' });
 
         if (!props.noTimestamp) {
-            if (timestamp < currentTime - SCROLLBACK_IMMEDIATE_TIME)
+            if (timestamp < currentTime - SCROLLBACK_IMMEDIATE_TIME) {
                 this.appendTimestamp();
-            else
+            } else {
                 // Schedule a new timestamp in SCROLLBACK_IMMEDIATE_TIME
                 // from the timestamp of the message.
                 this._timestampTimeoutId = Mainloop.timeout_add_seconds(
                     SCROLLBACK_IMMEDIATE_TIME - (currentTime - timestamp),
                     Lang.bind(this, this.appendTimestamp));
+                GLib.Source.set_name_by_id(this._timestampTimeoutId, '[gnome-shell] this.appendTimestamp');
+            }
         }
 
         this._filterMessages();
@@ -1100,6 +1103,7 @@ const ChatNotification = new Lang.Class({
             this._composingTimeoutId = Mainloop.timeout_add_seconds(
                 COMPOSING_STOP_TIMEOUT,
                 Lang.bind(this, this._composingStopTimeout));
+            GLib.Source.set_name_by_id(this._composingTimeoutId, '[gnome-shell] this._composingStopTimeout');
         } else {
             this.source.setChatState(Tp.ChannelChatState.ACTIVE);
         }
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 0d5db8e..99635cd 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -582,6 +582,7 @@ const Dash = new Lang.Class({
                         this._showLabelTimeoutId = 0;
                         return GLib.SOURCE_REMOVE;
                     }));
+                GLib.Source.set_name_by_id(this._showLabelTimeoutId, '[gnome-shell] item.showLabel');
                 if (this._resetHoverTimeoutId > 0) {
                     Mainloop.source_remove(this._resetHoverTimeoutId);
                     this._resetHoverTimeoutId = 0;
@@ -599,6 +600,7 @@ const Dash = new Lang.Class({
                         this._resetHoverTimeoutId = 0;
                         return GLib.SOURCE_REMOVE;
                     }));
+                GLib.Source.set_name_by_id(this._resetHoverTimeoutId, '[gnome-shell] this._labelShowing');
             }
         }
     },
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index a99791e..2b87241 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -395,6 +395,7 @@ const _Draggable = new Lang.Class({
 
         this._updateHoverId = GLib.idle_add(GLib.PRIORITY_DEFAULT,
                                             Lang.bind(this, this._updateDragHover));
+        GLib.Source.set_name_by_id(this._updateHoverId, '[gnome-shell] this._updateDragHover');
     },
 
     _updateDragPosition : function (event) {
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index a7a678f..7222f6e 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -551,6 +551,7 @@ const EndSessionDialog = new Lang.Class({
 
                 return GLib.SOURCE_REMOVE;
             }));
+        GLib.Source.set_name_by_id(this._timerId, '[gnome-shell] this._confirm');
     },
 
     _stopTimer: function() {
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index c1a6dbf..62147c7 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -266,12 +266,14 @@ const Keyboard = new Lang.Class({
             return;
         }
 
-        if (!this._showIdleId)
-            this._showIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE,
-                                             Lang.bind(this, function() {
-                                                 this.Show(time);
-                                                 return GLib.SOURCE_REMOVE;
-                                             }));
+        if (!this._showIdleId) {
+          this._showIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE,
+                                           Lang.bind(this, function() {
+                                               this.Show(time);
+                                               return GLib.SOURCE_REMOVE;
+                                           }));
+          GLib.Source.set_name_by_id(this._showIdleId, '[gnome-shell] this.Show');
+        }
     },
 
     _createLayersForGroup: function (gname) {
@@ -500,6 +502,7 @@ const Keyboard = new Lang.Class({
                                                        this._show(monitor);
                                                        return GLib.SOURCE_REMOVE;
                                                    }));
+        GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer');
     },
 
     _show: function(monitor) {
@@ -526,6 +529,7 @@ const Keyboard = new Lang.Class({
                                                        this._hide();
                                                        return GLib.SOURCE_REMOVE;
                                                    }));
+        GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer');
     },
 
     _hide: function() {
diff --git a/js/ui/layout.js b/js/ui/layout.js
index dc91f02..3901c9f 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -628,10 +628,11 @@ const LayoutManager = new Lang.Class({
         // until the event loop is uncontended and idle.
         // This helps to prevent us from running the animation
         // 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();
             return GLib.SOURCE_REMOVE;
         }));
+        GLib.Source.set_name_by_id(id, '[gnome-shell] this._startupAnimation');
     },
 
     _startupAnimation: function() {
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 9c2966a..2dccc99 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -846,6 +846,7 @@ const LookingGlass = new Lang.Class({
                 Mainloop.source_remove(this._timeoutId);
                 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;
         }));
 
diff --git a/js/ui/main.js b/js/ui/main.js
index bf80bc0..bf25401 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -608,5 +608,6 @@ function queueDeferredWork(workId) {
             _deferredTimeoutId = 0;
             return GLib.SOURCE_REMOVE;
         });
+        GLib.Source.set_name_by_id(_deferredTimeoutId, '[gnome-shell] _runAllDeferredWork');
     }
 }
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 70b6fc3..891bab2 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1987,6 +1987,7 @@ const MessageTray = new Lang.Class({
 
                 this._trayDwellTimeoutId = Mainloop.timeout_add(TRAY_DWELL_TIME,
                                                                 Lang.bind(this, this._trayDwellTimeout));
+                GLib.Source.set_name_by_id(this._trayDwellTimeoutId, '[gnome-shell] this._trayDwellTimeout');
             }
             this._trayDwelling = true;
         } 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.
             let timeout = this._useLongerNotificationLeftTimeout ? LONGER_HIDE_TIMEOUT * 1000 : HIDE_TIMEOUT 
* 1000;
             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._notificationLeftTimeoutId = Mainloop.timeout_add(LONGER_HIDE_TIMEOUT * 1000,
                                                              Lang.bind(this, 
this._onNotificationLeftTimeout));
+            GLib.Source.set_name_by_id(this._notificationLeftTimeoutId, '[gnome-shell] 
this._onNotificationLeftTimeout');
         } else {
             this._notificationLeftTimeoutId = 0;
             this._useLongerNotificationLeftTimeout = false;
@@ -2668,10 +2671,12 @@ const MessageTray = new Lang.Class({
             Mainloop.source_remove(this._notificationTimeoutId);
             this._notificationTimeoutId = 0;
         }
-        if (timeout > 0)
+        if (timeout > 0) {
             this._notificationTimeoutId =
                 Mainloop.timeout_add(timeout,
                                      Lang.bind(this, this._notificationTimeout));
+            GLib.Source.set_name_by_id(this._notificationTimeoutId, '[gnome-shell] 
this._notificationTimeout');
+        }
     },
 
     _notificationTimeout: function() {
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 4610780..dd25661 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -244,11 +244,12 @@ const FdoNotificationDaemon = new Lang.Class({
             // Ignore replacesId since we already sent back a
             // NotificationClosed for that id.
             id = this._nextNotificationId++;
-            Mainloop.idle_add(Lang.bind(this,
-                                        function () {
-                                            this._emitNotificationClosed(id, 
NotificationClosedReason.DISMISSED);
-                                            return GLib.SOURCE_REMOVE;
-                                        }));
+            let idle_id = Mainloop.idle_add(Lang.bind(this,
+                                            function () {
+                                                this._emitNotificationClosed(id, 
NotificationClosedReason.DISMISSED);
+                                                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]));
         }
 
diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js
index c9cb77d..2513aa8 100644
--- a/js/ui/osdWindow.js
+++ b/js/ui/osdWindow.js
@@ -156,6 +156,7 @@ const OsdWindow = new Lang.Class({
             Mainloop.source_remove(this._hideTimeoutId);
         this._hideTimeoutId = Mainloop.timeout_add(HIDE_TIMEOUT,
                                                    Lang.bind(this, this._hide));
+        GLib.Source.set_name_by_id(this._hideTimeoutId, '[gnome-shell] this._hide');
     },
 
     cancel: function() {
diff --git a/js/ui/overview.js b/js/ui/overview.js
index a60a966..5e000cd 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -365,6 +365,7 @@ const Overview = new Lang.Class({
                                                 this._lastHoveredWindow = null;
                                                 return GLib.SOURCE_REMOVE;
                                             }));
+            GLib.Source.set_name_by_id(this._windowSwitchTimeoutId, '[gnome-shell] Main.activateWindow');
         }
 
         return DND.DragMotionResult.CONTINUE;
diff --git a/js/ui/panel.js b/js/ui/panel.js
index e7f8df9..750149e 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -595,6 +595,7 @@ const ActivitiesButton = new Lang.Class({
             Mainloop.source_remove(this._xdndTimeOut);
         this._xdndTimeOut = Mainloop.timeout_add(BUTTON_DND_ACTIVATION_TIMEOUT,
                                                  Lang.bind(this, this._xdndToggleOverview, actor));
+        GLib.Source.set_name_by_id(this._xdndTimeOut, '[gnome-shell] this._xdndToggleOverview');
 
         return DND.DragMotionResult.CONTINUE;
     },
diff --git a/js/ui/pointerWatcher.js b/js/ui/pointerWatcher.js
index 5eb6718..c59d741 100644
--- a/js/ui/pointerWatcher.js
+++ b/js/ui/pointerWatcher.js
@@ -107,6 +107,7 @@ const PointerWatcher = new Lang.Class({
 
         this._timeoutId = Mainloop.timeout_add(minInterval,
                                                Lang.bind(this, this._onTimeout));
+        GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
     },
 
     _onTimeout: function() {
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index 90642a6..0209846 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -850,6 +850,7 @@ const ScreenShield = new Lang.Class({
                                                            this.lock(false);
                                                            return GLib.SOURCE_REMOVE;
                                                        }));
+            GLib.Source.set_name_by_id(this._lockTimeoutId, '[gnome-shell] this.lock');
         }
 
         this._activateFade(this._longLightbox, STANDARD_FADE_TIME);
@@ -1041,6 +1042,7 @@ const ScreenShield = new Lang.Class({
 
         if (!this._arrowAnimationId) {
             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();
         }
 
@@ -1108,10 +1110,11 @@ const ScreenShield = new Lang.Class({
         if (params.fadeToBlack && params.animateFade) {
             // 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);
                 return GLib.SOURCE_REMOVE;
             }));
+            GLib.Source.set_name_by_id(id, '[gnome-shell] this._activateFade');
         } else {
             if (params.fadeToBlack)
                 this._activateFade(this._shortLightbox, 0);
diff --git a/js/ui/scripting.js b/js/ui/scripting.js
index 8c8e3a3..1da99d9 100644
--- a/js/ui/scripting.js
+++ b/js/ui/scripting.js
@@ -39,11 +39,12 @@ const Main = imports.ui.main;
 function sleep(milliseconds) {
     let cb;
 
-    Mainloop.timeout_add(milliseconds, function() {
+    let id = Mainloop.timeout_add(milliseconds, function() {
                              if (cb)
                                  cb();
                              return GLib.SOURCE_REMOVE;
                          });
+    GLib.Source.set_name_by_id(id, '[gnome-shell] sleep');
 
     return function(callback) {
         cb = callback;
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index 599b51c..d547cb8 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -140,13 +140,14 @@ function _loadModes() {
 
 function listModes() {
     _loadModes();
-    Mainloop.idle_add(function() {
+    let id = Mainloop.idle_add(function() {
         let names = Object.getOwnPropertyNames(_modes);
         for (let i = 0; i < names.length; i++)
             if (_modes[names[i]].isPrimary)
                 print(names[i]);
         Mainloop.quit('listModes');
     });
+    GLib.Source.set_name_by_id(id, '[gnome-shell] listModes');
     Mainloop.run('listModes');
 }
 
diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js
index 56f8211..efcb652 100644
--- a/js/ui/status/accessibility.js
+++ b/js/ui/status/accessibility.js
@@ -103,6 +103,7 @@ const ATIndicator = new Lang.Class({
             return;
 
         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) {
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index 176bc6a..bd7875f 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -166,6 +166,7 @@ const SwitcherPopup = new Lang.Class({
                                                                this._initialDelayTimeoutId = 0;
                                                                return GLib.SOURCE_REMOVE;
                                                            }));
+        GLib.Source.set_name_by_id(this._initialDelayTimeoutId, '[gnome-shell] Main.osdWindow.cancel');
         return true;
     },
 
@@ -250,6 +251,7 @@ const SwitcherPopup = new Lang.Class({
             Mainloop.source_remove(this._motionTimeoutId);
 
         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() {
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 79fcde6..7dacc47 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -383,9 +383,11 @@ const ViewSelector = new Lang.Class({
                 this._iconClickedId = this._entry.connect('secondary-icon-clicked',
                     Lang.bind(this, this.reset));
 
-            if (this._searchTimeoutId == 0)
+            if (this._searchTimeoutId == 0) {
                 this._searchTimeoutId = Mainloop.timeout_add(150,
                     Lang.bind(this, this._doSearch));
+                GLib.Source.set_name_by_id(this._searchTimeoutId, '[gnome-shell] this._doSearch');
+            }
         } else {
             if (this._iconClickedId > 0) {
                 this._entry.disconnect(this._iconClickedId);
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index bdf6177..bc43388 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -82,6 +82,7 @@ const DisplayChangeDialog = new Lang.Class({
                                         { expand: false, x_fill: false, x_align: St.Align.END });
 
         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) {
@@ -271,18 +272,20 @@ const WorkspaceTracker = new Lang.Class({
             this._queueCheckWorkspaces();
             return GLib.SOURCE_REMOVE;
         }));
+        GLib.Source.set_name_by_id(workspace._keepAliveId, '[gnome-shell] this._queueCheckWorkspaces');
     },
 
     _windowRemoved: function(workspace, window) {
         workspace._lastRemovedWindow = window;
         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) {
                 workspace._lastRemovedWindow = null;
                 this._queueCheckWorkspaces();
             }
             return GLib.SOURCE_REMOVE;
         }));
+        GLib.Source.set_name_by_id(id, '[gnome-shell] this._queueCheckWorkspaces');
     },
 
     _windowLeftMonitor: function(metaScreen, monitorIndex, metaWin) {
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index f2521c6..2c49d60 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -594,11 +594,12 @@ const WindowOverlay = new Lang.Class({
 
             // use an idle handler to avoid mapping problems -
             // see comment in Workspace._windowAdded
-            Mainloop.idle_add(Lang.bind(this,
-                                        function() {
-                                            this._windowClone.emit('selected');
-                                            return GLib.SOURCE_REMOVE;
-                                        }));
+            let id = Mainloop.idle_add(Lang.bind(this,
+                                            function() {
+                                                this._windowClone.emit('selected');
+                                                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() {
-        if (this._idleToggleCloseId == 0)
+        if (this._idleToggleCloseId == 0) {
             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;
     },
 
@@ -1418,6 +1421,7 @@ const Workspace = new Lang.Class({
         this._currentLayout = null;
         this._repositionWindowsId = Mainloop.timeout_add(750,
             Lang.bind(this, this._delayedWindowRepositioning));
+        GLib.Source.set_name_by_id(this._repositionWindowsId, '[gnome-shell] 
this._delayedWindowRepositioning');
     },
 
     _doAddWindow : function(metaWin) {
@@ -1429,14 +1433,15 @@ const Workspace = new Lang.Class({
         if (!win) {
             // Newly-created windows are added to a workspace before
             // the compositor finds out about them...
-            Mainloop.idle_add(Lang.bind(this,
-                                        function () {
-                                            if (this.actor &&
-                                                metaWin.get_compositor_private() &&
-                                                metaWin.get_workspace() == this.metaWorkspace)
-                                                this._doAddWindow(metaWin);
-                                            return GLib.SOURCE_REMOVE;
-                                        }));
+            let id = Mainloop.idle_add(Lang.bind(this,
+                                            function () {
+                                                if (this.actor &&
+                                                    metaWin.get_compositor_private() &&
+                                                    metaWin.get_workspace() == this.metaWorkspace)
+                                                    this._doAddWindow(metaWin);
+                                                return GLib.SOURCE_REMOVE;
+                                            }));
+            GLib.Source.set_name_by_id(id, '[gnome-shell] this._doAddWindow');
             return;
         }
 
diff --git a/js/ui/workspaceSwitcherPopup.js b/js/ui/workspaceSwitcherPopup.js
index cf30421..55da3e5 100644
--- a/js/ui/workspaceSwitcherPopup.js
+++ b/js/ui/workspaceSwitcherPopup.js
@@ -52,6 +52,7 @@ const WorkspaceSwitcherPopup = new Lang.Class({
         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));
+        GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
     },
 
     _getPreferredHeight : function (actor, forWidth, alloc) {
@@ -145,6 +146,7 @@ const WorkspaceSwitcherPopup = new Lang.Class({
         if (this._timeoutId != 0)
             Mainloop.source_remove(this._timeoutId);
         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();
     },
 
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 25469e3..113f2a7 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -386,14 +386,15 @@ const WorkspaceThumbnail = new Lang.Class({
         if (!win) {
             // Newly-created windows are added to a workspace before
             // the compositor finds out about them...
-            Mainloop.idle_add(Lang.bind(this,
-                                        function () {
+            let id = Mainloop.idle_add(Lang.bind(this,
+                                       function () {
                                             if (!this._removed &&
                                                 metaWin.get_compositor_private() &&
                                                 metaWin.get_workspace() == this.metaWorkspace)
                                                 this._doAddWindow(metaWin);
                                             return GLib.SOURCE_REMOVE;
                                         }));
+            GLib.Source.set_name_by_id(id, '[gnome-shell] this._doAddWindow');
             return;
         }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]