Add purple_util_write_data_to_*_file declarations
[pidgin-git.git] / libpurple / dbus-bindings.h
blob3fa179eb2c123f85b9c7069da7a28b61d6da6ae2
1 /* purple
3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
5 * source distribution.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 #ifndef _PURPLE_DBUS_BINDINGS_H_
24 #define _PURPLE_DBUS_BINDINGS_H_
25 /**
26 * SECTION:dbus-bindings
27 * @section_id: libpurple-dbus-bindings
28 * @short_description: <filename>dbus-bindings.h</filename>
29 * @title: DBUS Bindings
32 #include <dbus/dbus.h>
33 #include <dbus/dbus-glib-lowlevel.h>
34 #include <glib.h>
36 G_BEGIN_DECLS
38 gint purple_dbus_pointer_to_id(gconstpointer node);
39 gpointer purple_dbus_id_to_pointer(gint id, PurpleDBusType *type);
40 gint purple_dbus_pointer_to_id_error(gconstpointer ptr, DBusError *error);
41 gpointer purple_dbus_id_to_pointer_error(gint id, PurpleDBusType *type,
42 const char *typename, DBusError *error);
44 #define NULLIFY(id) id = purple_emptystr_to_null(id)
46 #define CHECK_ERROR(error) if (dbus_error_is_set(error)) return NULL;
48 #define PURPLE_DBUS_ID_TO_POINTER(ptr, id, type, error) \
49 G_STMT_START { \
50 ptr = (type*) purple_dbus_id_to_pointer_error \
51 (id, PURPLE_DBUS_TYPE(type), #type, error); \
52 CHECK_ERROR(error); \
53 } G_STMT_END
56 #define PURPLE_DBUS_POINTER_TO_ID(id, ptr, error) \
57 G_STMT_START { \
58 id = purple_dbus_pointer_to_id_error(ptr,error); \
59 CHECK_ERROR(error); \
60 } G_STMT_END
63 dbus_bool_t
64 purple_dbus_message_get_args (DBusMessage *message,
65 DBusError *error,
66 int first_arg_type,
67 ...);
68 dbus_bool_t
69 purple_dbus_message_get_args_valist (DBusMessage *message,
70 DBusError *error,
71 int first_arg_type,
72 va_list var_args);
74 dbus_bool_t
75 purple_dbus_message_iter_get_args (DBusMessageIter *iter,
76 DBusError *error,
77 int first_arg_type,
78 ...);
80 dbus_bool_t
81 purple_dbus_message_iter_get_args_valist (DBusMessageIter *iter,
82 DBusError *error,
83 int first_arg_type,
84 va_list var_args);
86 dbus_int32_t* purple_dbusify_GList(GList *list, dbus_int32_t *len);
87 dbus_int32_t* purple_dbusify_GSList(GSList *list, dbus_int32_t *len);
88 gpointer* purple_GList_to_array(GList *list, dbus_int32_t *len);
89 gpointer* purple_GSList_to_array(GSList *list, dbus_int32_t *len);
90 GHashTable *purple_dbus_iter_hash_table(DBusMessageIter *iter, DBusError *error);
92 const char* purple_emptystr_to_null(const char *str);
93 const char* purple_null_to_emptystr(const char *s);
95 typedef struct {
96 const char *name;
97 const char *parameters;
98 DBusMessage* (*handler)(DBusMessage *request, DBusError *error);
99 } PurpleDBusBinding;
101 void purple_dbus_register_bindings(void *handle, PurpleDBusBinding *bindings);
103 DBusConnection *purple_dbus_get_connection(void);
105 G_END_DECLS
107 #endif