Skip to content

Commit

Permalink
Use :default instead of an empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Feb 6, 2019
1 parent 5311ae3 commit bbbe9a0
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/lib/y2network/widgets/firewall_zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,27 @@ def store
end

def store_zone
@interface.zone = @value if current_zone != @value
@interface.zone = converted_value if zone_changed?
@value
end

private

def converted_value
return "" if @value == :default
@value
end

def zone_changed?
@value && (current_zone.to_s != converted_value)
end

def current_zone_widget
return Empty() unless current_zone
label = current_zone ? current_zone : _("DEFAULT")

VBox(
VSpacing(1),
Label(_("Current ZONE (permanent config): %s") % current_zone)
Label(_("Current ZONE (permanent config): %s") % label)
)
end

Expand Down Expand Up @@ -105,7 +115,7 @@ def enable_zones(value)
# @return [Array <Array <String, String>>] list of names an description of
# known zones
def firewall_zones
zones = [["", _("Default")]]
zones = [[:default, _("Default")]]

if firewalld.installed?
firewalld.zones.each { |z| zones << [z.name, z.short] }
Expand Down

0 comments on commit bbbe9a0

Please sign in to comment.