From 2be507e96007b97d73995936ad50c469a4a8a798 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sun, 19 Dec 2021 19:17:35 +0100 Subject: Do not run helper applications unless ayatana-webmail is running --- ayatanawebmail/application.py | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'ayatanawebmail') diff --git a/ayatanawebmail/application.py b/ayatanawebmail/application.py index 8bb76ea..b6abf38 100755 --- a/ayatanawebmail/application.py +++ b/ayatanawebmail/application.py @@ -1081,33 +1081,36 @@ class AyatanaWebmail(object): logger.info('Checking network...') if not checkNetwork(): + return False - logger.info('Network connection active, connecting...') + if (lstConnections): - for oConnection in lstConnections: + logger.info('Network connection active, connecting...') - oConnection.close() + for oConnection in lstConnections: - try: + oConnection.close() - oConnection.connect() - oConnection.bConnecting = False + try: - except KeyboardInterrupt: + oConnection.connect() + oConnection.bConnecting = False - self.close(0) + except KeyboardInterrupt: - except Exception as oException: + self.close(0) + + except Exception as oException: - logger.error('"{0}:{1}" could not connect: {2}'.format(oConnection.strLogin, oConnection.strFolder, str(oException))) + logger.error('"{0}:{1}" could not connect: {2}'.format(oConnection.strLogin, oConnection.strFolder, str(oException))) - oNotification = Notify.Notification.new(_('Connection error'), '', APPNAME) - oNotification.set_property('body', _('Unable to connect to account "{accountName}", the application will now exit.').format(accountName=oConnection.strLogin)) - oNotification.set_hint('desktop-entry', GLib.Variant.new_string(APPNAME)) - oNotification.set_timeout(Notify.EXPIRES_NEVER) - oNotification.show() - self.close(1) + oNotification = Notify.Notification.new(_('Connection error'), '', APPNAME) + oNotification.set_property('body', _('Unable to connect to account "{accountName}", the application will now exit.').format(accountName=oConnection.strLogin)) + oNotification.set_hint('desktop-entry', GLib.Variant.new_string(APPNAME)) + oNotification.set_timeout(Notify.EXPIRES_NEVER) + oNotification.show() + self.close(1) return False -- cgit v1.2.3