ekg2  GIT master
dbus.h
Idź do dokumentacji tego pliku.
1 #ifndef __EKG2_DBUS_H
2 #define __EKG2_DBUS_H
3 
4 #define DBUS_API_SUBJECT_TO_CHANGE
5 #include <dbus/dbus.h>
6 
7 #define DBUS_ORG_FREEDESKTOP_IM_INTERFACE "org.freedesktop.im"
8 
9 #define EKG2_DBUS_IFACE_HANDLER(x) DBusHandlerResult x(DBusConnection *conn, DBusMessage *msg, void *data)
10 
12  char *ifaceline;
13  char *name;
14  DBusHandleMessageFunction handler;
15 };
17 
19  char *name;
20  int type; /* DBUS_MESSAGE_TYPE_METHOD_CALL or DBUS_MESSAGE_TYPE_SIGNAL */
21  DBusHandleMessageFunction handler;
22 };
24 
25 #define EKG2_DBUS_CALL_HANDLER_VARIABLES DBusMessage *reply; \
26  DBusMessageIter args; \
27  dbus_uint32_t serial = 0;
28 
29 #define EKG2_DBUS_INIT_REPLY reply = dbus_message_new_method_return(msg); \
30  dbus_message_iter_init_append(reply, &args)
31 
32 #define EKG2_DBUS_ADD(type, x) do { \
33  if (!dbus_message_iter_append_basic(&args, type, (x) )) { \
34  g_printerr("%s cannot allocate memory?\n", __FUNCTION__); \
35  abort(); \
36  } \
37  } while(0)
38 
39 #define EKG2_DBUS_ADD_STRING(x) EKG2_DBUS_ADD(DBUS_TYPE_STRING, x)
40 
41 #define EKG2_DBUS_SEND_REPLY do { \
42  if (!dbus_connection_send(conn, reply, &serial)) { \
43  debug("Cannot send reply!\n"); \
44  return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; /* XXX */ \
45  } \
46  dbus_connection_flush(conn); \
47  } while(0)
48 
49 #endif /* __EKG2_DBUS_H */
DBusHandleMessageFunction handler
Definition: dbus.h:21
DBusHandleMessageFunction handler
Definition: dbus.h:14
int type
Definition: dbus.h:20
char * name
Definition: dbus.h:19
Definition: dbus.h:18
char * name
Definition: dbus.h:13
char * ifaceline
Definition: dbus.h:12
Definition: dbus.h:11