[PATCH f19-branch] Network spoke: improve Add bond/vlan device dialog behaviour
Radek Vykydal
rvykydal at redhat.com
Fri Jun 14 13:20:44 UTC 2013
Make add bond/vlan dialog modal and decorated. I don't want to use lightbox
here because in the next step nm-c-e window is open which we don't lightbox.
One of reasons for this is nmce (a separate process) dialog window stacking
problems - see bug #972959. I address the stacking problem here in a similar
way as in the #972959 - by killing hidden nm-c-e on following (Add device) try.
old behaviour:
http://rvykydal.fedorapeople.org/current_add_device.webm
- the Add device dialog is not modal
- the Add device dialog looks bad with no decoration without lightbox
- if following nm-c-e dialog is hidden (click on spoke/hub), there
is no remedy (+ button is insensitive)
new behaviour:
http://rvykydal.fedorapeople.org/patched_add_device.webm
- if nm-c-e is hidden, another click on + button to start adding device
again is possible
---
pyanaconda/ui/gui/spokes/network.glade | 2 +-
pyanaconda/ui/gui/spokes/network.py | 18 ++++++++++++------
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/network.glade b/pyanaconda/ui/gui/spokes/network.glade
index 4e1ac74..e2bc72f 100644
--- a/pyanaconda/ui/gui/spokes/network.glade
+++ b/pyanaconda/ui/gui/spokes/network.glade
@@ -6,8 +6,8 @@
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Add device</property>
+ <property name="modal">True</property>
<property name="type_hint">dialog</property>
- <property name="decorated">False</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index e6371b7..56fb0cb 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -222,10 +222,11 @@ class NetworkControlBox(object):
NetworkManager.DeviceType.VLAN,
]
- def __init__(self, builder):
+ def __init__(self, builder, spoke=None):
self.builder = builder
self._running_nmce = None
+ self.spoke = spoke
# button for creating of virtual bond and vlan devices
self.builder.get_object("add_toolbutton").set_sensitive(True)
@@ -519,6 +520,8 @@ class NetworkControlBox(object):
def on_add_device_clicked(self, *args):
dialog = self.builder.get_object("add_device_dialog")
+ if self.spoke:
+ dialog.set_transient_for(self.spoke.window)
rc = dialog.run()
dialog.hide()
if rc == 1:
@@ -529,14 +532,17 @@ class NetworkControlBox(object):
def add_device(self, type):
log.info("network: adding device of type %s" % type)
- self.builder.get_object("add_toolbutton").set_sensitive(False)
+ self.kill_nmce(msg="Add device button clicked")
proc = subprocess.Popen(["nm-connection-editor", "--create", "--type=%s" % type])
+ self._running_nmce = proc
GLib.child_watch_add(proc.pid, self.on_nmce_adding_exited)
def on_nmce_adding_exited(self, pid, condition):
- self.builder.get_object("add_toolbutton").set_sensitive(True)
- network.logIfcfgFiles("nm-c-e run")
+ if condition == 0:
+ if self._running_nmce and self._running_nmce.pid == pid:
+ self._running_nmce = None
+ network.logIfcfgFiles("nm-c-e run")
def selected_device(self):
selection = self.builder.get_object("treeview_devices").get_selection()
@@ -1106,7 +1112,7 @@ class NetworkSpoke(NormalSpoke):
def __init__(self, *args, **kwargs):
NormalSpoke.__init__(self, *args, **kwargs)
- self.network_control_box = NetworkControlBox(self.builder)
+ self.network_control_box = NetworkControlBox(self.builder, spoke=self)
self.network_control_box.hostname = self.data.network.hostname
self.network_control_box.client.connect("notify::%s" %
NMClient.CLIENT_STATE,
@@ -1248,7 +1254,7 @@ class NetworkStandaloneSpoke(StandaloneSpoke):
def __init__(self, *args, **kwargs):
StandaloneSpoke.__init__(self, *args, **kwargs)
- self.network_control_box = NetworkControlBox(self.builder)
+ self.network_control_box = NetworkControlBox(self.builder, spoke=self)
self.network_control_box.hostname = self.data.network.hostname
parent = self.builder.get_object("AnacondaStandaloneWindow-action_area5")
parent.add(self.network_control_box.vbox)
--
1.7.11.7
More information about the anaconda-patches
mailing list