[gnome-shell] shell-info: Use transient notifications
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] shell-info: Use transient notifications
- Date: Thu, 16 Dec 2010 21:57:08 +0000 (UTC)
commit eef194c3aac3a66f93bf7cb677fdad51661faed5
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Dec 16 22:34:39 2010 +0100
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 files changed, 2 insertions(+), 18 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 21ca951..4c3e21c 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',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]