[gnome-shell] messageTray: Squash together some duplicated code



commit f6b5385495ca281f16d19c64aa6423e57857875c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed May 28 15:18:00 2014 -0400

    messageTray: Squash together some duplicated code
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731118

 js/ui/messageTray.js |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 948a5b8..971c451 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -2268,6 +2268,16 @@ const MessageTray = new Lang.Class({
             this._grabHelper.addActor(corner.actor);
     },
 
+    _resetNotificationLeftTimeout: function() {
+        this._useLongerNotificationLeftTimeout = false;
+        if (this._notificationLeftTimeoutId) {
+            Mainloop.source_remove(this._notificationLeftTimeoutId);
+            this._notificationLeftTimeoutId = 0;
+            this._notificationLeftMouseX = -1;
+            this._notificationLeftMouseY = -1;
+        }
+    },
+
     _onNotificationHoverChanged: function() {
         if (this._notificationWidget.hover == this._notificationHovered)
             return;
@@ -2277,13 +2287,7 @@ const MessageTray = new Lang.Class({
             // No dwell inside notifications at the bottom of the screen
             this._cancelTrayDwell();
 
-            this._useLongerNotificationLeftTimeout = false;
-            if (this._notificationLeftTimeoutId) {
-                Mainloop.source_remove(this._notificationLeftTimeoutId);
-                this._notificationLeftTimeoutId = 0;
-                this._notificationLeftMouseX = -1;
-                this._notificationLeftMouseY = -1;
-            }
+            this._resetNotificationLeftTimeout();
 
             if (this._showNotificationMouseX >= 0) {
                 let actorAtShowNotificationPosition =
@@ -2719,13 +2723,7 @@ const MessageTray = new Lang.Class({
             this._notificationUnfocusedId = 0;
         }
 
-        this._useLongerNotificationLeftTimeout = false;
-        if (this._notificationLeftTimeoutId) {
-            Mainloop.source_remove(this._notificationLeftTimeoutId);
-            this._notificationLeftTimeoutId = 0;
-            this._notificationLeftMouseX = -1;
-            this._notificationLeftMouseY = -1;
-        }
+        this._resetNotificationLeftTimeout();
 
         if (animate) {
             this._tween(this._notificationWidget, '_notificationState', State.HIDDEN,


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