core: Handle int list options
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Thu, 11 Jun 2009 20:01:21 +0000 (23:01 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Fri, 12 Jun 2009 11:41:02 +0000 (14:41 +0300)
src/rygel/rygel-cmdline-config.vala

index 11494ed..e433184 100644 (file)
@@ -253,7 +253,27 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration {
     public Gee.ArrayList<int> get_int_list (string section,
                                             string key)
                                             throws GLib.Error {
-        throw new ConfigurationError.NO_VALUE_SET ("No value available");
+        ArrayList<int> value = null;
+        foreach (var option in plugin_options) {
+            var tokens = option.split (":", 3);
+            if (tokens[0] != null &&
+                tokens[1] != null &&
+                tokens[2] != null &&
+                tokens[0] == section &&
+                tokens[1] == key) {
+                value = new ArrayList<int> ();
+                foreach (var val_token in tokens[2].split (",", -1)) {
+                    value.add (val_token.to_int ());
+                }
+                break;
+            }
+        }
+
+        if (value != null) {
+            return value;
+        } else {
+            throw new ConfigurationError.NO_VALUE_SET ("No value available");
+        }
     }
 
     public bool get_bool (string section,