mirror of
https://github.com/jtgans/g13gui.git
synced 2025-06-20 08:23:50 -04:00
applet: Rework how manager pings work
This swaps to notifying the applet internally when registration is lost after a ping fails.
This commit is contained in:
parent
298cefe9c2
commit
c336d9c4cf
@ -57,15 +57,22 @@ class Applet(dbus.service.Object):
|
|||||||
|
|
||||||
def _ping(self):
|
def _ping(self):
|
||||||
if self._manager:
|
if self._manager:
|
||||||
|
result = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._manager.Ping()
|
result = self._manager.Ping()
|
||||||
except DBusException as err:
|
except DBusException as err:
|
||||||
print('Lost connection with AppletManager: %s' % err)
|
print('Lost connection with AppletManager: %s' % err)
|
||||||
self._registered = False
|
self._registered = False
|
||||||
|
|
||||||
GLib.idle_add(self.onUnregistered)
|
GLib.idle_add(self.onUnregistered)
|
||||||
GLib.timeout_add_seconds(1, self.register)
|
GLib.timeout_add_seconds(1, self.register)
|
||||||
|
return False
|
||||||
|
|
||||||
|
if not result:
|
||||||
|
print('Lost registration with AppletManager')
|
||||||
|
self._registered = False
|
||||||
|
GLib.idle_add(self.onUnregistered)
|
||||||
|
GLib.timeout_add_seconds(1, self.register)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user