[Libguestfs] [PATCH 17/61] P2V: main - add DBus thread, fake Gtk main loop and timed thread with exit

Maros Zatko mzatko at redhat.com
Wed Feb 12 14:30:29 UTC 2014


---
 p2v/client/lib/virt-p2v/ui/main.rb | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/p2v/client/lib/virt-p2v/ui/main.rb b/p2v/client/lib/virt-p2v/ui/main.rb
index 5717c5d..10dd2d7 100644
--- a/p2v/client/lib/virt-p2v/ui/main.rb
+++ b/p2v/client/lib/virt-p2v/ui/main.rb
@@ -283,11 +283,22 @@ class NewMain < Main
     })
 
     # let's try to recieve some more of NMs signals
-    session_bus = DBus::SystemBus.instance
-
-    db_main = DBus::Main.new
-    db_main << session_bus
-    db_main.run
+    Thread.new {
+      session_bus = DBus::SystemBus.instance
+
+      db_main = DBus::Main.new
+      db_main << session_bus
+      db_main.run
+    }
+
+    Thread.new {
+      (0..200).each {
+        sleep 0.1
+      }
+      exit(0)
+    }
+
+    Gtk.main_with_queue 100
 
 #    # TODO: this activation in NOT neccessary
 #    # since it's done automatically in network module
-- 
1.8.3.1




More information about the Libguestfs mailing list