From a0d7aa88ed9f72d55e0c5f3436acf245dafb0209 Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Tue, 29 Jan 2008 23:28:58 -0800 Subject: [PATCH] Make Tilda work without DBus If DBus is not running on the system, make Tilda work as usual, minus the DBus IPC, of course. This makes many of the new features unavailable, but at least Tilda does not crash. Note that Tilda will still crash if you kill DBus out from underneath it. I'm very sure this happens to most (all?) programs that use DBus for IPC. Fortunately, DBus is very stable. --- tilda-controller.c | 4 ++++ tilda-terminal.c | 6 +++++- tilda-window.c | 6 +++++- tilda.c | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tilda-controller.c b/tilda-controller.c index 7361ff8..4127920 100644 --- a/tilda-controller.c +++ b/tilda-controller.c @@ -15,6 +15,10 @@ tilda_controller_dbus_register_object (TildaController *self) static const gchar object_path[] = "/net/sourceforge/Tilda"; + /* If DBus is not running, leave */ + if (!dbus_connection) + return; + dbus_g_connection_register_g_object (dbus_connection, object_path, G_OBJECT(self)); } diff --git a/tilda-terminal.c b/tilda-terminal.c index 49b52e2..d7c6410 100644 --- a/tilda-terminal.c +++ b/tilda-terminal.c @@ -182,7 +182,11 @@ tilda_terminal_dbus_register_object (TildaTerminal *tt) TildaWindow *parent_window = TILDA_WINDOW(tt->parent_window); gchar *object_path; - // Register this object with DBus + /* If DBus is not running, leave */ + if (!dbus_connection) + return; + + /* Register this object with DBus */ object_path = g_strdup_printf ("/net/sourceforge/Tilda/Window%d/Terminal%d", parent_window->number, tt->number); dbus_g_connection_register_g_object (dbus_connection, object_path, G_OBJECT(tt)); diff --git a/tilda-window.c b/tilda-window.c index 351efa0..705a80a 100644 --- a/tilda-window.c +++ b/tilda-window.c @@ -346,7 +346,11 @@ tilda_window_dbus_register_object (TildaWindow *self) gchar *object_path; - // Register this object with DBus + /* If DBus is not running, leave */ + if (!dbus_connection) + return; + + /* Register this object with DBus */ object_path = g_strdup_printf ("/net/sourceforge/Tilda/Window%d", self->number); dbus_g_connection_register_g_object (dbus_connection, object_path, G_OBJECT(self)); g_free (object_path); diff --git a/tilda.c b/tilda.c index 8b1de1d..617c5e2 100644 --- a/tilda.c +++ b/tilda.c @@ -7,7 +7,7 @@ #include "tomboykeybinder.h" /* Project-global variables */ -DBusGConnection *dbus_connection; +DBusGConnection *dbus_connection = NULL; static void tilda_dbus_init () -- 2.25.1