_moduleLogger = logging.getLogger("dc_glade")
+PROFILE_STARTUP = False
def getmtime_nothrow(path):
ACCOUNT_TAB = 4
NULL_BACKEND = 0
+ # 1 Was GrandCentral support so the gap was maintained for compatibility
GV_BACKEND = 2
BACKENDS = (NULL_BACKEND, GV_BACKEND)
)
)
- backgroundSetup = threading.Thread(target=self._idle_setup)
- backgroundSetup.setDaemon(True)
- backgroundSetup.start()
+ if not PROFILE_STARTUP:
+ backgroundSetup = threading.Thread(target=self._idle_setup)
+ backgroundSetup.setDaemon(True)
+ backgroundSetup.start()
+ else:
+ self._idle_setup()
def _idle_setup(self):
"""
try:
import alarm_handler
- self._alarmHandler = alarm_handler.AlarmHandler()
+ if alarm_handler.AlarmHandler is not alarm_handler._NoneAlarmHandler:
+ self._alarmHandler = alarm_handler.AlarmHandler()
+ else:
+ self._alarmHandler = None
except (ImportError, OSError):
alarm_handler = None
except Exception:
with gtk_toolbox.gtk_lock():
self._errorDisplay.push_exception()
alarm_handler = None
+ if alarm_handler is None:
_moduleLogger.warning("No notification support")
if hildonize.IS_HILDON_SUPPORTED:
try:
with gtk_toolbox.gtk_lock():
self._errorDisplay.push_exception()
finally:
- self._spawn_attempt_login(2)
+ self._spawn_attempt_login()
def _spawn_attempt_login(self, *args):
self._loginSink.send(args)
- def _attempt_login(self, numOfAttempts = 10, force = False):
+ def _attempt_login(self, force = False):
"""
@note This must be run outside of the UI lock
"""
try:
- assert 0 <= numOfAttempts, "That was pointless having 0 or less login attempts"
assert self._initDone, "Attempting login before app is fully loaded"
serviceId = self.NULL_BACKEND
loggedIn = False
- if not force:
+ if not force and self._defaultBackendId != self.NULL_BACKEND:
with gtk_toolbox.gtk_lock():
banner = hildonize.show_busy_banner_start(self._window, "Logging In...")
try:
hildonize.show_busy_banner_end(banner)
if not loggedIn:
- loggedIn, serviceId = self._login_by_user(numOfAttempts)
+ loggedIn, serviceId = self._login_by_user()
with gtk_toolbox.gtk_lock():
self._change_loggedin_status(serviceId)
_moduleLogger.info("Logged into %r through settings" % self._phoneBackends[self._defaultBackendId])
return loggedIn
- def _login_by_user(self, numOfAttempts):
+ def _login_by_user(self):
"""
@note This must be run outside of the UI lock
"""
loggedIn, (username, password) = False, self._credentials
tmpServiceId = self.GV_BACKEND
- for attemptCount in xrange(numOfAttempts):
- if loggedIn:
- break
+ while not loggedIn:
with gtk_toolbox.gtk_lock():
credentials = self._credentialsDialog.request_credentials(
defaultCredentials = self._credentials
if not self._phoneBackends[tmpServiceId].get_callback_number():
# subtle reminder to the users to configure things
self._notebook.set_current_page(self.ACCOUNT_TAB)
+
banner = hildonize.show_busy_banner_start(self._window, "Logging In...")
try:
username, password = credentials
self._credentials = username, password
_moduleLogger.info("Logged into %r through user request" % self._phoneBackends[serviceId])
else:
+ # Hint to the user that they are not logged in
serviceId = self.NULL_BACKEND
self._notebook.set_current_page(self.ACCOUNT_TAB)
@note UI Thread
"""
try:
- self._defaultBackendId = config.getint(constants.__pretty_app_name__, "active")
+ if not PROFILE_STARTUP:
+ self._defaultBackendId = config.getint(constants.__pretty_app_name__, "active")
+ else:
+ self._defaultBackendId = self.NULL_BACKEND
blobs = (
config.get(constants.__pretty_app_name__, "bin_blob_%i" % i)
for i in xrange(len(self._credentials))
"""
@note Thread Agnostic
"""
+ # Because we now only support GVoice, if there are user credentials,
+ # always assume its using the GVoice backend
+ if self._credentials[0] and self._credentials[1]:
+ backend = self.GV_BACKEND
+ else:
+ backend = self.NULL_BACKEND
+
config.add_section(constants.__pretty_app_name__)
- config.set(constants.__pretty_app_name__, "active", str(self._selectedBackendId))
+ config.set(constants.__pretty_app_name__, "active", str(backend))
config.set(constants.__pretty_app_name__, "orientation", str(int(gtk_toolbox.get_screen_orientation())))
for i, value in enumerate(self._credentials):
blob = base64.b64encode(value)
if status == conic.STATUS_CONNECTED:
if self._initDone:
- self._spawn_attempt_login(2)
+ self._spawn_attempt_login()
elif status == conic.STATUS_DISCONNECTED:
if self._initDone:
self._defaultBackendId = self._selectedBackendId
self._contactsViews[self._selectedBackendId].clear()
self._change_loggedin_status(self.NULL_BACKEND)
- self._spawn_attempt_login(2, True)
+ self._spawn_attempt_login(True)
except Exception, e:
self._errorDisplay.push_exception()
if hildonize.IS_HILDON_SUPPORTED:
gtk.set_application_name(constants.__pretty_app_name__)
handle = Dialcentral()
- gtk.main()
+ if not PROFILE_STARTUP:
+ gtk.main()
class DummyOptions(object):