Skip to content

Commit

Permalink
Avoid shutdown failing in unconfigured state
Browse files Browse the repository at this point in the history
  • Loading branch information
BjarniRunar committed Apr 10, 2018
1 parent 52b1786 commit 3f906be
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions mailpile/plugins/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,23 @@ def change_state(self):
self._state(True)
return True
else:
if self.config.index and self.config.index.loaded_index:
msg_count = len(self.config.index.INDEX)
label = _('Mailpile: %d messages') % msg_count
elif not self.config.loaded_config:
label = None

if self.config.index_loading:
pass # new_mail_notifications handles this
elif self._state in (self._state_need_setup,):
label = _('Mailpile') + ': ' + _('New Installation')
elif self._state not in (
self._state_logged_in, self._state_shutting_down):
label = _('Mailpile') + ': ' + _('Please log in')
else:
label = _('This is Mailpile!')
#self._do('set_item', id="notification", label=label)

# FIXME: We rely on sending garbage over the socket
# regularly to check for errors. When that is
# gone we might not need to be so chatty.
# Until then: do not remove, it breaks shutdown!
if label:
self._do('set_item', id="notification", label=label)

return False

def new_mail_notifications(self, summarize=False):
Expand Down

0 comments on commit 3f906be

Please sign in to comment.