From eef194c3aac3a66f93bf7cb677fdad51661faed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 16 Dec 2010 22:34:39 +0100 Subject: [PATCH] shell-info: Use transient notifications According to the designers, system notifications should be transient; so now that transient notifications are supported properly, make use of it instead of using a timeout to remove the associated source. --- js/ui/overview.js | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/js/ui/overview.js b/js/ui/overview.js index 21ca95179..4c3e21cb1 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -28,7 +28,6 @@ const ANIMATION_TIME = 0.25; // We split the screen vertically between the dash and the view selector. const DASH_SPLIT_FRACTION = 0.1; -const SHELL_INFO_HIDE_TIMEOUT = 10; function Source() { this._init(); @@ -61,14 +60,10 @@ function ShellInfo() { ShellInfo.prototype = { _init: function() { this._source = null; - this._timeoutId = 0; this._undoCallback = null; }, _onUndoClicked: function() { - Mainloop.source_remove(this._timeoutId); - this._timeoutId = 0; - if (this._undoCallback) this._undoCallback(); this._undoCallback = null; @@ -77,20 +72,7 @@ ShellInfo.prototype = { this._source.destroy(); }, - _onTimeout: function() { - this._timeoutId = 0; - if (this._source) - this._source.destroy(); - return false; - }, - setMessage: function(text, undoCallback, undoLabel) { - if (this._timeoutId) - Mainloop.source_remove(this._timeoutId); - - this._timeoutId = Mainloop.timeout_add_seconds(SHELL_INFO_HIDE_TIMEOUT, - Lang.bind(this, this._onTimeout)); - if (this._source == null) { this._source = new Source(); this._source.connect('destroy', Lang.bind(this, @@ -106,6 +88,8 @@ ShellInfo.prototype = { else notification.update(text, null, { clear: true }); + notification.setTransient(true); + this._undoCallback = undoCallback; if (undoCallback) { notification.addButton('system-undo',