[rygel/config] Add widgets to set 'host-ip' and 'port' configuration.



commit ac6e1623d08c16db2ed95eb5564fbe258bc35295
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Apr 20 16:02:27 2009 +0300

    Add widgets to set 'host-ip' and 'port' configuration.
---
 src/ui/rygel-preferences.vala |   57 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/src/ui/rygel-preferences.vala b/src/ui/rygel-preferences.vala
index dd244e2..0b35a16 100644
--- a/src/ui/rygel-preferences.vala
+++ b/src/ui/rygel-preferences.vala
@@ -26,6 +26,17 @@ public class Rygel.Preferences : Dialog {
     public Preferences () {
         this.title = "Rygel Preferences";
 
+        var config = new Rygel.Configuration ();
+
+        this.add_string_pref ("IP",
+                              config.host_ip,
+                              "The IP to advertise the UPnP MediaServer on");
+        this.add_int_pref ("Port",
+                           config.port,
+                           uint16.MIN,
+                           uint16.MAX,
+                           "The port to advertise the UPnP MediaServer on");
+
         this.add_button (STOCK_OK, ResponseType.ACCEPT);
         this.add_button (STOCK_APPLY, ResponseType.APPLY);
         this.add_button (STOCK_CANCEL, ResponseType.REJECT);
@@ -35,6 +46,52 @@ public class Rygel.Preferences : Dialog {
         this.show_all ();
     }
 
+    private void add_string_pref (string  name,
+                                  string? current_value,
+                                  string  tooltip) {
+        var hbox = new HBox (true, 6);
+
+        var label = new Label (name);
+        var entry = new Entry ();
+
+        hbox.add (label);
+        hbox.add (entry);
+
+        if (current_value != null) {
+            entry.set_text (current_value);
+        }
+
+        hbox.set_tooltip_text (tooltip);
+
+        this.vbox.add (hbox);
+    }
+
+    private void add_int_pref (string  name,
+                               int     current_value,
+                               int     min,
+                               int     max,
+                               string  tooltip) {
+        var hbox = new HBox (true, 6);
+
+        var label = new Label (name);
+
+        var adjustment = new Adjustment (current_value,
+                                         min,
+                                         max,
+                                         1.0,
+                                         10.0,
+                                         10.0);
+
+        var spin = new SpinButton (adjustment, 1.0, 0);
+
+        hbox.add (label);
+        hbox.add (spin);
+
+        hbox.set_tooltip_text (tooltip);
+
+        this.vbox.add (hbox);
+    }
+
     private void on_response (Preferences pref, int response_id) {
         switch (response_id) {
             case ResponseType.REJECT:



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