lib/alexandria/preferences.rb in alexandria-book-collection-manager-0.7.8 vs lib/alexandria/preferences.rb in alexandria-book-collection-manager-0.7.9

- old
+ new

@@ -133,23 +133,21 @@ ## GCONFTOOL SET and SET LIST and SET PAIR and UNSET ## def get_gconf_type(value) case value - when String - "string" when Integer "int" when TrueClass, FalseClass "bool" else "string" end end def exec_gconf_set_list(var_path, new_list) - # NOTE we must check between list and pair... + # NOTE: we must check between list and pair... list_type = get_gconf_type(new_list.first) if list_type == "int" && new_list.size == 2 # treat this as a pair of int a = new_list[0] @@ -236,14 +234,14 @@ # Make a judgement about the type of the settings we get back from # gconftool. This is not fool-proof, but it *does* work for the # range of values used by Alexandria. def discriminate(value) case value - when "true" # bool + when "true" # bool true - when "false" # bool + when "false" # bool false - when /^[0-9]+$/ # int + when /^-?[0-9]+$/ # int value.to_i when /^\[(.*)\]$/ # list (assume of type String) Regexp.last_match[1].split(",") when /^\((.*)\)$/ # pair (assume of type int) begin