- Timestamp:
- 10/01/11 12:05:22 (2 years ago)
- Children:
- 178436daf1f6b1d9634d229404184532c8f23333
- Parents:
- 9cd11c02b25537ee501c8e398b6baeb2e6eb7bc7
- git-committer:
- Matias De la Puente <mfpuente.ar@…> (10/01/11 12:05:22)
- File:
-
- 1 edited
-
libi4uccore/settings.vala (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libi4uccore/settings.vala
r9cd11c0 r7960aa9 21 21 using Gee; 22 22 23 public class OptionSettings : GLib.Object 24 { 25 public string name { set; get; } 26 public string value { set; get; } 27 public bool active { set; get; } 28 29 public string to_xml (size_t tab_width) 30 { 31 var prefix = string.nfill (tab_width, '\t'); 32 var xml_str = "<option_value name=\"%s\" value=\"%s\" active=\"%s\"/>\n"; 33 return prefix + xml_str.printf (_name, _value, _active.to_string ()); 34 } 35 } 36 37 public class ProgrammerSettings : GLib.Object 38 { 39 private HashMap<string, OptionSettings> _options = new HashMap<string, OptionSettings> (); 40 41 public string name { set; get; } 42 public Gee.Map<string, OptionSettings> options { get { return _options; } } 43 44 public string to_xml (size_t tab_width) 45 { 46 var prefix = string.nfill (tab_width, '\t'); 47 var xml_str = prefix + "<programmer name=\"%s\">\n".printf (_name); 48 foreach (var option_settings in _options.values) 49 xml_str += option_settings.to_xml (tab_width+1); 50 xml_str += prefix + "</programmer>\n"; 51 return xml_str; 52 } 53 } 54 23 55 public class I4uc.Core.Settings : GLib.Object 24 56 { 57 private HashMap<string, ProgrammerSettings> _programmers = new HashMap<string, ProgrammerSettings> (); 58 25 59 public string working_folder { set; get; } 26 60 … … 44 78 // Programmers settings 45 79 public string programmer { set; get; default = ""; } 80 public Gee.Map<string, ProgrammerSettings> programmers { get { return _programmers; } } 46 81 47 82 public Settings () … … 72 107 73 108 // Programmers settings 74 xml_str += @"\t<programmer>$(_programmer)</programmer>\n"; 109 xml_str += @"\t<current_programmer>$(_programmer)</current_programmer>\n"; 110 111 xml_str += "\t<programmers>\n"; 112 foreach (var programmer in _programmers.values) 113 xml_str += programmer.to_xml (2); 114 xml_str += "\t</programmers>\n"; 75 115 76 116 return xml_str + "</settings>";
Note: See TracChangeset
for help on using the changeset viewer.

