[rygel] ui: Separate out try/catch blocks



commit 6620726b6b024bfce1b0a43e7e2750e9ac50f9e6
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sun Jun 21 02:27:16 2009 +0300

    ui: Separate out try/catch blocks
    
    Put calls with different chances of failure into separate try/catch
    blocks.

 src/ui/rygel-general-pref-section.vala |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/ui/rygel-general-pref-section.vala b/src/ui/rygel-general-pref-section.vala
index 1c6de11..961d511 100644
--- a/src/ui/rygel-general-pref-section.vala
+++ b/src/ui/rygel-general-pref-section.vala
@@ -62,17 +62,21 @@ 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
+        }
 
+        // 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 ());
             this.upnp_check.active = this.config.get_upnp_enabled ();
             this.trans_check.active = this.config.get_transcoding ();
             this.mp3_check.active = this.config.get_mp3_transcoder ();
             this.mp2ts_check.active = this.config.get_mp2ts_transcoder ();
             this.lpcm_check.active = this.config.get_lpcm_transcoder ();
-        } catch (GLib.Error err) {
-            // No problem if we fail to read the config, the default values
-            // will do just fine
-        }
+        } catch (GLib.Error err) {} // Same goes for these keys
 
         this.trans_check.toggled += this.on_trans_check_toggled;
     }



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