[rygel] Configuration is grouped sections



commit e3b32b28f1c8d96be605d0344137973c1234337a
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sun May 3 00:18:22 2009 +0300

    Configuration is grouped sections
    
    Configuration is now grouped in sections rather than pages.
---
 src/ui/Makefile.am                                 |   18 ++++++++--------
 ...f-page.vala => rygel-general-pref-section.vala} |    6 ++--
 ...ef-page.vala => rygel-plugin-pref-section.vala} |   22 ++++++++++----------
 src/ui/rygel-preferences-dialog.vala               |   22 ++++++++++++-------
 ...es-page.vala => rygel-preferences-section.vala} |   10 ++++----
 5 files changed, 42 insertions(+), 36 deletions(-)

diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index 887d645..277a533 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -22,18 +22,18 @@ bin_PROGRAMS = rygel-preferences
 
 BUILT_SOURCES = rygel.stamp \
 		rygel-preferences-dialog.c \
-		rygel-preferences-page.c \
-		rygel-general-pref-page.c \
-		rygel-plugin-pref-page.c
+		rygel-preferences-section.c \
+		rygel-general-pref-section.c \
+		rygel-plugin-pref-section.c
 
 rygel_preferences_SOURCES = rygel-preferences-dialog.c \
 			    rygel-preferences-dialog.vala \
-			    rygel-preferences-page.c \
-			    rygel-preferences-page.vala \
-			    rygel-general-pref-page.c \
-			    rygel-general-pref-page.vala \
-			    rygel-plugin-pref-page.c \
-			    rygel-plugin-pref-page.vala
+			    rygel-preferences-section.c \
+			    rygel-preferences-section.vala \
+			    rygel-general-pref-section.c \
+			    rygel-general-pref-section.vala \
+			    rygel-plugin-pref-section.c \
+			    rygel-plugin-pref-section.vala
 
 rygel.stamp: $(filter %.vala,$(rygel_preferences_SOURCES))
 	$(VALAC) -C --vapidir=$(rygeldir) \
diff --git a/src/ui/rygel-general-pref-page.vala b/src/ui/rygel-general-pref-section.vala
similarity index 94%
rename from src/ui/rygel-general-pref-page.vala
rename to src/ui/rygel-general-pref-section.vala
index 7e91892..7eccc43 100644
--- a/src/ui/rygel-general-pref-page.vala
+++ b/src/ui/rygel-general-pref-section.vala
@@ -22,7 +22,7 @@
  */
 using Gtk;
 
