/* Parameter check. */
CHECK_SYMBOL (bus);
- if (!((EQ (bus, QCdbus_system_bus)) || (EQ (bus, QCdbus_session_bus))))
+ if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus)))
XD_SIGNAL2 (build_string ("Wrong bus name"), bus);
+ /* We do not want to have an autolaunch for the session bus. */
+ if (EQ (bus, QCdbus_session_bus)
+ && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL)
+ XD_SIGNAL2 (build_string ("No connection to bus"), bus);
+
/* Open a connection to the bus. */
dbus_error_init (&derror);
XD_ERROR (derror);
if (connection == NULL)
- XD_SIGNAL2 (build_string ("No connection"), bus);
+ XD_SIGNAL2 (build_string ("No connection to bus"), bus);
/* Cleanup. */
dbus_error_free (&derror);
/* We check only for incoming data. */
if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE)
{
+#if HAVE_DBUS_WATCH_GET_UNIX_FD
/* TODO: Reverse these on Win32, which prefers the opposite. */
int fd = dbus_watch_get_unix_fd(watch);
if (fd == -1)
fd = dbus_watch_get_socket(watch);
+#else
+ int fd = dbus_watch_get_fd(watch);
+#endif
+ XD_DEBUG_MESSAGE ("%d", fd);
+
if (fd == -1)
return FALSE;
- //printf ("xd_add_watch: %d\n", fd);
/* Add the file descriptor to input_wait_mask. */
add_keyboard_wait_descriptor (fd);
}
/* We check only for incoming data. */
if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE)
{
+#if HAVE_DBUS_WATCH_GET_UNIX_FD
/* TODO: Reverse these on Win32, which prefers the opposite. */
int fd = dbus_watch_get_unix_fd(watch);
if (fd == -1)
fd = dbus_watch_get_socket(watch);
+#else
+ int fd = dbus_watch_get_fd(watch);
+#endif
+ XD_DEBUG_MESSAGE ("%d", fd);
+
if (fd == -1)
return;
- //printf ("xd_remove_watch: %d\n", fd);
/* Remove the file descriptor from input_wait_mask. */
delete_keyboard_wait_descriptor (fd);
}
If the parameter `:timeout' is given, the following integer TIMEOUT
specifies the maximun number of milliseconds the method call must
-return. The default value is 25.000. If the method call doesn't
+return. The default value is 25,000. If the method call doesn't
return in time, a D-Bus error is raised.
All other arguments ARGS are passed to METHOD as arguments. They are
If the parameter `:timeout' is given, the following integer TIMEOUT
specifies the maximun number of milliseconds the method call must
-return. The default value is 25.000. If the method call doesn't
+return. The default value is 25,000. If the method call doesn't
return in time, a D-Bus error is raised.
All other arguments ARGS are passed to METHOD as arguments. They are
table in dbus.el. When this package isn't loaded yet, it doesn't
make sense to handle D-Bus messages. */
return (HASH_TABLE_P (Vdbus_registered_functions_table)
- ? ((xd_get_dispatch_status (QCdbus_system_bus)
- || (xd_get_dispatch_status (QCdbus_session_bus))))
+ ? (xd_get_dispatch_status (QCdbus_system_bus)
+ || ((getenv ("DBUS_SESSION_BUS_ADDRESS") != NULL)
+ ? xd_get_dispatch_status (QCdbus_session_bus)
+ : FALSE))
: FALSE);
}