11055
+ 鐃緒申��申鐃緒申 1 /**
+ 鐃緒申��申鐃緒申 2 * @file dbus-server.h Gaim DBUS Server
+ 鐃緒申��申鐃緒申 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_SERVER_H_
+ 鐃緒申��申鐃緒申 28 #define _GAIM_DBUS_SERVER_H_
+ 鐃緒申��申鐃緒申 29
11080
+ 鐃緒申��申鐃緒申 30 #include "value.h"
11067
+ 鐃緒申��申鐃緒申 31
11171
+ 鐃緒申��申鐃緒申 32
11055
+ 鐃緒申��申鐃緒申 33 G_BEGIN_DECLS
+ 鐃緒申��申鐃緒申 34
11171
+ 鐃緒申��申鐃緒申 35 /**
+ 鐃緒申��申鐃緒申 36 Types of pointers are identified by the ADDRESS of a GaimDbusType
+ 鐃緒申��申鐃緒申 37 object. This way, plugins can easily access types defined in gaim
+ 鐃緒申��申鐃緒申 38 proper as well as introduce their own types that will not conflict
+ 鐃緒申��申鐃緒申 39 with those introduced by other plugins.
+ 鐃緒申��申鐃緒申 40
+ 鐃緒申��申鐃緒申 41 The structure GaimDbusType has only one element #parent, which
+ 鐃緒申��申鐃緒申 42 contains a pointer to the parent type, or #NULL if the type has no
+ 鐃緒申��申鐃緒申 43 parent. Parent means the same as the base class is object oriented
+ 鐃緒申��申鐃緒申 44 programming.
+ 鐃緒申��申鐃緒申 45 */
+ 鐃緒申��申鐃緒申 46
+ 鐃緒申��申鐃緒申 47 typedef struct _GaimDBusType GaimDBusType;
+ 鐃緒申��申鐃緒申 48
+ 鐃緒申��申鐃緒申 49 struct _GaimDBusType {
+ 鐃緒申��申鐃緒申 50 GaimDBusType *parent;
+ 鐃緒申��申鐃緒申 51 };
11067
+ 鐃緒申��申鐃緒申 52
11171
+ 鐃緒申��申鐃緒申 53 /* By convesion, the GaimDBusType variable representing each structure
+ 鐃緒申��申鐃緒申 54 GaimSomeStructure has the name GAIM_DBUS_TYPE_GaimSomeStructure.
+ 鐃緒申��申鐃緒申 55 The following macros facilitate defining such variables
11067
+ 鐃緒申��申鐃緒申 56
11171
+ 鐃緒申��申鐃緒申 57 #GAIM_DBUS_DECLARE_TYPE declares an extern variable representing a
+ 鐃緒申��申鐃緒申 58 given type, for use in header files.
+ 鐃緒申��申鐃緒申 59
+ 鐃緒申��申鐃緒申 60 #GAIM_DBUS_DEFINE_TYPE defines a variable representing a given
+ 鐃緒申��申鐃緒申 61 type, use in .c files. It defines a new type without a parent; for
+ 鐃緒申��申鐃緒申 62 types with a parent use #GAIM_DBUS_DEFINE_INHERITING_TYPE.
+ 鐃緒申��申鐃緒申 63 */
11080
+ 鐃緒申��申鐃緒申 64
11171
+ 鐃緒申��申鐃緒申 65 #define GAIM_DBUS_TYPE(type) (&GAIM_DBUS_TYPE_##type)
+ 鐃緒申��申鐃緒申 66
+ 鐃緒申��申鐃緒申 67
+ 鐃緒申��申鐃緒申 68 #define GAIM_DBUS_DECLARE_TYPE(type) \
+ 鐃緒申��申鐃緒申 69 extern GaimDBusType GAIM_DBUS_TYPE_##type;
11067
+ 鐃緒申��申鐃緒申 70
11171
+ 鐃緒申��申鐃緒申 71 #define GAIM_DBUS_DEFINE_TYPE(type) \
+ 鐃緒申��申鐃緒申 72 GaimDBusType GAIM_DBUS_TYPE_##type = { NULL };
11080
+ 鐃緒申��申鐃緒申 73
11171
+ 鐃緒申��申鐃緒申 74 #define GAIM_DBUS_DEFINE_INHERITING_TYPE(type, parent) \
+ 鐃緒申��申鐃緒申 75 GaimDBusType GAIM_DBUS_TYPE_##type = { GAIM_DBUS_TYPE(parent) };
+ 鐃緒申��申鐃緒申 76
11055
+ 鐃緒申��申鐃緒申 77
11067
+ 鐃緒申��申鐃緒申 78 /**
+ 鐃緒申��申鐃緒申 79 Initializes gaim dbus pointer registration engine.
+ 鐃緒申��申鐃緒申 80
+ 鐃緒申��申鐃緒申 81 Remote dbus applications need a way of addressing objects exposed
+ 鐃緒申��申鐃緒申 82 by gaim to the outside world. In gaim itself, these objects (such
+ 鐃緒申��申鐃緒申 83 as GaimBuddy and company) are identified by pointers. The gaim
+ 鐃緒申��申鐃緒申 84 dbus pointer registration engine converts pointers to handles and
+ 鐃緒申��申鐃緒申 85 back.
+ 鐃緒申��申鐃緒申 86
+ 鐃緒申��申鐃緒申 87 In order for an object to participate in the scheme, it must
+ 鐃緒申��申鐃緒申 88 register itself and its type with the engine. This registration
+ 鐃緒申��申鐃緒申 89 allocates an integer id which can be resolved to the pointer and
+ 鐃緒申��申鐃緒申 90 back.
+ 鐃緒申��申鐃緒申 91
+ 鐃緒申��申鐃緒申 92 Handles are not persistent. They are reissued every time gaim is
+ 鐃緒申��申鐃緒申 93 started. This is not good; external applications that use gaim
+ 鐃緒申��申鐃緒申 94 should work even whether gaim was restarted in the middle of the
+ 鐃緒申��申鐃緒申 95 interaction.
+ 鐃緒申��申鐃緒申 96
+ 鐃緒申��申鐃緒申 97 Pointer registration is only a temporary solution. When GaimBuddy
+ 鐃緒申��申鐃緒申 98 and similar structures have been converted into gobjects, this
+ 鐃緒申��申鐃緒申 99 registration will be done automatically by objects themselves.
+ 鐃緒申��申鐃緒申 100
+ 鐃緒申��申鐃緒申 101 By the way, this kind of object-handle translation should be so
+ 鐃緒申��申鐃緒申 102 common that there must be a library (maybe even glib) that
+ 鐃緒申��申鐃緒申 103 implements it. I feel a bit like reinventing the wheel here.
+ 鐃緒申��申鐃緒申 104 */
+ 鐃緒申��申鐃緒申 105 void gaim_dbus_init_ids(void);
+ 鐃緒申��申鐃緒申 106
+ 鐃緒申��申鐃緒申 107 /**
+ 鐃緒申��申鐃緒申 108 Registers a typed pointer.
+ 鐃緒申��申鐃緒申 109
11129
+ 鐃緒申��申鐃緒申 110 @param node The pointer to register.
+ 鐃緒申��申鐃緒申 111 @param type Type of that pointer.
11067
+ 鐃緒申��申鐃緒申 112 */
11171
+ 鐃緒申��申鐃緒申 113 void gaim_dbus_register_pointer(gpointer node, GaimDBusType *type);
11067
+ 鐃緒申��申鐃緒申 114
+ 鐃緒申��申鐃緒申 115 /**
+ 鐃緒申��申鐃緒申 116 Unregisters a pointer previously registered with
+ 鐃緒申��申鐃緒申 117 gaim_dbus_register_pointer.
+ 鐃緒申��申鐃緒申 118
11129
+ 鐃緒申��申鐃緒申 119 @param node The pointer to register.
11067
+ 鐃緒申��申鐃緒申 120 */
+ 鐃緒申��申鐃緒申 121 void gaim_dbus_unregister_pointer(gpointer node);
+ 鐃緒申��申鐃緒申 122
11080
+ 鐃緒申��申鐃緒申 123
+ 鐃緒申��申鐃緒申 124
+ 鐃緒申��申鐃緒申 125 /**
+ 鐃緒申��申鐃緒申 126 Emits a dbus signal.
+ 鐃緒申��申鐃緒申 127
11171
+ 鐃緒申��申鐃緒申 128 @param name The name of the signal ("bla-bla-blaa")
11080
+ 鐃緒申��申鐃緒申 129 @param num_values The number of parameters.
+ 鐃緒申��申鐃緒申 130 @param values Array of pointers to #GaimValue objects representing
+ 鐃緒申��申鐃緒申 131 the types of the parameters.
+ 鐃緒申��申鐃緒申 132 @param vargs A va_list containing the actual parameters.
11171
+ 鐃緒申��申鐃緒申 133 */
+ 鐃緒申��申鐃緒申 134 void gaim_dbus_signal_emit_gaim(char *name, int num_values,
+ 鐃緒申��申鐃緒申 135 GaimValue **values, va_list vargs);
11080
+ 鐃緒申��申鐃緒申 136
11171
+ 鐃緒申��申鐃緒申 137 /**
+ 鐃緒申��申鐃緒申 138 * Starts the gaim DBUS server. It is responsible for handling DBUS
+ 鐃緒申��申鐃緒申 139 * requests from other applications.
+ 鐃緒申��申鐃緒申 140 *
+ 鐃緒申��申鐃緒申 141 * @return TRUE if successful, FALSE otherwise.
+ 鐃緒申��申鐃緒申 142 */
+ 鐃緒申��申鐃緒申 143 gboolean gaim_dbus_init(void);
+ 鐃緒申��申鐃緒申 144
11080
+ 鐃緒申��申鐃緒申 145
+ 鐃緒申��申鐃緒申 146
11171
+ 鐃緒申��申鐃緒申 147 /**
+ 鐃緒申��申鐃緒申 148
+ 鐃緒申��申鐃緒申 149 Macro #DBUS_EXPORT expands to nothing. It is used to indicate to the
+ 鐃緒申��申鐃緒申 150 #dbus-analize-functions.py script that the given function should be
+ 鐃緒申��申鐃緒申 151 available to other applications through DBUS. If
+ 鐃緒申��申鐃緒申 152 #dbus-analize-functions.py is run without the "--export-only" option,
+ 鐃緒申��申鐃緒申 153 this prefix is ignored.
+ 鐃緒申��申鐃緒申 154
+ 鐃緒申��申鐃緒申 155 */
+ 鐃緒申��申鐃緒申 156
+ 鐃緒申��申鐃緒申 157 #define DBUS_EXPORT
+ 鐃緒申��申鐃緒申 158
+ 鐃緒申��申鐃緒申 159 /*
+ 鐃緒申��申鐃緒申 160 Here we include the list of #GAIM_DBUS_DECLARE_TYPE statements for
+ 鐃緒申��申鐃緒申 161 all structs defined in gaim. This file has been generated by the
+ 鐃緒申��申鐃緒申 162 #dbus-analize-types.py script.
+ 鐃緒申��申鐃緒申 163 */
+ 鐃緒申��申鐃緒申 164
+ 鐃緒申��申鐃緒申 165 #include "dbus-types.h"
11067
+ 鐃緒申��申鐃緒申 166
11055
+ 鐃緒申��申鐃緒申 167 G_END_DECLS
+ 鐃緒申��申鐃緒申 168
+ 鐃緒申��申鐃緒申 169 #endif /* _GAIM_DBUS_SERVER_H_ */