[Xfce4-commits] <postler:master> Show notifications when checking mail for unread messages
Christian Dywan
noreply at xfce.org
Tue Nov 16 01:58:01 CET 2010
Updating branch refs/heads/master
to 33699ee2fac3bd6128010bec09e0de0d4f57d140 (commit)
from e123c8289a77b480a4fccf325ae80e87e458c526 (commit)
commit 33699ee2fac3bd6128010bec09e0de0d4f57d140
Author: Bernd Prünster <bernd.pruenster at gmail.com>
Date: Tue Nov 16 00:13:28 2010 +0100
Show notifications when checking mail for unread messages
Fixes: https://bugs.launchpad.net/postler/+bug/671538
postler/postler-bureau.vala | 2 ++
postler/postler-folders.vala | 11 +++++++++++
postler/wscript_build | 4 ++--
wscript | 1 +
4 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index 9be0732..d2e4e06 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -90,11 +90,13 @@ public class Postler.Bureau : Gtk.Window {
private bool new_message_timer () {
accounts.receive ();
+ folders.display_notify = true;
return true;
}
void action_mail_receive () {
accounts.receive ();
+ folders.display_notify = true;
}
void compose_message (string? prefix=null, string? recipient=null) {
diff --git a/postler/postler-folders.vala b/postler/postler-folders.vala
index 2386d75..015e32d 100644
--- a/postler/postler-folders.vala
+++ b/postler/postler-folders.vala
@@ -32,6 +32,8 @@ public class Postler.Folders : Gtk.TreeView {
return null;
}
}
+ public bool display_notify { get; set; default = false; }
+
public Postler.AccountInfo? get_selected_account () {
return_val_if_fail (messages != null, null);
Gtk.TreeIter iter;
@@ -55,6 +57,7 @@ public class Postler.Folders : Gtk.TreeView {
public Folders (Accounts accounts) {
this.accounts = accounts;
+ Notify.init ("Postler");
store = new Gtk.TreeStore (7,
typeof (string), typeof (string), typeof (string),
typeof (AccountInfo),
@@ -86,6 +89,14 @@ public class Postler.Folders : Gtk.TreeView {
if (store.get_iter_from_string (out iter, path))
store.set (iter,
Columns.NAME, "%s (%d)".printf (account, unread));
+ if (unread > 0 && display_notify) {
+ var notification = new Notify.Notification ("Postler",
+ ngettext ("You have a %d message",
+ "You have %d new messages", unread).printf (unread),
+ STOCK_INTERNET_MAIL, null);
+ notification.show ();
+ display_notify = false;
+ }
} catch (GLib.Error error) {
GLib.critical (_("Failed to monitor folder \"%s\": %s"),
msg_dir.get_path (), error.message);
diff --git a/postler/wscript_build b/postler/wscript_build
index 0e85405..aa7b5cf 100644
--- a/postler/wscript_build
+++ b/postler/wscript_build
@@ -13,7 +13,7 @@ obj.name = 'postler'
obj.target = 'postler'
obj.includes = '. ..'
obj.find_sources_in_dirs ('.')
-obj.uselib = 'GIO GTHREAD GTK UNIQUE WEBKIT'
-obj.packages = 'config postler posix gio-2.0 gtk+-2.0 unique-1.0 webkit-1.0'
+obj.uselib = 'GIO GTHREAD GTK UNIQUE WEBKIT LIBNOTIFY'
+obj.packages = 'config postler posix gio-2.0 gtk+-2.0 libnotify unique-1.0 webkit-1.0'
obj.vapi_dirs = '.'
diff --git a/wscript b/wscript
index e7e61c0..8a8ce5c 100644
--- a/wscript
+++ b/wscript
@@ -111,6 +111,7 @@ def configure (conf):
check_pkg ('unique-1.0', '0.9')
check_pkg ('gtk+-2.0', '2.12.0', var='GTK')
check_pkg ('webkit-1.0', '1.1.1')
+ check_pkg ('libnotify', var='LIBNOTIFY')
# isync
conf.check (header_name='sys/filio.h')
More information about the Xfce4-commits
mailing list