diff -up firewalld-0.3.9/src/firewall-config.RHBZ#993655 firewalld-0.3.9/src/firewall-config
--- firewalld-0.3.9/src/firewall-config.RHBZ#993655 2014-09-29 20:29:37.428805049 +0200
+++ firewalld-0.3.9/src/firewall-config 2014-09-29 20:35:50.956700639 +0200
@@ -1230,7 +1230,7 @@ class FirewallConfig(object):
self.load_direct()
self.load_lockdown_whitelist()
- def load_zones(self):
+ def _update_zoneStore(self):
active_zone = self.get_active_zone()
if self.runtime_view:
@@ -1246,6 +1246,33 @@ class FirewallConfig(object):
selection.set_mode(Gtk.SelectionMode.NONE)
self.zoneStore.clear()
+
+ # zones
+ active_zones = self.fw.getActiveZones().keys()
+ for zone in zones:
+ if zone in active_zones:
+ self.zoneStore.append([zone, Pango.Weight.BOLD])
+ else:
+ self.zoneStore.append([zone, Pango.Weight.NORMAL])
+
+ if active_zone in zones:
+ _zone = active_zone
+ else:
+ _zone = self.defaultZoneLabel.get_text()
+
+ selection.set_mode(Gtk.SelectionMode.SINGLE)
+
+ iter = self.zoneStore.get_iter_first()
+ while iter:
+ if self.zoneStore.get_value(iter, 0) == _zone:
+ selection.select_iter(iter)
+ return
+ iter = self.zoneStore.iter_next(iter)
+ # fallback
+ selection.select_path(0)
+
+ def load_zones(self):
+ self.zoneStore.clear()
self.serviceStore.clear()
self.portStore.clear()
self.forwardStore.clear()
@@ -1269,28 +1296,7 @@ class FirewallConfig(object):
obj = self.fw.config().getIcmpType(item)
self.icmpStore.append([False, obj.get_property("name")])
- # zones
- for zone in zones:
- if zone == self.default_zone:
- self.zoneStore.append([zone, Pango.Weight.BOLD])
- else:
- self.zoneStore.append([zone, Pango.Weight.NORMAL])
-
- if active_zone in zones:
- _zone = active_zone
- else:
- _zone = self.defaultZoneLabel.get_text()
-
- selection.set_mode(Gtk.SelectionMode.SINGLE)
-
- iter = self.zoneStore.get_iter_first()
- while iter:
- if self.zoneStore.get_value(iter, 0) == _zone:
- selection.select_iter(iter)
- return
- iter = self.zoneStore.iter_next(iter)
- # fallback
- selection.select_path(0)
+ self._update_zoneStore()
def get_active_service(self):
selection = self.serviceConfServiceView.get_selection()
@@ -1580,6 +1586,7 @@ class FirewallConfig(object):
self._add_interface(interface)
def interface_removed_cb(self, zone, interface):
+ self.update_active_zones()
if not self.runtime_view or zone != self.get_active_zone():
return
iter = self.interfaceStore.get_iter_first()
@@ -1588,7 +1595,6 @@ class FirewallConfig(object):
self.interfaceStore.remove(iter)
break
iter = self.interfaceStore.iter_next(iter)
- self.update_active_zones()
def zone_of_interface_changed_cb(self, zone, interface):
self.update_active_zones()
@@ -1740,8 +1746,6 @@ class FirewallConfig(object):
self.load_lockdown_whitelist()
def update_active_zones(self):
- self.active_zones.clear()
-
# remove all entries for the left menu
left_menu_children = self.left_menu.get_children()
for child in left_menu_children:
@@ -1761,6 +1765,9 @@ class FirewallConfig(object):
if not self.fw.connected:
return
+ self._update_zoneStore()
+
+ self.active_zones.clear()
active_zones = self.fw.getActiveZones()
if active_zones:
self.active_zones = active_zones
@@ -1893,14 +1900,8 @@ class FirewallConfig(object):
new_default_zone != self.default_zone)
def default_zone_changed_cb(self, zone):
+ self.default_zone = zone
self.defaultZoneLabel.set_text(zone)
- iter = self.zoneStore.get_iter_first()
- while iter:
- if self.zoneStore.get_value(iter, 0) == zone:
- self.zoneStore.set_value(iter, 1, Pango.Weight.BOLD)
- else:
- self.zoneStore.set_value(iter, 1, Pango.Weight.NORMAL)
- iter = self.zoneStore.iter_next(iter)
def onChangeZone(self, *args):
active_zone = self.get_active_zone()