~nataliabidart/ubuntuone-client/use-sso-qt

« back to all changes in this revision

Viewing changes to ubuntuone/syncdaemon/interaction_interfaces.py

  • Committer: Natalia B. Bidart
  • Date: 2012-02-22 20:50:31 UTC
  • mfrom: (1193.1.3 ubuntuone-client)
  • Revision ID: natalia.bidart@canonical.com-20120222205031-kxwlj8fxzykyvrw1
MergedĀ trunkĀ in.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 
37
37
from twisted.internet import defer
38
38
 
 
39
from ubuntu_sso.networkstate import NetworkManagerState, ONLINE
 
40
 
39
41
from ubuntuone.logger import log_call
40
42
from ubuntuone.platform import credentials, ExternalInterface
41
43
from ubuntuone.storageprotocol import request
1157
1159
        super(SyncdaemonService, self).__init__(main, interface)
1158
1160
 
1159
1161
        self.send_events = send_events
 
1162
        self.network_manager = NetworkManagerState(
 
1163
                                result_cb=self.network_state_changed)
 
1164
        self.network_manager.find_online_state()
1160
1165
 
1161
1166
        if interface is None:
1162
1167
            self.interface = ExternalInterface(service=self)
1290
1295
        self.main.action_q.rescan_from_scratch(volume.volume_id)
1291
1296
 
1292
1297
    @log_call(logger.debug)
 
1298
    def network_state_changed(self, state):
 
1299
        """Receive the connection state and call the proper function."""
 
1300
        if state == ONLINE:
 
1301
            self.network_connected()
 
1302
        else:
 
1303
            self.network_disconnected()
 
1304
 
 
1305
    @log_call(logger.debug)
1293
1306
    def network_connected(self):
1294
1307
        """Push the connected event."""
1295
1308
        self.main.event_q.push('SYS_NET_CONNECTED')