[rygel] core: Handle string list options



commit d9ce5546937b07be620dc280ac63997394675d3f
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Jun 11 19:59:11 2009 +0300

    core: Handle string list options
    
    So now you can tell Rygel to export URIs through commandline:
    
    rygel -o MediaExport:uris:file:////path/to/some.mp3,http:////path/to/some.ogg
    
    Yes, yes it's ugly but how do you handle dynamic (plugin) options?

 src/rygel/rygel-cmdline-config.vala |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/rygel/rygel-cmdline-config.vala b/src/rygel/rygel-cmdline-config.vala
index 896ab93..11494ed 100644
--- a/src/rygel/rygel-cmdline-config.vala
+++ b/src/rygel/rygel-cmdline-config.vala
@@ -23,6 +23,7 @@
  */
 
 using CStuff;
+using Gee;
 
 public errordomain Rygel.CmdlineConfigError {
     VERSION_ONLY
@@ -197,7 +198,27 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration {
     public Gee.ArrayList<string> get_string_list (string section,
                                                   string key)
                                                   throws GLib.Error {
-        throw new ConfigurationError.NO_VALUE_SET ("No value available");
+        ArrayList<string> 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<string> ();
+                foreach (var val_token in tokens[2].split (",", -1)) {
+                    value.add (val_token);
+                }
+                break;
+            }
+        }
+
+        if (value != null) {
+            return value;
+        } else {
+            throw new ConfigurationError.NO_VALUE_SET ("No value available");
+        }
     }
 
     public int get_int (string section,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]