This commit is contained in:
Matthieu Coudron 2015-01-05 19:45:44 +01:00
parent 0ff58efc69
commit ff2794fa3d
3 changed files with 14 additions and 1 deletions

1
.gitignore vendored
View File

@ -5,4 +5,5 @@ build/*
dist/* dist/*
*.egg-info/* *.egg-info/*
*~ *~
.i3pystatus-*
ci-build ci-build

View File

@ -6,6 +6,10 @@ class Backend(SettingsBase):
"""Handles the details of checking for mail""" """Handles the details of checking for mail"""
unread = 0 unread = 0
# required = ("account", )
# account = "Default account"
"""Number of unread mails """Number of unread mails
You'll probably implement that as a property""" You'll probably implement that as a property"""
@ -40,6 +44,9 @@ class Mail(IntervalModule):
on_leftclick = "open_client" on_leftclick = "open_client"
current_unread = 0
current_backend = 0
def init(self): def init(self):
for backend in self.backends: for backend in self.backends:
pass pass

View File

@ -20,7 +20,12 @@ class Notmuch(Backend):
("db_path", "Path to the directory of your notmuch database"), ("db_path", "Path to the directory of your notmuch database"),
) )
required = tuple( ("account", "Name available to formatter"), )
db_path = None db_path = None
query = "tag:unread and tag:inbox"
account = "Default account"
def init(self): def init(self):
if not self.db_path: if not self.db_path:
@ -38,7 +43,7 @@ class Notmuch(Backend):
@property @property
def unread(self): def unread(self):
db = notmuch.Database(self.db_path) db = notmuch.Database(self.db_path)
result = notmuch.Query(db, "tag:unread and tag:inbox").count_messages() result = notmuch.Query(db, self.query).count_messages()
db.close() db.close()
return result return result