[gnome-keysign: 42/65] send: when BluetoothOffer finish we restart it



commit 9aebd2a20a0bbf84ab4065f3c2a19df08f7d972e
Author: RyuzakiKK <aasonykk gmail com>
Date:   Mon Aug 21 12:06:35 2017 +0200

    send: when BluetoothOffer finish we restart it
    
    If we don't do this, after a first successful Bluetooth connection the
    sender will no longer be able to send the key with Bluetooth.

 keysign/send.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/keysign/send.py b/keysign/send.py
index 94f416d..2d24d4f 100755
--- a/keysign/send.py
+++ b/keysign/send.py
@@ -102,9 +102,7 @@ class SendApp:
                 discovery_list.append(bt_data)
         discovery_data = ";".join(discovery_list)
         if bt_data:
-            # We ignore the result of the defer because we don't have
-            # a result page
-            self.bt_offer.start()
+            self.bt_offer.start().addCallback(self._restart_bluetooth)
         else:
             log.info("Bluetooth as been skipped")
         log.info("Use this for discovering the other key: %r", discovery_data)
@@ -138,6 +136,10 @@ class SendApp:
             self.bt_offer = None
         log.debug("Stopped network services")
 
+    def _restart_bluetooth(self, _):
+        log.info("Bluetooth as been restarted")
+        self.bt_offer.start().addCallback(self._restart_bluetooth)
+
 
 class App(Gtk.Application):
     def __init__(self, *args, **kwargs):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]