[rygel/config] Introducing GeneralPrefVBox.



commit 8bd2443f5485ad956e53f78a35655f93512d3c1f
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Apr 22 18:48:28 2009 +0300

    Introducing GeneralPrefVBox.
    
    Put the code specific to general preferences into a separate subclass:
    GeneralPrefVBox.
---
 src/ui/Makefile.am                   |    3 ++
 src/ui/rygel-general-pref-vbox.vala  |   44 ++++++++++++++++++++++++++++++++++
 src/ui/rygel-preferences-dialog.vala |    2 +-
 src/ui/rygel-preferences-vbox.vala   |   23 ++++--------------
 4 files changed, 53 insertions(+), 19 deletions(-)

diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index 2552676..a153ffe 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -23,12 +23,15 @@ bin_PROGRAMS = rygel-preferences
 BUILT_SOURCES = rygel.stamp \
 		rygel-preferences-dialog.c \
 		rygel-preferences-vbox.c \
+		rygel-general-pref-vbox.c \
 		rygel-config-editor.c
 
 rygel_preferences_SOURCES = rygel-preferences-dialog.c \
 			    rygel-preferences-dialog.vala \
 				rygel-preferences-vbox.c \
 				rygel-preferences-vbox.vala \
+		            rygel-general-pref-vbox.c \
+		            rygel-general-pref-vbox.vala \
 			    rygel-config-editor.c \
 			    rygel-config-editor.vala
 
diff --git a/src/ui/rygel-general-pref-vbox.vala b/src/ui/rygel-general-pref-vbox.vala
new file mode 100644
index 0000000..7894309
--- /dev/null
+++ b/src/ui/rygel-general-pref-vbox.vala
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation, all rights reserved.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
+ *                               <zeeshan ali nokia com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+using Gtk;
+
+public class Rygel.GeneralPrefVBox : PreferencesVBox {
+    public GeneralPrefVBox (ConfigEditor config_editor) {
+        base (config_editor, "general", "General");
+
+        this.add_string_pref (ConfigReader.IP_KEY,
+                              "IP",
+                              this.config_editor.host_ip,
+                              "The IP to advertise the UPnP MediaServer on");
+        this.add_int_pref (ConfigReader.PORT_KEY,
+                           "Port",
+                           this.config_editor.port,
+                           uint16.MIN,
+                           uint16.MAX,
+                           "The port to advertise the UPnP MediaServer on");
+        this.add_boolean_pref (ConfigReader.XBOX_KEY,
+                               "XBox support",
+                               this.config_editor.enable_xbox,
+                               "Enable Xbox support");
+    }
+}
diff --git a/src/ui/rygel-preferences-dialog.vala b/src/ui/rygel-preferences-dialog.vala
index 5efedcf..7178684 100644
--- a/src/ui/rygel-preferences-dialog.vala
+++ b/src/ui/rygel-preferences-dialog.vala
@@ -32,7 +32,7 @@ public class Rygel.PreferencesDialog : Dialog {
 
         this.notebook = new Notebook ();
 
-        var pref_vbox = new PreferencesVBox (config_editor);
+        var pref_vbox = new GeneralPrefVBox (config_editor);
         var label = new Label (pref_vbox.title);
         this.notebook.append_page (pref_vbox, label);
 
diff --git a/src/ui/rygel-preferences-vbox.vala b/src/ui/rygel-preferences-vbox.vala
index 7c5e023..51ce1b6 100644
--- a/src/ui/rygel-preferences-vbox.vala
+++ b/src/ui/rygel-preferences-vbox.vala
@@ -28,26 +28,13 @@ public class Rygel.PreferencesVBox : VBox {
     public string title;
     public string section;
 
-    public PreferencesVBox (ConfigEditor config_editor) {
-        this.section = "general";
-        this.title = "General";
+    public PreferencesVBox (ConfigEditor config_editor,
+                            string       title,
+                            string       section) {
+        this.section = section;
+        this.title = title;
 
         this.config_editor = config_editor;
-
-        this.add_string_pref (ConfigReader.IP_KEY,
-                              "IP",
-                              this.config_editor.host_ip,
-                              "The IP to advertise the UPnP MediaServer on");
-        this.add_int_pref (ConfigReader.PORT_KEY,
-                           "Port",
-                           this.config_editor.port,
-                           uint16.MIN,
-                           uint16.MAX,
-                           "The port to advertise the UPnP MediaServer on");
-        this.add_boolean_pref (ConfigReader.XBOX_KEY,
-                               "XBox support",
-                               this.config_editor.enable_xbox,
-                               "Enable Xbox support");
     }
 
     protected void add_string_pref (string  name,



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