[rygel] core,ui: Minimal handling of "Enable UPnP/DLNA"



commit 453aba823e609f140db9d659de054c49ed7f2aa4
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Jun 8 15:31:31 2009 +0300

    core,ui: Minimal handling of "Enable UPnP/DLNA"

 data/rygel-preferences.ui              |    6 +++---
 src/rygel/rygel-configuration.vala     |    9 +++++++++
 src/ui/rygel-general-pref-section.vala |    6 ++++++
 3 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/data/rygel-preferences.ui b/data/rygel-preferences.ui
index 59feda2..4621f04 100644
--- a/data/rygel-preferences.ui
+++ b/data/rygel-preferences.ui
@@ -36,7 +36,7 @@
                     <property name="orientation">vertical</property>
                     <property name="spacing">12</property>
                     <child>
-                      <object class="GtkCheckButton" id="enable-upnp-checkbutton">
+                      <object class="GtkCheckButton" id="upnp-checkbutton">
                         <property name="label" translatable="yes">_Enable UPnP/DLNA</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
@@ -540,9 +540,9 @@
     <property name="type_hint">dialog</property>
     <property name="transient_for">preferences-dialog</property>
     <property name="has_separator">False</property>
-    <property name="action">select-folder</property>
-    <property name="local_only">False</property>
     <property name="select_multiple">True</property>
+    <property name="local_only">False</property>
+    <property name="action">select-folder</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox2">
         <property name="visible">True</property>
diff --git a/src/rygel/rygel-configuration.vala b/src/rygel/rygel-configuration.vala
index fa1b647..1da0d02 100644
--- a/src/rygel/rygel-configuration.vala
+++ b/src/rygel/rygel-configuration.vala
@@ -46,6 +46,15 @@ public class Rygel.Configuration : GLib.Object {
 
     protected GConf.Client gconf;
 
+    public bool upnp_enabled {
+        get {
+            return this.get_bool ("general", ENABLED_KEY, true);
+        }
+        set {
+            this.set_bool ("general", ENABLED_KEY, value);
+        }
+    }
+
     private string _host_ip;
     public string host_ip {
         get {
diff --git a/src/ui/rygel-general-pref-section.vala b/src/ui/rygel-general-pref-section.vala
index 7eccc43..4c77abe 100644
--- a/src/ui/rygel-general-pref-section.vala
+++ b/src/ui/rygel-general-pref-section.vala
@@ -23,6 +23,7 @@
 using Gtk;
 
 public class Rygel.GeneralPrefSection : PreferencesSection {
+    const string UPNP_CHECKBUTTON = "upnp-checkbutton";
     const string IP_ENTRY = "ip-entry";
     const string PORT_SPINBUTTON = "port-spinbutton";
     const string TRANS_CHECKBUTTON = "transcoding-checkbutton";
@@ -34,6 +35,7 @@ public class Rygel.GeneralPrefSection : PreferencesSection {
     private SpinButton port_spin;
 
     // Transcoding options
+    private CheckButton upnp_check;
     private CheckButton trans_check;
     private CheckButton mp3_check;
     private CheckButton mp2ts_check;
@@ -43,6 +45,8 @@ public class Rygel.GeneralPrefSection : PreferencesSection {
                                Configuration config) throws Error {
         base (config, "general");
 
+        this.upnp_check = (CheckButton) builder.get_object (UPNP_CHECKBUTTON);
+        assert (this.upnp_check != null);
         this.ip_entry = (Entry) builder.get_object (IP_ENTRY);
         assert (this.ip_entry != null);
         this.port_spin = (SpinButton) builder.get_object (PORT_SPINBUTTON);
@@ -61,6 +65,7 @@ public class Rygel.GeneralPrefSection : PreferencesSection {
         }
         this.port_spin.set_value (config.port);
 
+        this.upnp_check.active = this.config.upnp_enabled;
         this.trans_check.active = this.config.transcoding;
         this.mp3_check.active = this.config.mp3_transcoder;
         this.mp2ts_check.active = this.config.mp2ts_transcoder;
@@ -73,6 +78,7 @@ public class Rygel.GeneralPrefSection : PreferencesSection {
         this.config.host_ip = this.ip_entry.get_text ();
         this.config.port = (int) this.port_spin.get_value ();
 
+        this.config.upnp_enabled = this.upnp_check.active;
         this.config.transcoding = this.trans_check.active;
         this.config.mp3_transcoder = this.mp3_check.active;
         this.config.mp2ts_transcoder = this.mp2ts_check.active;



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