annotate src/dbus-bindings.h @ 11274:67a929d50cfe

[gaim-migrate @ 13459] commit the make dist changes to po files, as otherwise it takes 15 minutes to process them (and a minute amount of time after the first attempt) committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 15 Aug 2005 16:22:25 +0000
parents 744c0708d11f
children 9563b768e8e2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11174
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
1 /**
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
2 * @file dbus-server.h Gaim DBUS Server
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
3 * @ingroup core
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
4 *
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
5 * gaim
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
6 *
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
9 * source distribution.
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
10 *
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
14 * (at your option) any later version.
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
15 *
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
19 * GNU General Public License for more details.
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
20 *
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
24 *
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
25 */
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
26
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
27 #ifndef _GAIM_DBUS_BINDINGS_H_
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
28 #define _GAIM_DBUS_BINDINGS_H_
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
29
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
30 #include <dbus/dbus.h>
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
31 #include <dbus/dbus-glib-lowlevel.h>
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
32 #include <glib.h>
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
33
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
34 gint gaim_dbus_pointer_to_id(gpointer node);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
35 gpointer gaim_dbus_id_to_pointer(gint id, GaimDBusType *type);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
36 gint gaim_dbus_pointer_to_id_error(gpointer ptr, DBusError *error);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
37 gpointer gaim_dbus_id_to_pointer_error(gint id, GaimDBusType *type,
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
38 const char *typename, DBusError *error);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
39
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
40 #define NULLIFY(id) id = empty_to_null(id)
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
41
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
42 #define CHECK_ERROR(error) if (dbus_error_is_set(error)) return NULL;
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
43
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
44 #define GAIM_DBUS_ID_TO_POINTER(ptr, id, type, error) \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
45 G_STMT_START { \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
46 ptr = (type*) gaim_dbus_id_to_pointer_error \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
47 (id, GAIM_DBUS_TYPE(type), #type, error); \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
48 CHECK_ERROR(error); \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
49 } G_STMT_END
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
50
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
51
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
52
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
53 #define GAIM_DBUS_POINTER_TO_ID(id, ptr, error) \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
54 G_STMT_START { \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
55 id = gaim_dbus_pointer_to_id_error(ptr,error); \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
56 CHECK_ERROR(error); \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
57 } G_STMT_END
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
58
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
59
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
60 dbus_bool_t
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
61 gaim_dbus_message_get_args (DBusMessage *message,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
62 DBusError *error,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
63 int first_arg_type,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
64 ...);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
65 dbus_bool_t
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
66 gaim_dbus_message_get_args_valist (DBusMessage *message,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
67 DBusError *error,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
68 int first_arg_type,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
69 va_list var_args);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
70
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
71 dbus_bool_t
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
72 gaim_dbus_message_iter_get_args (DBusMessageIter *iter,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
73 DBusError *error,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
74 int first_arg_type,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
75 ...);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
76
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
77 dbus_bool_t
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
78 gaim_dbus_message_iter_get_args_valist (DBusMessageIter *iter,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
79 DBusError *error,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
80 int first_arg_type,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
81 va_list var_args);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
82
11174
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
83 dbus_int32_t* gaim_dbusify_GList(GList *list, gboolean free_memory,
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
84 dbus_int32_t *len);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
85 dbus_int32_t* gaim_dbusify_GSList(GSList *list, gboolean free_memory,
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
86 dbus_int32_t *len);
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
87 gpointer* gaim_GList_to_array(GList *list, gboolean free_memory,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
88 dbus_int32_t *len);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
89 gpointer* gaim_GSList_to_array(GSList *list, gboolean free_memory,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
90 dbus_int32_t *len);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
91 GHashTable *gaim_dbus_iter_hash_table(DBusMessageIter *iter, DBusError *error);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
92
11174
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
93 const char* empty_to_null(const char *str);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
94 const char* null_to_empty(const char *s);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
95
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
96 typedef struct {
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
97 const char *name;
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
98 const char *parameters;
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
99 DBusMessage* (*handler)(DBusMessage *request, DBusError *error);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
100 } GaimDBusBinding;
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
101
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
102 void gaim_dbus_register_bindings(void *handle, GaimDBusBinding *bindings);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
103
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
104 DBusConnection *gaim_dbus_get_connection(void);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
105
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
106 #endif