~ralsina/ubuntuone-control-panel/fix-scroll

« back to all changes in this revision

Viewing changes to ubuntuone/controlpanel/gui/qt/systray.py

  • Committer: Tarmac
  • Author(s): ralsina
  • Date: 2011-12-27 19:02:35 UTC
  • mfrom: (247.1.7 fix_908888)
  • Revision ID: tarmac-20111227190235-j9h2r98rlck5iheg
When selecting "Quit Ubuntu One" from the tray context menu, shutdown syncdaemon. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- coding: utf-8 -*-
2
 
 
3
 
# Authors: Roberto Alsina <roberto.alsina@canonical.com>
4
2
#
5
3
# Copyright 2011 Canonical Ltd.
6
4
#
18
16
"""System notification area icon."""
19
17
 
20
18
from PyQt4 import QtGui
 
19
from twisted.internet.defer import inlineCallbacks
 
20
 
 
21
from ubuntuone.platform.tools import SyncDaemonTool
21
22
 
22
23
 
23
24
class TrayIcon(QtGui.QSystemTrayIcon):
60
61
            self.window.close()
61
62
            self.window = None
62
63
 
63
 
    def stop(self):
 
64
    @inlineCallbacks
 
65
    def stop(self, *args, **kwargs):
64
66
        """Stop the application."""
 
67
        # Stop syncdaemon
 
68
        # pylint: disable=W0702
 
69
        # Really, if it fails we can't do anything about it.
 
70
        try:
 
71
            st = SyncDaemonTool()
 
72
            yield st.quit()
 
73
        except:
 
74
            # Maybe it was not running?
 
75
            pass
65
76
        # pylint: disable=W0404
66
77
        from twisted.internet import reactor
67
78
        # pylint: enable=W0404