messageTray: Clean up code a tiny bit

Remove some duplication by reusing a method.

https://bugzilla.gnome.org/show_bug.cgi?id=695659
This commit is contained in:
Jasper St. Pierre 2013-03-11 17:11:51 -04:00
parent 9eeabf79f9
commit 16547fb3c2

View File

@ -2620,10 +2620,9 @@ const MessageTray = new Lang.Class({
}, },
_expandNotification: function(autoExpanding) { _expandNotification: function(autoExpanding) {
// Don't grab focus in notifications that are auto-expanded. // Don't focus notifications that are auto-expanding.
if (!autoExpanding) if (!autoExpanding)
this._grabHelper.grab({ actor: this._notification.actor, this._ensureNotificationFocused();
grabFocus: true });
if (!this._notificationExpandedId) if (!this._notificationExpandedId)
this._notificationExpandedId = this._notificationExpandedId =
@ -2653,8 +2652,6 @@ const MessageTray = new Lang.Class({
} }
}, },
// We use this function to grab focus when the user moves the pointer
// to a notification with CRITICAL urgency that was already auto-expanded.
_ensureNotificationFocused: function() { _ensureNotificationFocused: function() {
this._grabHelper.grab({ actor: this._notification.actor, this._grabHelper.grab({ actor: this._notification.actor,
grabFocus: true }); grabFocus: true });