Rename the connected property to 'online'

We're using connected for the bluez property, so let's not clash with that
pull/145/head
Peter Hutterer 2019-07-11 15:45:48 +10:00
parent fdade5529d
commit d97c5eaaac
2 changed files with 12 additions and 12 deletions

View File

@ -50,7 +50,7 @@ class _DBusObject(GObject.Object):
self.interface = interface
self.objpath = objpath
self._connected = False
self._online = False
self._name = name
try:
self._connect()
@ -66,8 +66,8 @@ class _DBusObject(GObject.Object):
if self.proxy.get_name_owner() is None:
raise DBusError(f'No-one is handling {self._name}, is the daemon running?')
self._connected = True
self.notify('connected')
self._online = True
self.notify('online')
except GLib.Error as e:
if (e.domain == 'g-io-error-quark' and
e.code == Gio.IOErrorEnum.DBUS_ERROR):
@ -87,8 +87,8 @@ class _DBusObject(GObject.Object):
return True
@GObject.Property
def connected(self):
return self._connected
def online(self):
return self._online
def _connect_to_session(self):
try:
@ -297,13 +297,13 @@ class TuhiKeteManager(_DBusObject):
self._unregistered_devices = {}
logger.info('starting up')
if not self.connected:
self.connect('notify::connected', self._init)
if not self.online:
self.connect('notify::online', self._init)
else:
self._init()
def _init(self, *args, **kwargs):
logger.info('connected')
logger.info('online')
for objpath in self.property('Devices'):
device = TuhiKeteDevice(self, objpath)
self._devices[device.address] = device

View File

@ -40,14 +40,14 @@ class MainWindow(Gtk.ApplicationWindow):
self.stack_perspectives.set_visible_child_name(ep.name)
# the dbus bindings need more async...
if not self._tuhi.connected:
self._tuhi.connect('notify::connected', self._on_dbus_connected)
if not self._tuhi.online:
self._tuhi.connect('notify::online', self._on_dbus_online)
else:
self._on_dbus_connected()
self._on_dbus_online()
self._add_primary_menu()
def _on_dbus_connected(self, *args, **kwargs):
def _on_dbus_online(self, *args, **kwargs):
dp = DrawingPerspective()
self._add_perspective(dp)