summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2014-09-01 19:03:46 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2014-09-03 15:22:11 -0300
commite6fae0977015919282971dbe8a00938415c1233b (patch)
tree0b7b5cd7c22be0a18305a63cc07909e037f80ba3
parentde2f0e13a5a48e86b75eb54a56fe9f88b720193f (diff)
Code cleanup and logging improvements.
-rw-r--r--changes/code-and-logging-cleanup1
-rw-r--r--src/leap/bitmask/gui/mainwindow.py18
-rw-r--r--src/leap/bitmask/gui/wizard.py5
-rw-r--r--src/leap/bitmask/services/eip/vpnprocess.py2
-rw-r--r--src/leap/bitmask/services/mail/smtpbootstrapper.py2
5 files changed, 16 insertions, 12 deletions
diff --git a/changes/code-and-logging-cleanup b/changes/code-and-logging-cleanup
new file mode 100644
index 00000000..3a381e68
--- /dev/null
+++ b/changes/code-and-logging-cleanup
@@ -0,0 +1 @@
+- Code cleanup and logging improvements.
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index 653ebc35..8127c1f6 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -206,6 +206,9 @@ class MainWindow(QtGui.QMainWindow):
self._finally_quitting = False
self._system_quit = False
+ # Used to differentiate between a real quit and a close to tray
+ self._close_to_tray = True
+
self._backend_connected_signals = []
self._backend_connect()
@@ -229,9 +232,6 @@ class MainWindow(QtGui.QMainWindow):
self.raise_window.connect(self._do_raise_mainwindow)
- # Used to differentiate between real quits and close to tray
- self._really_quit = False
-
self._systray = None
# XXX separate actions into a different module.
@@ -1144,7 +1144,7 @@ class MainWindow(QtGui.QMainWindow):
return
if QtGui.QSystemTrayIcon.isSystemTrayAvailable() and \
- not self._really_quit:
+ self._close_to_tray:
self._ensure_invisible()
e.ignore()
return
@@ -1889,10 +1889,9 @@ class MainWindow(QtGui.QMainWindow):
"""
Stop services and cancel ongoing actions (if any).
"""
- logger.debug('About to quit, doing cleanup.')
+ logger.debug('Stopping services...')
self._cancel_ongoing_defers()
-
self._services_being_stopped = set(('imap', 'eip'))
imap_stopped = lambda: self._remove_service('imap')
@@ -1921,9 +1920,10 @@ class MainWindow(QtGui.QMainWindow):
if self._quitting:
return
- autostart.set_autostart(False)
-
self._quitting = True
+ self._close_to_tray = False
+ logger.debug('Quitting...')
+ autostart.set_autostart(False)
# first thing to do quitting, hide the mainwindow and show tooltip.
self.hide()
@@ -1942,8 +1942,6 @@ class MainWindow(QtGui.QMainWindow):
# Set this in case that the app is hidden
QtGui.QApplication.setQuitOnLastWindowClosed(True)
- self._really_quit = True
-
if not self._backend.online:
self.final_quit()
return
diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py
index 498e8501..8182228d 100644
--- a/src/leap/bitmask/gui/wizard.py
+++ b/src/leap/bitmask/gui/wizard.py
@@ -672,8 +672,9 @@ class Wizard(QtGui.QWizard):
Loads the services that the provider provides into the UI for
the user to enable or disable.
"""
- self.ui.grpServices.setTitle(
- self.tr("Services by {0}").format(self._provider_details['domain']))
+ title = self.tr("Services by {0}").format(
+ self._provider_details['domain'])
+ self.ui.grpServices.setTitle(title)
services = get_supported(self._provider_details['services'])
diff --git a/src/leap/bitmask/services/eip/vpnprocess.py b/src/leap/bitmask/services/eip/vpnprocess.py
index d41064ec..8dc6021f 100644
--- a/src/leap/bitmask/services/eip/vpnprocess.py
+++ b/src/leap/bitmask/services/eip/vpnprocess.py
@@ -371,6 +371,8 @@ class VPN(object):
logger.debug("Firewall down")
else:
logger.warning("Could not tear firewall down")
+ else:
+ logger.debug("VPN is not running.")
def _start_pollers(self):
"""
diff --git a/src/leap/bitmask/services/mail/smtpbootstrapper.py b/src/leap/bitmask/services/mail/smtpbootstrapper.py
index 3ef755e8..9dd61488 100644
--- a/src/leap/bitmask/services/mail/smtpbootstrapper.py
+++ b/src/leap/bitmask/services/mail/smtpbootstrapper.py
@@ -173,3 +173,5 @@ class SMTPBootstrapper(AbstractBootstrapper):
logger.debug('Stopping SMTP service.')
self._smtp_port.stopListening()
self._smtp_service.doStop()
+ else:
+ logger.debug('SMTP service not running.')