~nataliabidart/ubuntuone-client/credentials-shutdown

« back to all changes in this revision

Viewing changes to bin/ubuntuone-preferences

  • Committer: Tarmac
  • Author(s): Rodney Dawes
  • Date: 2011-01-05 21:54:47 UTC
  • mfrom: (777.1.2 fix-657850)
  • Revision ID: tarmac-20110105215447-kz7d2l1k5xkaolr6
Disable the couch checkboxes when replication is not available

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
dcouch = None
67
67
# Try importing the Ubuntu One desktopcouch enablement api
68
68
try:
69
 
    from desktopcouch.replication_services import ubuntuone as dcouch
 
69
    from desktopcouch.application.replication_services import (
 
70
        ubuntuone as dcouch)
70
71
except ImportError:
71
72
    logger.error("DesktopCouch replication API not found")
72
73
 
709
710
    def connect_desktopcouch_exclusion(self):
710
711
        """Hook up to desktopcouch enablement API, or disable the UI."""
711
712
        # Hook up to desktopcouch, or die trying
712
 
        if dcouch:
 
713
        try:
 
714
            if not dcouch:
 
715
                raise ValueError('Replication service not available.')
 
716
 
 
717
            # Check bindwood availability
713
718
            Thread(target=self.__check_for_bindwood).start()
714
719
 
 
720
            # Get the exclusion settings
715
721
            self.dcouch = dcouch.ReplicationExclusion()
716
722
            exclusions = self.dcouch.all_exclusions()
717
723
            for check in [self.bookmarks_check,
721
727
                    check.set_active(False)
722
728
                else:
723
729
                    check.set_active(True)
724
 
        else:
725
 
            self.bookmarks_check.set_sensitive(False)
726
 
            self.abook_check.set_sensitive(False)
727
 
            self.gwib_check.set_sensitive(False)
 
730
        except ValueError, e:
 
731
            # Replication is not avaialble, so disable the UI
 
732
            for check in [self.bookmarks_check,
 
733
                          self.abook_check,
 
734
                          self.gwib_check]:
 
735
                check.set_sensitive(False)
 
736
            logger.warning(e)
728
737
 
729
738
    def toggle_db_sync(self, dbname, disable=False):
730
739
        """