[rygel] ui: Put failable calls in separate try/catch blocks



commit 28bf96f720bc93827c234e47c2e312889357787e
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Jun 24 17:43:51 2009 +0300

    ui: Put failable calls in separate try/catch blocks

 src/ui/rygel-general-pref-section.vala |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/ui/rygel-general-pref-section.vala b/src/ui/rygel-general-pref-section.vala
index 2c48f58..862e19e 100644
--- a/src/ui/rygel-general-pref-section.vala
+++ b/src/ui/rygel-general-pref-section.vala
@@ -62,21 +62,28 @@ public class Rygel.GeneralPrefSection : PreferencesSection {
 
         try {
             this.ip_entry.set_text (config.get_host_ip ());
-            this.port_spin.set_value (config.get_port ());
         } catch (GLib.Error err) {
             // No problem if we fail to read the config, the default values
-            // will do just fine
+            // will do just fine. Same goes for rest of the keys.
         }
-
-        // We put these calls in separate try/catch block since its uncommon
-        // for these to fail
+        try {
+            this.port_spin.set_value (config.get_port ());
+        } catch (GLib.Error err) {}
         try {
             this.upnp_check.active = this.config.get_upnp_enabled ();
+        } catch (GLib.Error err) {}
+        try {
             this.trans_check.active = this.config.get_transcoding ();
+        } catch (GLib.Error err) {}
+        try {
             this.mp3_check.active = this.config.get_mp3_transcoder ();
+        } catch (GLib.Error err) {}
+        try {
             this.mp2ts_check.active = this.config.get_mp2ts_transcoder ();
+        } catch (GLib.Error err) {}
+        try {
             this.lpcm_check.active = this.config.get_lpcm_transcoder ();
-        } catch (GLib.Error err) {} // Same goes for these keys
+        } catch (GLib.Error err) {}
 
         this.trans_check.toggled += this.on_trans_check_toggled;
     }



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