annotate src/dbus-bindings.h @ 12724:10ef9171ca87

[gaim-migrate @ 15068] Don't have a separate popular status list. That was stupid. Instead, keep the saved_status GList sorted by popularity. This should be faster for the few things that it affects, and it fixes the bug where the docklet wouldn't show popular statuses at startup committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 05 Jan 2006 00:11:20 +0000
parents b1099e09eb33
children
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 /**
11501
9563b768e8e2 [gaim-migrate @ 13746]
Richard Laager <rlaager@wiktel.com>
parents: 11187
diff changeset
2 * @file dbus-bindings.h Gaim DBUS Bindings
11174
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
11884
b1099e09eb33 [gaim-migrate @ 14175]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11501
diff changeset
34 #ifdef __cplusplus
b1099e09eb33 [gaim-migrate @ 14175]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11501
diff changeset
35 extern "C" {
b1099e09eb33 [gaim-migrate @ 14175]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11501
diff changeset
36 #endif
b1099e09eb33 [gaim-migrate @ 14175]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11501
diff changeset
37
11174
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
38 gint gaim_dbus_pointer_to_id(gpointer node);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
39 gpointer gaim_dbus_id_to_pointer(gint id, GaimDBusType *type);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
40 gint gaim_dbus_pointer_to_id_error(gpointer ptr, DBusError *error);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
41 gpointer gaim_dbus_id_to_pointer_error(gint id, GaimDBusType *type,
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
42 const char *typename, DBusError *error);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
43
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
44 #define NULLIFY(id) id = empty_to_null(id)
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
45
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
46 #define CHECK_ERROR(error) if (dbus_error_is_set(error)) return NULL;
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
47
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
48 #define GAIM_DBUS_ID_TO_POINTER(ptr, id, type, error) \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
49 G_STMT_START { \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
50 ptr = (type*) gaim_dbus_id_to_pointer_error \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
51 (id, GAIM_DBUS_TYPE(type), #type, error); \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
52 CHECK_ERROR(error); \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
53 } G_STMT_END
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
54
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
55
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
56 #define GAIM_DBUS_POINTER_TO_ID(id, ptr, error) \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
57 G_STMT_START { \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
58 id = gaim_dbus_pointer_to_id_error(ptr,error); \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
59 CHECK_ERROR(error); \
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
60 } G_STMT_END
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
61
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
62
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
63 dbus_bool_t
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
64 gaim_dbus_message_get_args (DBusMessage *message,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
65 DBusError *error,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
66 int first_arg_type,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
67 ...);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
68 dbus_bool_t
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
69 gaim_dbus_message_get_args_valist (DBusMessage *message,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
70 DBusError *error,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
71 int first_arg_type,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
72 va_list var_args);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
73
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
74 dbus_bool_t
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
75 gaim_dbus_message_iter_get_args (DBusMessageIter *iter,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
76 DBusError *error,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
77 int first_arg_type,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
78 ...);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
79
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
80 dbus_bool_t
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
81 gaim_dbus_message_iter_get_args_valist (DBusMessageIter *iter,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
82 DBusError *error,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
83 int first_arg_type,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
84 va_list var_args);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
85
11174
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
86 dbus_int32_t* gaim_dbusify_GList(GList *list, gboolean free_memory,
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
87 dbus_int32_t *len);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
88 dbus_int32_t* gaim_dbusify_GSList(GSList *list, gboolean free_memory,
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
89 dbus_int32_t *len);
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
90 gpointer* gaim_GList_to_array(GList *list, gboolean free_memory,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
91 dbus_int32_t *len);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
92 gpointer* gaim_GSList_to_array(GSList *list, gboolean free_memory,
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
93 dbus_int32_t *len);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
94 GHashTable *gaim_dbus_iter_hash_table(DBusMessageIter *iter, DBusError *error);
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11174
diff changeset
95
11174
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
96 const char* empty_to_null(const char *str);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
97 const char* null_to_empty(const char *s);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
98
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
99 typedef struct {
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
100 const char *name;
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
101 const char *parameters;
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
102 DBusMessage* (*handler)(DBusMessage *request, DBusError *error);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
103 } GaimDBusBinding;
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
104
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
105 void gaim_dbus_register_bindings(void *handle, GaimDBusBinding *bindings);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
106
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
107 DBusConnection *gaim_dbus_get_connection(void);
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
108
11884
b1099e09eb33 [gaim-migrate @ 14175]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11501
diff changeset
109 #ifdef __cplusplus
b1099e09eb33 [gaim-migrate @ 14175]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11501
diff changeset
110 }
11174
9aae0a11de03 [gaim-migrate @ 13279]
Piotr Zielinski <zielaj>
parents:
diff changeset
111 #endif
11884
b1099e09eb33 [gaim-migrate @ 14175]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11501
diff changeset
112
b1099e09eb33 [gaim-migrate @ 14175]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11501
diff changeset
113 #endif