[rygel] core,ui: Handle some previously unhandled errors
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] core,ui: Handle some previously unhandled errors
- Date: Sun, 4 Oct 2009 00:52:18 +0000 (UTC)
commit a3f4f60970f8ecf752a2b879730fad4a211af51c
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Sun Oct 4 03:35:38 2009 +0300
core,ui: Handle some previously unhandled errors
src/rygel/rygel-log-handler.vala | 9 ++++++++-
src/rygel/rygel-main.vala | 17 +++++++++++------
src/rygel/rygel-user-config.vala | 8 +++++++-
src/ui/rygel-plugin-pref-section.vala | 6 +++++-
4 files changed, 31 insertions(+), 9 deletions(-)
---
diff --git a/src/rygel/rygel-log-handler.vala b/src/rygel/rygel-log-handler.vala
index 7a073c2..d67e858 100644
--- a/src/rygel/rygel-log-handler.vala
+++ b/src/rygel/rygel-log-handler.vala
@@ -56,7 +56,14 @@ public class Rygel.LogHandler : GLib.Object {
// Get the allowed log levels from the config
var config = MetaConfig.get_default ();
- this.levels = this.log_level_to_flags (config.get_log_level ());
+ try {
+ this.levels = this.log_level_to_flags (config.get_log_level ());
+ } catch (Error err) {
+ this.levels = DEFAULT_LEVELS;
+
+ warning ("Failed to get log level from configuration sources: %s",
+ err.message);
+ }
}
private void log_func (string? log_domain,
diff --git a/src/rygel/rygel-main.vala b/src/rygel/rygel-main.vala
index c940008..80e88ac 100644
--- a/src/rygel/rygel-main.vala
+++ b/src/rygel/rygel-main.vala
@@ -109,12 +109,17 @@ public class Rygel.Main : Object {
} catch (GLib.Error err) {}
if (iface == null || iface == context.interface) {
- var factory = new RootDeviceFactory (context);
- this.factories.add (factory);
-
- var iterator = this.plugin_loader.list_plugins ().iterator ();
- while (iterator.next ()) {
- this.create_device (iterator.get (), factory);
+ try {
+ var factory = new RootDeviceFactory (context);
+ this.factories.add (factory);
+
+ var iterator = this.plugin_loader.list_plugins ().iterator ();
+ while (iterator.next ()) {
+ this.create_device (iterator.get (), factory);
+ }
+ } catch (GLib.Error err) {
+ warning ("Failed to create root device factory: %s\n",
+ err.message);
}
} else {
debug ("Ignoring network context %s (%s).",
diff --git a/src/rygel/rygel-user-config.vala b/src/rygel/rygel-user-config.vala
index 8ea5a1b..643916e 100644
--- a/src/rygel/rygel-user-config.vala
+++ b/src/rygel/rygel-user-config.vala
@@ -63,7 +63,13 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
}
public void set_upnp_enabled (bool value) {
- if (value != this.get_upnp_enabled ()) {
+ bool enabled = false;
+
+ try {
+ enabled = this.get_upnp_enabled ();
+ } catch (GLib.Error err) {}
+
+ if (value != enabled) {
this.enable_upnp (value);
}
}
diff --git a/src/ui/rygel-plugin-pref-section.vala b/src/ui/rygel-plugin-pref-section.vala
index fb1d370..c4f48be 100644
--- a/src/ui/rygel-plugin-pref-section.vala
+++ b/src/ui/rygel-plugin-pref-section.vala
@@ -51,7 +51,11 @@ public class Rygel.PluginPrefSection : PreferencesSection {
assert (title_label != null);
this.widgets.add (title_label);
- this.enabled_check.active = config.get_enabled (name);
+ try {
+ this.enabled_check.active = config.get_enabled (name);
+ } catch (GLib.Error err) {
+ this.enabled_check.active = false;
+ }
string title;
try {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]