-public class Rygel.GeneralPrefPage : PreferencesPage {
+public class Rygel.GeneralPrefSection : PreferencesSection {
     const string IP_ENTRY = "ip-entry";
     const string PORT_SPINBUTTON = "port-spinbutton";
     const string TRANS_CHECKBUTTON = "transcoding-checkbutton";
@@ -39,8 +39,8 @@ public class Rygel.GeneralPrefPage : PreferencesPage {
     private CheckButton mp2ts_check;
     private CheckButton lpcm_check;
 
-    public GeneralPrefPage (Builder       builder,
-                            Configuration config) throws Error {
+    public GeneralPrefSection (Builder       builder,
+                               Configuration config) throws Error {
         base (config, "general");
 
         this.ip_entry = (Entry) builder.get_object (IP_ENTRY);
diff --git a/src/ui/rygel-plugin-pref-page.vala b/src/ui/rygel-plugin-pref-section.vala
similarity index 75%
rename from src/ui/rygel-plugin-pref-page.vala
rename to src/ui/rygel-plugin-pref-section.vala
index 214b633..5a37329 100644
--- a/src/ui/rygel-plugin-pref-page.vala
+++ b/src/ui/rygel-plugin-pref-section.vala
@@ -22,36 +22,36 @@
  */
 using Gtk;
 
-public class Rygel.PluginPrefPage : PreferencesPage {
+public class Rygel.PluginPrefSection : PreferencesSection {
     const string ENABLED_CHECK = "-enabled-checkbutton";
     const string TITLE_ENTRY = "-title-entry";
 
     private CheckButton enabled_check;
     private Entry title_entry;
 
-    public PluginPrefPage (Builder       builder,
-                           Configuration config,
-                           string        section) {
-        base (config, section);
+    public PluginPrefSection (Builder       builder,
+                              Configuration config,
+                              string        name) {
+        base (config, name);
 
-        this.enabled_check = (CheckButton) builder.get_object (section.down () +
+        this.enabled_check = (CheckButton) builder.get_object (name.down () +
                                                                ENABLED_CHECK);
         assert (this.enabled_check != null);
-        this.title_entry = (Entry) builder.get_object (section.down () +
+        this.title_entry = (Entry) builder.get_object (name.down () +
                                                        TITLE_ENTRY);
         assert (this.title_entry != null);
 
-        this.enabled_check.active = config.get_enabled (section);
-        this.title_entry.set_text (config.get_title (section));
+        this.enabled_check.active = config.get_enabled (name);
+        this.title_entry.set_text (config.get_title (name));
 
         this.enabled_check.toggled += this.on_enabled_check_toggled;
     }
 
     public override void save () {
-        this.config.set_bool (this.section,
+        this.config.set_bool (this.name,
                               Configuration.ENABLED_KEY,
                               this.enabled_check.active);
-        this.config.set_string (this.section,
+        this.config.set_string (this.name,
                                 Configuration.TITLE_KEY,
                                 this.title_entry.get_text ());
     }
diff --git a/src/ui/rygel-preferences-dialog.vala b/src/ui/rygel-preferences-dialog.vala
index f2a9e55..3270789 100644
--- a/src/ui/rygel-preferences-dialog.vala
+++ b/src/ui/rygel-preferences-dialog.vala
@@ -30,7 +30,7 @@ public class Rygel.PreferencesDialog : GLib.Object {
 
     Builder builder;
     Dialog dialog;
-    ArrayList<PreferencesPage> pages;
+    ArrayList<PreferencesSection> sections;
 
     public PreferencesDialog () throws Error {
         var config = new Configuration ();
@@ -42,11 +42,17 @@ public class Rygel.PreferencesDialog : GLib.Object {
         this.dialog = (Dialog) this.builder.get_object (DIALOG);
         assert (this.dialog != null);
 
-        this.pages = new ArrayList<PreferencesPage> ();
-        this.pages.add (new GeneralPrefPage (this.builder, config));
-        this.pages.add (new PluginPrefPage (this.builder, config, "Tracker"));
-        this.pages.add (new PluginPrefPage (this.builder, config, "DVB"));
-        this.pages.add (new PluginPrefPage (this.builder, config, "Test"));
+        this.sections = new ArrayList<PreferencesSection> ();
+        this.sections.add (new GeneralPrefSection (this.builder, config));
+        this.sections.add (new PluginPrefSection (this.builder,
+                                                  config,
+                                                  "Tracker"));
+        this.sections.add (new PluginPrefSection (this.builder,
+                                                  config,
+                                                  "DVB"));
+        this.sections.add (new PluginPrefSection (this.builder,
+                                                  config,
+                                                  "Test"));
 
         this.dialog.response += this.on_response;
         this.dialog.delete_event += (dialog, event) => {
@@ -74,8 +80,8 @@ public class Rygel.PreferencesDialog : GLib.Object {
     }
 
     private void apply_settings () {
-        foreach (var page in this.pages) {
-            page.save ();
+        foreach (var section in this.sections) {
+            section.save ();
         }
     }
 
diff --git a/src/ui/rygel-preferences-page.vala b/src/ui/rygel-preferences-section.vala
similarity index 82%
rename from src/ui/rygel-preferences-page.vala
rename to src/ui/rygel-preferences-section.vala
index d4c08fe..0c340b3 100644
--- a/src/ui/rygel-preferences-page.vala
+++ b/src/ui/rygel-preferences-section.vala
@@ -22,14 +22,14 @@
  */
 using Gtk;
 
-public abstract class Rygel.PreferencesPage : GLib.Object {
+public abstract class Rygel.PreferencesSection : GLib.Object {
     protected Configuration config;
 
-    public string section;
+    public string name;
 
-    public PreferencesPage (Configuration config,
-                            string        section) {
-        this.section = section;
+    public PreferencesSection (Configuration config,
+                               string        name) {
+        this.name = name;
         this.config = config;
     }
 



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