[rygel/config] Define constants for known keys.



commit 6285f4e2eaaf2df194f67e199df1630b85d086d1
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Apr 21 19:26:04 2009 +0300

    Define constants for known keys.
---
 src/rygel/rygel-config-reader.vala |   13 ++++++++++---
 src/ui/rygel-config-editor.vala    |    6 +++---
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/rygel/rygel-config-reader.vala b/src/rygel/rygel-config-reader.vala
index e955c63..1dff34b 100644
--- a/src/rygel/rygel-config-reader.vala
+++ b/src/rygel/rygel-config-reader.vala
@@ -30,6 +30,9 @@ using CStuff;
  */
 public class Rygel.ConfigReader {
     protected static const string ROOT_GCONF_PATH = "/apps/rygel/";
+    protected static const string IP_KEY = "host-ip";
+    protected static const string PORT_KEY = "port";
+    protected static const string XBOX_KEY = "enable-xbox";
 
     protected GConf.Client gconf;
 
@@ -40,9 +43,13 @@ public class Rygel.ConfigReader {
     public ConfigReader () {
         this.gconf = GConf.Client.get_default ();
 
-        this.enable_xbox = this.get_bool ("general", "enable-xbox", false);
-        this.host_ip = this.get_string ("general", "host-ip", null);
-        this.port = this.get_int ("general", "port", uint16.MIN, uint16.MAX, 0);
+        this.enable_xbox = this.get_bool ("general", XBOX_KEY, false);
+        this.host_ip = this.get_string ("general", IP_KEY, null);
+        this.port = this.get_int ("general",
+                                  PORT_KEY,
+                                  uint16.MIN,
+                                  uint16.MAX,
+                                  0);
     }
 
     public string get_title (string section) {
diff --git a/src/ui/rygel-config-editor.vala b/src/ui/rygel-config-editor.vala
index b989fc9..0d870b2 100644
--- a/src/ui/rygel-config-editor.vala
+++ b/src/ui/rygel-config-editor.vala
@@ -34,15 +34,15 @@ public class Rygel.ConfigEditor : ConfigReader {
     }
 
     public void set_host_ip (string ip) {
-        this.set_string ("general", "host-ip", ip);
+        this.set_string ("general", IP_KEY, ip);
     }
 
     public void set_port (uint16 port) {
-        this.set_int ("general", "port", port);
+        this.set_int ("general", PORT_KEY, port);
     }
 
     public void set_enable_xbox (bool enabled) {
-        this.set_bool ("general", "enable-xbox", enabled);
+        this.set_bool ("general", XBOX_KEY, enabled);
     }
 
     public void set_title (string section, string title) {



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