440
447
"""Process the 'failure' and emit CredentialsError."""
441
448
self.CredentialsError(app_name, except_to_errdict(failure.value))
450
def _get_ref_count(self):
451
"""Get value of ref_count."""
452
logger.debug('ref_count is %r.', self._ref_count)
453
return self._ref_count
455
def _set_ref_count(self, new_value):
456
"""Set a new value to ref_count."""
457
logger.debug('ref_count is %r, changing value to %r.',
458
self._ref_count, new_value)
461
msg = 'Attempting to decrease ref_count to a negative value (%r).'
462
logger.warning(msg, new_value)
464
self._ref_count = new_value
466
if self._ref_count == 0:
467
self.timeout_func(TIMEOUT_INTERVAL, self.shutdown_func)
469
ref_count = property(fget=_get_ref_count, fset=_set_ref_count)
443
471
@dbus.service.signal(DBUS_CREDENTIALS_IFACE, signature='s')
444
472
def AuthorizationDenied(self, app_name):
445
473
"""Signal thrown when the user denies the authorization."""
446
475
logger.info('%s: emitting AuthorizationDenied with app_name "%s".',
447
476
self.__class__.__name__, app_name)
449
478
@dbus.service.signal(DBUS_CREDENTIALS_IFACE, signature='sa{ss}')
450
479
def CredentialsFound(self, app_name, credentials):
451
480
"""Signal thrown when the credentials are found."""
452
482
logger.info('%s: emitting CredentialsFound with app_name "%s".',
453
483
self.__class__.__name__, app_name)
455
485
@dbus.service.signal(DBUS_CREDENTIALS_IFACE, signature='s')
456
486
def CredentialsNotFound(self, app_name):
457
487
"""Signal thrown when the credentials are not found."""
458
489
logger.info('%s: emitting CredentialsNotFound with app_name "%s".',
459
490
self.__class__.__name__, app_name)
461
492
@dbus.service.signal(DBUS_CREDENTIALS_IFACE, signature='s')
462
493
def CredentialsCleared(self, app_name):
463
494
"""Signal thrown when the credentials were cleared."""
464
496
logger.info('%s: emitting CredentialsCleared with app_name "%s".',
465
497
self.__class__.__name__, app_name)
467
499
@dbus.service.signal(DBUS_CREDENTIALS_IFACE, signature='s')
468
500
def CredentialsStored(self, app_name):
469
501
"""Signal thrown when the credentials were cleared."""
470
503
logger.info('%s: emitting CredentialsStored with app_name "%s".',
471
504
self.__class__.__name__, app_name)
473
506
@dbus.service.signal(DBUS_CREDENTIALS_IFACE, signature='sa{ss}')
474
507
def CredentialsError(self, app_name, error_dict):
475
508
"""Signal thrown when there is a problem getting the credentials."""
476
510
logger.error('%s: emitting CredentialsError with app_name "%s" and '
477
511
'error_dict %r.', self.__class__.__name__, app_name,