diff options
author | Mikael Hallendal <hallski@src.gnome.org> | 2003-11-26 14:36:46 +0000 |
---|---|---|
committer | Mikael Hallendal <hallski@src.gnome.org> | 2003-11-26 14:36:46 +0000 |
commit | 598bbac9d901fa166c55f1a3faa17377faf39c03 (patch) | |
tree | 75a84f93cb2715cbd3de0f33e614c667d8f5ae03 | |
parent | dbfc64b802f65551066943eff8ada928118707f4 (diff) | |
download | gconf-598bbac9d901fa166c55f1a3faa17377faf39c03.tar.gz |
use session bus
-rw-r--r-- | gconf/gconf-dbus.c | 17 | ||||
-rw-r--r-- | gconf/gconfd-dbus.c | 24 |
2 files changed, 19 insertions, 22 deletions
diff --git a/gconf/gconf-dbus.c b/gconf/gconf-dbus.c index 9871e6a3..e96a7331 100644 --- a/gconf/gconf-dbus.c +++ b/gconf/gconf-dbus.c @@ -1826,6 +1826,8 @@ ensure_dbus_connection (void) { const gchar *dbus_address; DBusError error; + GError *gerror = NULL; + /*DBusMessageHandler *handler;*/ if (connection) @@ -1834,24 +1836,25 @@ ensure_dbus_connection (void) /* FIXME: Need to figure out how to handle the bus address. The typical case will most likely be to use the session bus. */ dbus_address = g_getenv ("DBUS_ADDRESS"); - +#if 0 if (!dbus_address) { g_warning ("Failed to get the D-BUS bus daemon address.\n"); return FALSE; } - +#endif dbus_error_init (&error); - connection = dbus_connection_open (dbus_address, &error); + connection = dbus_bus_get_with_g_main (DBUS_BUS_SESSION, &gerror); + /* dbus_connection_open (dbus_address, &error); */ if (!connection) { g_warning ("Failed to connect to the D-BUS bus daemon: %s\n.", - error.message); - dbus_error_free (&error); + gerror->message); + /* dbus_error_free (&error); */ return FALSE; } - +/* if (!dbus_bus_register (connection, &error)) { g_warning ("Failed to register client with the D-BUS bus daemon: %s", @@ -1867,7 +1870,7 @@ ensure_dbus_connection (void) } dbus_connection_setup_with_g_main (connection, NULL); - +*/ /* FIXME handler = dbus_message_handler_new (gconf_database_handler, NULL, NULL); dbus_connection_register_handler (connection, handler, config_listener_messages, diff --git a/gconf/gconfd-dbus.c b/gconf/gconfd-dbus.c index e93c21b7..56efe743 100644 --- a/gconf/gconfd-dbus.c +++ b/gconf/gconfd-dbus.c @@ -180,33 +180,27 @@ get_dbus_address (void) gboolean gconfd_dbus_init (void) { + GError *gerror = NULL; DBusError error; const char *bus_address; + + bus_conn = dbus_bus_get_with_g_main (DBUS_BUS_SESSION, &gerror); - bus_address = get_dbus_address (); - if (!bus_address) - { - gconf_log (GCL_ERR, ("Failed to get the D-BUS bus daemon address")); - return FALSE; - } - - dbus_error_init (&error); - bus_conn = dbus_connection_open (get_dbus_address (), &error); if (!bus_conn) { gconf_log (GCL_ERR, _("Failed to connect to the D-BUS daemon: %s"), - error.message); + gerror->message); return FALSE; } - if (!dbus_bus_register (bus_conn, &error)) + /*if (!dbus_bus_register (bus_conn, &error)) { gconf_log (GCL_ERR, _("Failed to register client with the D-BUS bus daemon: %s"), error.message); dbus_error_free (&error); return FALSE; } - +*/ if (!dbus_connection_register_object_path (bus_conn, server_path, &server_vtable, @@ -215,7 +209,7 @@ gconfd_dbus_init (void) gconf_log (GCL_ERR, _("Failed to register server object with the D-BUS bus daemon")); return FALSE; } - + /* dbus_bus_acquire_service (bus_conn, GCONF_DBUS_SERVICE, 0, &error); if (dbus_error_is_set (&error)) { @@ -223,9 +217,9 @@ gconfd_dbus_init (void) dbus_error_free (&error); return FALSE; } - +*/ nr_of_connections = 1; - dbus_connection_setup_with_g_main (bus_conn, NULL); +/* dbus_connection_setup_with_g_main (bus_conn, NULL); */ return TRUE; } |