[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/dbusbind.c,v
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] Changes to emacs/src/dbusbind.c,v |
Date: |
Sun, 30 Mar 2008 12:38:19 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Michael Albinus <albinus> 08/03/30 12:38:19
Index: dbusbind.c
===================================================================
RCS file: /sources/emacs/emacs/src/dbusbind.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- dbusbind.c 23 Mar 2008 16:45:39 -0000 1.23
+++ dbusbind.c 30 Mar 2008 12:38:19 -0000 1.24
@@ -44,6 +44,9 @@
/* Lisp symbols of the system and session buses. */
Lisp_Object QCdbus_system_bus, QCdbus_session_bus;
+/* Lisp symbol for method call timeout. */
+Lisp_Object QCdbus_timeout;
+
/* Lisp symbols of D-Bus types. */
Lisp_Object QCdbus_type_byte, QCdbus_type_boolean;
Lisp_Object QCdbus_type_int16, QCdbus_type_uint16;
@@ -724,6 +727,11 @@
object path SERVICE is registered at. INTERFACE is an interface
offered by SERVICE. It must provide METHOD.
+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
+in time, a D-Bus error is raised.
+
All other arguments ARGS are passed to METHOD as arguments. They are
converted into D-Bus types via the following rules:
@@ -777,7 +785,9 @@
=> "i686"
-usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &rest ARGS) */)
+usage: (dbus-call-method
+ BUS SERVICE PATH INTERFACE METHOD
+ &optional :timeout TIMEOUT &rest ARGS) */)
(nargs, args)
int nargs;
register Lisp_Object *args;
@@ -791,7 +801,8 @@
DBusMessageIter iter;
DBusError derror;
unsigned int dtype;
- int i;
+ int timeout = -1;
+ int i = 5;
char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
/* Check parameters. */
@@ -822,19 +833,23 @@
SDATA (path),
SDATA (interface),
SDATA (method));
- if (dmessage == NULL)
- {
UNGCPRO;
+ if (dmessage == NULL)
xsignal1 (Qdbus_error, build_string ("Unable to create a new message"));
- }
- UNGCPRO;
+ /* Check for timeout parameter. */
+ if ((i+2 <= nargs) && (EQ ((args[i]), QCdbus_timeout)))
+ {
+ CHECK_NATNUM (args[i+1]);
+ timeout = XUINT (args[i+1]);
+ i = i+2;
+ }
/* Initialize parameter list of message. */
dbus_message_iter_init_append (dmessage, &iter);
/* Append parameters to the message. */
- for (i = 5; i < nargs; ++i)
+ for (; i < nargs; ++i)
{
dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]);
if (XD_DBUS_TYPE_P (args[i]))
@@ -864,7 +879,7 @@
dbus_error_init (&derror);
reply = dbus_connection_send_with_reply_and_block (connection,
dmessage,
- -1,
+ timeout,
&derror);
if (dbus_error_is_set (&derror))
@@ -1071,13 +1086,9 @@
dmessage = dbus_message_new_signal (SDATA (path),
SDATA (interface),
SDATA (signal));
- if (dmessage == NULL)
- {
UNGCPRO;
+ if (dmessage == NULL)
xsignal1 (Qdbus_error, build_string ("Unable to create a new message"));
- }
-
- UNGCPRO;
/* Initialize parameter list of message. */
dbus_message_iter_init_append (dmessage, &iter);
@@ -1178,7 +1189,7 @@
interface = dbus_message_get_interface (dmessage);
member = dbus_message_get_member (dmessage);
- /* dbus-registered-functions-table requires non nil interface and member. */
+ /* Vdbus_registered_functions_table requires non-nil interface and member.
*/
if ((NULL == interface) || (NULL == member))
goto cleanup;
@@ -1462,6 +1473,9 @@
QCdbus_session_bus = intern (":session");
staticpro (&QCdbus_session_bus);
+ QCdbus_timeout = intern (":timeout");
+ staticpro (&QCdbus_timeout);
+
QCdbus_type_byte = intern (":byte");
staticpro (&QCdbus_type_byte);