[rygel/config] Actually save the configuration.



commit 8529cb2d5724e7dd7948c7288ecdc1ab2a7522bc
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Apr 22 16:03:06 2009 +0300

    Actually save the configuration.
    
    ATM it only saves string options.
---
 src/ui/rygel-preferences.vala |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/ui/rygel-preferences.vala b/src/ui/rygel-preferences.vala
index 55077b6..7740cf4 100644
--- a/src/ui/rygel-preferences.vala
+++ b/src/ui/rygel-preferences.vala
@@ -116,14 +116,37 @@ public class Rygel.Preferences : Dialog {
     private void on_response (Preferences pref, int response_id) {
         switch (response_id) {
             case ResponseType.REJECT:
+                Gtk.main_quit ();
+                break;
             case ResponseType.ACCEPT:
+                apply_settings ();
                 Gtk.main_quit ();
                 break;
             case ResponseType.APPLY:
+                apply_settings ();
                 break;
         }
     }
 
+    private void apply_settings () {
+        foreach (var child in this.vbox.get_children ()) {
+            if (!(child is HBox)) {
+                break;
+            }
+
+            var hbox = (HBox) child;
+
+            foreach (var widget in hbox.get_children ()) {
+                if (widget is Entry) {
+                        var name = widget.get_name ();
+                        var text = ((Entry) widget).get_text ();
+
+                        this.config_editor.set_string ("general", name, text);
+                }
+            }
+        }
+    }
+
     public new void run () {
         Gtk.main ();
     }



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