[rygel/config] Disable widgets when they don't make sense



commit 14792d03feff0315fe65a3dd5d4435aecf9eaca4
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Apr 29 18:24:03 2009 +0300

    Disable widgets when they don't make sense
---
 src/ui/rygel-general-pref-page.vala |    8 ++++++++
 src/ui/rygel-plugin-pref-page.vala  |    7 +++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/ui/rygel-general-pref-page.vala b/src/ui/rygel-general-pref-page.vala
index c406902..7e91892 100644
--- a/src/ui/rygel-general-pref-page.vala
+++ b/src/ui/rygel-general-pref-page.vala
@@ -65,6 +65,8 @@ public class Rygel.GeneralPrefPage : PreferencesPage {
         this.mp3_check.active = this.config.mp3_transcoder;
         this.mp2ts_check.active = this.config.mp2ts_transcoder;
         this.lpcm_check.active = this.config.lpcm_transcoder;
+
+        this.trans_check.toggled += this.on_trans_check_toggled;
     }
 
     public override void save () {
@@ -76,4 +78,10 @@ public class Rygel.GeneralPrefPage : PreferencesPage {
         this.config.mp2ts_transcoder = this.mp2ts_check.active;
         this.config.lpcm_transcoder = this.lpcm_check.active;
     }
+
+    private void on_trans_check_toggled (CheckButton trans_check) {
+        this.mp3_check.sensitive =
+        this.mp2ts_check.sensitive =
+        this.lpcm_check.sensitive = trans_check.active;
+    }
 }
diff --git a/src/ui/rygel-plugin-pref-page.vala b/src/ui/rygel-plugin-pref-page.vala
index e54f423..97d9e69 100644
--- a/src/ui/rygel-plugin-pref-page.vala
+++ b/src/ui/rygel-plugin-pref-page.vala
@@ -49,6 +49,8 @@ public class Rygel.PluginPrefPage : PreferencesPage {
         this.enabled_check.active = config.get_enabled (section);
         this.title_entry.set_text (config.get_title (section));
         this.udn_entry.set_text (config.get_udn (section));
+
+        this.enabled_check.toggled += this.on_enabled_check_toggled;
     }
 
     public override void save () {
@@ -62,4 +64,9 @@ public class Rygel.PluginPrefPage : PreferencesPage {
                                 Configuration.UDN_KEY,
                                 this.udn_entry.get_text ());
     }
+
+    private void on_enabled_check_toggled (CheckButton enabled_check) {
+        this.title_entry.sensitive =
+        this.udn_entry.sensitive = enabled_check.active;
+    }
 }



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