[rygel/config] Add get_int_list method to Configuration class



commit c78d2522e8a5234773d0d984c25a49a3f082ab37
Author: Jens Georg <mail jensge org>
Date:   Wed May 27 23:07:54 2009 +0200

    Add get_int_list method to Configuration class
---
 src/rygel/rygel-configuration.vala |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/rygel/rygel-configuration.vala b/src/rygel/rygel-configuration.vala
index b4f00df..bc569ed 100644
--- a/src/rygel/rygel-configuration.vala
+++ b/src/rygel/rygel-configuration.vala
@@ -176,6 +176,27 @@ public class Rygel.Configuration {
         return val;
     }
 
+    public Gee.ArrayList<int> get_int_list (string section,
+                                            string key) {
+        var int_list = new Gee.ArrayList<int> ();
+        var path = ROOT_GCONF_PATH + section + "/" + key;
+
+        try {
+            unowned SList<int> ints = this.gconf.get_list (
+                                                    path,
+                                                    GConf.ValueType.INT);
+            if (ints != null) {
+                foreach (var num in ints) {
+                    int_list.add (num);
+                }
+            }
+        } catch (GLib.Error error) {
+            warning ("Failed to get value for key: %s", path);
+        }
+
+        return int_list;
+    }
+
     public bool get_bool (string section,
                           string key,
                           bool   default_value) {



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