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

[PATCH newui] Embed nm-c-e into UIObject with gtk.Socket



Requires patch in nm-c-e: --socket XID option that would place
nm-c-e window in plug connected to XID.
---
 pyanaconda/ui/gui/hubs/__init__.py  |    2 --
 pyanaconda/ui/gui/spokes/network.py |   22 ++++++++++++++++------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py
index d18b2b6..40cc6ef 100644
--- a/pyanaconda/ui/gui/hubs/__init__.py
+++ b/pyanaconda/ui/gui/hubs/__init__.py
@@ -100,9 +100,7 @@ class Hub(UIObject):
         # signals from going to the underlying (but still displayed) Hub and
         # prevent the user from switching away.  It's up to the spoke's back
         # button handler to kill its own layer of main loop.
-        self.window.hide()
         Gtk.main()
-        self.window.show()
         action.apply()
 
     def _createBox(self):
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index 9394037..e0ed369 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -1066,18 +1066,28 @@ class NMCEEmbedder(UIObject):
     builderObjects = ["nmceEmbedder"]
     mainWidgetName = "nmceEmbedder"
     uiFile = "spokes/network.ui"
+
     def run(self, spoke, uuid):
+        socket = Gtk.Socket()
+        self.window.add(socket)
+
         from gi.repository import AnacondaWidgets
         self.lb = AnacondaWidgets.lb_show_over(spoke)
+        self.window.set_transient_for(self.lb)
+
+        socket.connect("plug-removed", self.on_plug_removed)
+        #socket.connect("plug-added", self.display)
+
+        socket_id = socket.get_id()
 
-        self.lb.set_keep_below(True)
-        spoke.set_keep_below(True)
+        proc = subprocess.Popen(["/home/rvykydal/work/newui/anaconda/nm-connection-editor", "--edit", "%s" % uuid, "--socket", "%d" % socket_id])
+        GLib.timeout_add(2000, self.display)
 
-        proc = subprocess.Popen(["nm-connection-editor", "--edit", "%s" %
-                                  uuid])
-        GLib.child_watch_add(proc.pid, self.on_nmce_exited)
+    def display(self, *args):
+        self.window.show_all()
 
-    def on_nmce_exited(self, pid, condition):
+    def on_plug_removed(self, *args):
+        self.window.destroy()
         self.lb.destroy()
 
 if __name__ == "__main__":
-- 
1.7.7.5


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