[rygel] core: UserConfig doesn't bail-out on D-Bus unavailability
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] core: UserConfig doesn't bail-out on D-Bus unavailability
- Date: Wed, 30 Sep 2009 12:59:48 +0000 (UTC)
commit 7d20a625c7f90b0b7412c9cd69b549833e372442
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Sep 30 15:39:32 2009 +0300
core: UserConfig doesn't bail-out on D-Bus unavailability
src/rygel/rygel-user-config.vala | 36 ++++++++++++++++++++++--------------
1 files changed, 22 insertions(+), 14 deletions(-)
---
diff --git a/src/rygel/rygel-user-config.vala b/src/rygel/rygel-user-config.vala
index 2902d0d..8ea5a1b 100644
--- a/src/rygel/rygel-user-config.vala
+++ b/src/rygel/rygel-user-config.vala
@@ -147,16 +147,20 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
KeyFileFlags.KEEP_TRANSLATIONS);
debug ("Loaded user configuration from file '%s'", path);
- DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
-
- // Create proxy to Rygel
- this.rygel_obj = connection.get_object (RYGEL_SERVICE,
- RYGEL_PATH,
- RYGEL_INTERFACE);
- // and DBus
- this.dbus_obj = connection.get_object (DBUS_SERVICE,
- DBUS_PATH,
- DBUS_INTERFACE);
+ try {
+ DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
+
+ // Create proxy to Rygel
+ this.rygel_obj = connection.get_object (RYGEL_SERVICE,
+ RYGEL_PATH,
+ RYGEL_INTERFACE);
+ // and DBus
+ this.dbus_obj = connection.get_object (DBUS_SERVICE,
+ DBUS_PATH,
+ DBUS_INTERFACE);
+ } catch (DBus.Error err) {
+ debug ("Failed to connect to session bus: %s", err.message);
+ }
}
public void save () {
@@ -290,9 +294,11 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
uint32 res;
// Start service first
- this.dbus_obj.StartServiceByName (RYGEL_SERVICE,
- (uint32) 0,
- out res);
+ if (this.dbus_obj != null) {
+ this.dbus_obj.StartServiceByName (RYGEL_SERVICE,
+ (uint32) 0,
+ out res);
+ }
// Then symlink the desktop file to user's autostart dir
var source_path = Path.build_filename (BuildConfig.DESKTOP_DIR,
@@ -304,7 +310,9 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
this.set_bool ("general", ENABLED_KEY, true);
} else {
// Stop service first
- this.rygel_obj.Shutdown ();
+ if (this.rygel_obj != null) {
+ this.rygel_obj.Shutdown ();
+ }
// Then delete the symlink from user's autostart dir
try {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]