summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/commands/globals.py14
-rw-r--r--alot/ui.py2
2 files changed, 13 insertions, 3 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 6509e554..7cdf401e 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -38,8 +38,10 @@ class ExitCommand(Command):
"""shut down cleanly"""
@inlineCallbacks
def apply(self, ui):
- if settings.get('bug_on_exit'):
- if (yield ui.choice('realy quit?', select='yes', cancel='no',
+ msg = 'index not fully synced. ' if ui.db_was_locked else ''
+ if settings.get('bug_on_exit') or ui.db_was_locked:
+ msg += 'really quit?'
+ if (yield ui.choice(msg, select='yes', cancel='no',
msg_position='left')) == 'no':
return
for b in ui.buffers:
@@ -470,13 +472,19 @@ class FlushCommand(Command):
if callable(self.callback):
self.callback()
logging.debug('flush complete')
+ if ui.db_was_locked:
+ ui.notify('changes flushed')
+ ui.db_was_locked = False
+
except DatabaseLockedError:
timeout = settings.get('flush_retry_timeout')
def f(*args):
self.apply(ui)
ui.mainloop.set_alarm_in(timeout, f)
- ui.notify('index locked, will try again in %d secs' % timeout)
+ if not ui.db_was_locked:
+ ui.notify('index locked, will try again in %d secs' % timeout)
+ ui.db_was_locked = True
ui.update()
return
diff --git a/alot/ui.py b/alot/ui.py
index 0fa94bc9..6f6d29ed 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -29,6 +29,8 @@ class UI(object):
"""points to currently active :class:`~alot.buffers.Buffer`"""
dbman = None
"""Database Manager (:class:`~alot.db.manager.DBManager`)"""
+ db_was_locked = False
+ """flag used to prevent multiple 'index locked' notifications"""
mode = 'global'
"""interface mode identifier - type of current buffer"""
commandprompthistory = []