libbonobo r3462 - in trunk: . activation-server
- From: halfline svn gnome org
- To: svn-commits-list gnome org
- Subject: libbonobo r3462 - in trunk: . activation-server
- Date: Wed, 7 May 2008 15:14:30 +0100 (BST)
Author: halfline
Date: Wed May 7 14:14:30 2008
New Revision: 3462
URL: http://svn.gnome.org/viewvc/libbonobo?rev=3462&view=rev
Log:
2008-05-07 Ray Strode <rstrode redhat com>
Make bonobo-activation-server exit when dbus session exits
* configure.in: Require dbus and dbus-glib
* activation-server/activation-server-main.c:
(bus_message_handler): Check for "Disconnected" signal and
quit mainloop upon getting it.
(main): Get on session bus and filter for messages.
Modified:
trunk/ChangeLog
trunk/activation-server/activation-server-main.c
trunk/configure.in
Modified: trunk/activation-server/activation-server-main.c
==============================================================================
--- trunk/activation-server/activation-server-main.c (original)
+++ trunk/activation-server/activation-server-main.c Wed May 7 14:14:30 2008
@@ -54,6 +54,8 @@
#include <glib/gstdio.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
static gboolean server_threaded = FALSE;
static glong server_guard_depth = 0;
static GStaticRecMutex server_guard = G_STATIC_REC_MUTEX_INIT;
@@ -373,6 +375,21 @@
CORBA_free (ior);
}
+static DBusHandlerResult
+bus_message_handler (DBusConnection *connection,
+ DBusMessage *message,
+ GMainLoop *loop)
+{
+ if (dbus_message_is_signal (message,
+ DBUS_INTERFACE_LOCAL,
+ "Disconnected")) {
+ g_main_loop_quit (loop);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
int
main (int argc, char *argv[])
{
@@ -396,6 +413,8 @@
const gchar *debug_output_env;
#endif
GError *error = NULL;
+ DBusConnection *connection;
+ DBusError bus_error;
#ifdef HAVE_SETSID
/*
@@ -533,6 +552,27 @@
od_finished_internal_registration ();
+ dbus_error_init (&bus_error);
+ connection = dbus_bus_get (DBUS_BUS_SESSION, &bus_error);
+
+ if (dbus_error_is_set (&bus_error)) {
+ g_warning ("could not associate with desktop session: %s",
+ bus_error.message);
+ connection = NULL;
+ } else {
+ GMainContext *main_context;
+
+ main_context = g_main_loop_get_context (main_loop);
+ dbus_connection_setup_with_g_main (connection, main_context);
+
+ if (dbus_connection_add_filter (connection,
+ (DBusHandleMessageFunction)
+ bus_message_handler, main_loop,
+ NULL)) {
+ dbus_connection_set_exit_on_disconnect (connection, FALSE);
+ }
+ }
+
if (getenv ("BONOBO_ACTIVATION_DEBUG") == NULL)
chdir ("/");
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Wed May 7 14:14:30 2008
@@ -121,6 +121,8 @@
gmodule-2.0 >= 2.0.1 \
ORBit-2.0 >= 2.4.0 \
ORBit-CosNaming-2.0 >= 2.4.0 \
+ dbus-1 >= 1.0.0 \
+ dbus-glib-1 >= 0.74 \
libxml-2.0 >= 2.4.20)
AC_SUBST(SERVER_LIBS)
AC_SUBST(SERVER_CFLAGS)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]