gnome-settings-daemon r636 - in trunk: . gnome-settings-daemon
- From: halfline svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-settings-daemon r636 - in trunk: . gnome-settings-daemon
- Date: Wed, 17 Dec 2008 16:09:26 +0000 (UTC)
Author: halfline
Date: Wed Dec 17 16:09:26 2008
New Revision: 636
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=636&view=rev
Log:
2008-12-07 Ray Strode <rstrode redhat com>
Shutdown properly when bus goes away. Previously
we were just letting libdbus call exit(1) for us.
* gnome-settings-daemon/main.c (get_session_bus):
Set up a filter function to catch disconection
events.
(bus_message_handler): quit event loop when
disconnected from bus.
Modified:
trunk/ChangeLog
trunk/gnome-settings-daemon/main.c
Modified: trunk/gnome-settings-daemon/main.c
==============================================================================
--- trunk/gnome-settings-daemon/main.c (original)
+++ trunk/gnome-settings-daemon/main.c Wed Dec 17 16:09:26 2008
@@ -114,6 +114,21 @@
return ret;
}
+static DBusHandlerResult
+bus_message_handler (DBusConnection *connection,
+ DBusMessage *message,
+ void *user_data)
+{
+ if (dbus_message_is_signal (message,
+ DBUS_INTERFACE_LOCAL,
+ "Disconnected")) {
+ gtk_main_quit ();
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
static DBusGConnection *
get_session_bus (void)
{
@@ -131,7 +146,12 @@
}
connection = dbus_g_connection_get_connection (bus);
- dbus_connection_set_exit_on_disconnect (connection, TRUE);
+ dbus_connection_add_filter (connection,
+ (DBusHandleMessageFunction)
+ bus_message_handler,
+ NULL, NULL);
+
+ dbus_connection_set_exit_on_disconnect (connection, FALSE);
out:
return bus;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]