Mercurial > pidgin
comparison libpurple/dbus-bindings.h @ 15373:5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sat, 20 Jan 2007 02:32:10 +0000 |
parents | |
children | 32c366eeeb99 |
comparison
equal
deleted
inserted
replaced
15372:f79e0f4df793 | 15373:5fe8042783c1 |
---|---|
1 /** | |
2 * @file dbus-bindings.h Gaim DBUS Bindings | |
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 | |
34 #ifdef __cplusplus | |
35 extern "C" { | |
36 #endif | |
37 | |
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 | |
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 | |
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); | |
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 | |
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 | |
109 #ifdef __cplusplus | |
110 } | |
111 #endif | |
112 | |
113 #endif |