Mercurial > pidgin
annotate src/dbus-bindings.h @ 13238:1e855032d7bc
[gaim-migrate @ 15604]
Someone in #wingaim said this was necessary
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 12 Feb 2006 15:27:11 +0000 |
parents | b1099e09eb33 |
children |
rev | line source |
---|---|
11174 | 1 /** |
11501
9563b768e8e2
[gaim-migrate @ 13746]
Richard Laager <rlaager@wiktel.com>
parents:
11187
diff
changeset
|
2 * @file dbus-bindings.h Gaim DBUS Bindings |
11174 | 3 * @ingroup core |
4 * | |
5 * gaim | |
6 * | |
7 * Gaim is the legal property of its developers, whose names are too numerous | |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
10 * | |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 * | |
25 */ | |
26 | |
27 #ifndef _GAIM_DBUS_BINDINGS_H_ | |
28 #define _GAIM_DBUS_BINDINGS_H_ | |
29 | |
30 #include <dbus/dbus.h> | |
31 #include <dbus/dbus-glib-lowlevel.h> | |
32 #include <glib.h> | |
33 | |
11884 | 34 #ifdef __cplusplus |
35 extern "C" { | |
36 #endif | |
37 | |
11174 | 38 gint gaim_dbus_pointer_to_id(gpointer node); |
39 gpointer gaim_dbus_id_to_pointer(gint id, GaimDBusType *type); | |
40 gint gaim_dbus_pointer_to_id_error(gpointer ptr, DBusError *error); | |
41 gpointer gaim_dbus_id_to_pointer_error(gint id, GaimDBusType *type, | |
42 const char *typename, DBusError *error); | |
43 | |
44 #define NULLIFY(id) id = empty_to_null(id) | |
45 | |
46 #define CHECK_ERROR(error) if (dbus_error_is_set(error)) return NULL; | |
47 | |
48 #define GAIM_DBUS_ID_TO_POINTER(ptr, id, type, error) \ | |
49 G_STMT_START { \ | |
50 ptr = (type*) gaim_dbus_id_to_pointer_error \ | |
51 (id, GAIM_DBUS_TYPE(type), #type, error); \ | |
52 CHECK_ERROR(error); \ | |
53 } G_STMT_END | |
54 | |
55 | |
56 #define GAIM_DBUS_POINTER_TO_ID(id, ptr, error) \ | |
57 G_STMT_START { \ | |
58 id = gaim_dbus_pointer_to_id_error(ptr,error); \ | |
59 CHECK_ERROR(error); \ | |
60 } G_STMT_END | |
61 | |
11187 | 62 |
63 dbus_bool_t | |
64 gaim_dbus_message_get_args (DBusMessage *message, | |
65 DBusError *error, | |
66 int first_arg_type, | |
67 ...); | |
68 dbus_bool_t | |
69 gaim_dbus_message_get_args_valist (DBusMessage *message, | |
70 DBusError *error, | |
71 int first_arg_type, | |
72 va_list var_args); | |
73 | |
74 dbus_bool_t | |
75 gaim_dbus_message_iter_get_args (DBusMessageIter *iter, | |
76 DBusError *error, | |
77 int first_arg_type, | |
78 ...); | |
79 | |
80 dbus_bool_t | |
81 gaim_dbus_message_iter_get_args_valist (DBusMessageIter *iter, | |
82 DBusError *error, | |
83 int first_arg_type, | |
84 va_list var_args); | |
85 | |
11174 | 86 dbus_int32_t* gaim_dbusify_GList(GList *list, gboolean free_memory, |
87 dbus_int32_t *len); | |
88 dbus_int32_t* gaim_dbusify_GSList(GSList *list, gboolean free_memory, | |
89 dbus_int32_t *len); | |
11187 | 90 gpointer* gaim_GList_to_array(GList *list, gboolean free_memory, |
91 dbus_int32_t *len); | |
92 gpointer* gaim_GSList_to_array(GSList *list, gboolean free_memory, | |
93 dbus_int32_t *len); | |
94 GHashTable *gaim_dbus_iter_hash_table(DBusMessageIter *iter, DBusError *error); | |
95 | |
11174 | 96 const char* empty_to_null(const char *str); |
97 const char* null_to_empty(const char *s); | |
98 | |
99 typedef struct { | |
100 const char *name; | |
101 const char *parameters; | |
102 DBusMessage* (*handler)(DBusMessage *request, DBusError *error); | |
103 } GaimDBusBinding; | |
104 | |
105 void gaim_dbus_register_bindings(void *handle, GaimDBusBinding *bindings); | |
106 | |
107 DBusConnection *gaim_dbus_get_connection(void); | |
108 | |
11884 | 109 #ifdef __cplusplus |
110 } | |
11174 | 111 #endif |
11884 | 112 |
113 #endif |