[gnome-shell/wip/gtk-notification: 16/22] messageTray: Provide a convenient way to notify without showing a banner
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/gtk-notification: 16/22] messageTray: Provide a convenient way to notify without showing a banner
- Date: Mon, 14 Oct 2013 13:54:59 +0000 (UTC)
commit 9ba6472c52bb6ac2ed9c6be1dfd404db7b37b2a5
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Oct 14 00:08:49 2013 -0400
messageTray: Provide a convenient way to notify without showing a banner
We can do this with pushNotification / notify, but it's a bit more
convenient to do it with a boolean flag on notify(). To prevent changing
all consumers, fall back to `true`.
js/ui/components/telepathyClient.js | 2 +-
js/ui/messageTray.js | 11 ++++++++---
js/ui/notificationDaemon.js | 6 ++----
3 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index 28a87cd..6060a79 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -466,7 +466,7 @@ const ChatSource = new Lang.Class({
// Add ourselves as a source.
Main.messageTray.add(this);
- this.pushNotification(this._notification);
+ this._pushNotification(this._notification);
this._getLogMessages();
},
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 2e26b16..35cd9eb 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1376,7 +1376,7 @@ const Source = new Lang.Class({
this.countUpdated();
},
- pushNotification: function(notification) {
+ _pushNotification: function(notification) {
if (this.notifications.indexOf(notification) >= 0)
return;
@@ -1387,9 +1387,8 @@ const Source = new Lang.Class({
this.countUpdated();
},
- notify: function(notification) {
+ _showBanner: function(notification) {
notification.acknowledged = false;
- this.pushNotification(notification);
if (!this.isMuted) {
// Play the sound now, if banners are disabled.
@@ -1403,6 +1402,12 @@ const Source = new Lang.Class({
}
},
+ notify: function(notification, showBanner) {
+ this._pushNotification(notification);
+ if (showBanner === undefined || showBanner)
+ this._showBanner(notification);
+ },
+
destroy: function(reason) {
this.policy.destroy();
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 51d18c3..3449bb1 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -569,10 +569,8 @@ const Source = new Lang.Class({
this.iconUpdated();
let tracker = Shell.WindowTracker.get_default();
- if (notification.resident && this.app && tracker.focus_app == this.app)
- this.pushNotification(notification);
- else
- this.notify(notification);
+ let suppressBanner = notification.resident && this.app && tracker.focus_app == this.app;
+ this.notify(notification, !suppressBanner);
},
handleSummaryClick: function(button) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]