[Xfce4-commits] <postler:master> Re-use the same notification object
Christian Dywan
noreply at xfce.org
Thu Feb 3 00:34:01 CET 2011
Updating branch refs/heads/master
to b3fc28fcb41c48c880564fcca5f6318a2eaa67e0 (commit)
from 027d9720f2ce579cfad808d0473a147f51382904 (commit)
commit b3fc28fcb41c48c880564fcca5f6318a2eaa67e0
Author: Christian Dywan <christian at twotoasts.de>
Date: Mon Jan 31 21:45:34 2011 +0100
Re-use the same notification object
So we don't show multiple bubbles even if the message count
is a total count.
postler/postler-app.vala | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/postler/postler-app.vala b/postler/postler-app.vala
index 2118cb5..690ccb5 100644
--- a/postler/postler-app.vala
+++ b/postler/postler-app.vala
@@ -214,17 +214,22 @@ public class Postler.App : Unique.App {
return true;
}
+ static Notify.Notification? notification = null;
public static void send_notification (string message) {
try {
if (!Notify.is_initted ()) {
if (!Notify.init ("Postler"))
throw new FileError.FAILED (_("Failed to initialize."));
}
- var notification = (Notify.Notification)GLib.Object.new (
- typeof (Notify.Notification),
- "summary", GLib.Environment.get_application_name (),
- "body", message,
- "icon-name", STOCK_INTERNET_MAIL);
+ if (notification == null) {
+ notification = (Notify.Notification)GLib.Object.new (
+ typeof (Notify.Notification),
+ "summary", GLib.Environment.get_application_name (),
+ "body", message,
+ "icon-name", STOCK_INTERNET_MAIL);
+ }
+ else
+ notification.set ("body", message);
notification.show ();
} catch (Error error) {
GLib.warning (_("Failed to send notification: %s"), error.message);
More information about the Xfce4-commits
mailing list