messageTray: Squash together some duplicated code

https://bugzilla.gnome.org/show_bug.cgi?id=731118
This commit is contained in:
Jasper St. Pierre 2014-05-28 15:18:00 -04:00
parent 524e2df708
commit f6b5385495

View File

@ -2268,6 +2268,16 @@ const MessageTray = new Lang.Class({
this._grabHelper.addActor(corner.actor); 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() { _onNotificationHoverChanged: function() {
if (this._notificationWidget.hover == this._notificationHovered) if (this._notificationWidget.hover == this._notificationHovered)
return; return;
@ -2277,13 +2287,7 @@ const MessageTray = new Lang.Class({
// No dwell inside notifications at the bottom of the screen // No dwell inside notifications at the bottom of the screen
this._cancelTrayDwell(); this._cancelTrayDwell();
this._useLongerNotificationLeftTimeout = false; this._resetNotificationLeftTimeout();
if (this._notificationLeftTimeoutId) {
Mainloop.source_remove(this._notificationLeftTimeoutId);
this._notificationLeftTimeoutId = 0;
this._notificationLeftMouseX = -1;
this._notificationLeftMouseY = -1;
}
if (this._showNotificationMouseX >= 0) { if (this._showNotificationMouseX >= 0) {
let actorAtShowNotificationPosition = let actorAtShowNotificationPosition =
@ -2719,13 +2723,7 @@ const MessageTray = new Lang.Class({
this._notificationUnfocusedId = 0; this._notificationUnfocusedId = 0;
} }
this._useLongerNotificationLeftTimeout = false; this._resetNotificationLeftTimeout();
if (this._notificationLeftTimeoutId) {
Mainloop.source_remove(this._notificationLeftTimeoutId);
this._notificationLeftTimeoutId = 0;
this._notificationLeftMouseX = -1;
this._notificationLeftMouseY = -1;
}
if (animate) { if (animate) {
this._tween(this._notificationWidget, '_notificationState', State.HIDDEN, this._tween(this._notificationWidget, '_notificationState', State.HIDDEN,