~ubuntu-branches/ubuntu/quantal/ibus/quantal

« back to all changes in this revision

Viewing changes to src/ibusproxy.h

  • Committer: Bazaar Package Importer
  • Author(s): Barry Warsaw
  • Date: 2011-08-11 17:00:57 UTC
  • mfrom: (6.2.14 sid)
  • Revision ID: james.westby@ubuntu.com-20110811170057-6dmbfs4s3cchzl7x
Tags: 1.3.99.20110419-1ubuntu1
* Merge with Debian unstable.  Remaining Ubuntu changes:
  - Indicator support:
    + Add 05_appindicator.patch: Use an indicator rather than a notification
      icon.
    + debian/control: Recommend python-appindicator.
  - debian/control: Install im-switch instead of im-config by default.
  - debian/README.source: Removed, it was outdated and no longer correct
  - debian/patches/01_ubuntu_desktop: Fix "Desktop entry needs the
    X-Ubuntu-Gettext-Domain key"  (LP: #457632)
  - debian/patches/02_title_update.patch: Rename "IBus Preferences" to
    "Keyboard Input Methods"
  - debian/patches/06_locale_parser.patch: Cherry-picked from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
20
 * Boston, MA 02111-1307, USA.
21
21
 */
 
22
 
 
23
#if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION)
 
24
#error "Only <ibus.h> can be included directly"
 
25
#endif
 
26
 
22
27
/**
23
28
 * SECTION: ibusproxy
24
29
 * @short_description: Base proxy object.
34
39
#ifndef __IBUS_PROXY_H_
35
40
#define __IBUS_PROXY_H_
36
41
 
37
 
#include "ibusobject.h"
38
 
#include "ibusconnection.h"
39
 
#include "ibusmessage.h"
 
42
#include <gio/gio.h>
40
43
 
41
44
/*
42
45
 * Type macros.
61
64
typedef struct _IBusProxy IBusProxy;
62
65
typedef struct _IBusProxyClass IBusProxyClass;
63
66
 
 
67
#define IBUS_PROXY_FLAGS(obj)             (IBUS_PROXY (obj)->flags)
 
68
#define IBUS_PROXY_SET_FLAGS(obj,flag)    G_STMT_START{ (IBUS_PROXY_FLAGS (obj) |= (flag)); }G_STMT_END
 
69
#define IBUS_PROXY_UNSET_FLAGS(obj,flag)  G_STMT_START{ (IBUS_PROXY_FLAGS (obj) &= ~(flag)); }G_STMT_END
 
70
#define IBUS_PROXY_DESTROYED(obj)         (IBUS_PROXY_FLAGS (obj) & IBUS_DESTROYED)
 
71
 
64
72
/**
65
73
 * IBusProxy:
66
74
 *
67
75
 * An opaque data type representing an IBusProxy.
68
76
 */
69
77
struct _IBusProxy {
70
 
    IBusObject parent;
 
78
    GDBusProxy parent;
71
79
    /* instance members */
 
80
    guint32 flags;
 
81
    gboolean own;
72
82
};
73
83
 
74
84
struct _IBusProxyClass {
75
 
    IBusObjectClass parent;
 
85
    GDBusProxyClass parent;
76
86
 
77
87
    /* class members */
78
 
    gboolean    (* ibus_signal)     (IBusProxy      *proxy,
79
 
                                     IBusMessage    *message);
 
88
    void    (* destroy)     (IBusProxy      *proxy);
80
89
    /*< private >*/
81
90
    /* padding */
82
91
    gpointer pdummy[7];
83
92
};
84
93
 
85
 
GType            ibus_proxy_get_type        (void);
86
 
 
87
 
/**
88
 
 * ibus_proxy_new:
89
 
 * @name: The service name of proxy object.
90
 
 * @path: The path of proxy object.
91
 
 * @connection: An IBusConnection.
92
 
 * @returns: A newly allocated IBusProxy instance.
93
 
 *
94
 
 * New an IBusProxy instance.
95
 
 * Property IBusProxy:name is set as @name, and
96
 
 * IBusProxy:path is set as @path.
97
 
 */
98
 
IBusProxy       *ibus_proxy_new             (const gchar        *name,
99
 
                                             const gchar        *path,
100
 
                                             IBusConnection     *connection);
101
 
 
102
 
/**
103
 
 * ibus_proxy_send:
104
 
 * @proxy: An IBusProxy.
105
 
 * @message: The IBusMessage to be sent.
106
 
 * @returns: TRUE if succeed; FALSE otherwise.
107
 
 *
108
 
 * Send an #IBusMessage to the corresponding service.
109
 
 *
110
 
 * @see_also ibus_proxy_call(), ibus_proxy_send_with_reply(), ibus_proxy_send_with_reply_and_block().
111
 
 */
112
 
gboolean         ibus_proxy_send            (IBusProxy          *proxy,
113
 
                                             IBusMessage        *message);
114
 
 
115
 
/**
116
 
 * ibus_proxy_call:
117
 
 * @proxy: An IBusProxy.
118
 
 * @method: The method to be called.
119
 
 * @first_arg_type: Type of first argument.
120
 
 * @...: Rest of arguments, NULL to mark the end.
121
 
 * @returns: TRUE if succeed; FALSE otherwise.
122
 
 *
123
 
 * Call a method of the corresponding service.
124
 
 *
125
 
 * @see_also ibus_proxy_send(), ibus_proxy_call_with_reply(), ibus_proxy_call_with_reply_and_block().
126
 
 */
127
 
gboolean         ibus_proxy_call            (IBusProxy          *proxy,
128
 
                                             const gchar        *method,
129
 
                                             GType               first_arg_type,
130
 
                                             ...);
131
 
 
132
 
/**
133
 
 * ibus_proxy_call_with_reply:
134
 
 * @proxy: An IBusProxy.
135
 
 * @method: The method to be called.
136
 
 * @pending: Return location of a IBusPendingCall object, or NULL if connection is disconnected.
137
 
 * @timeout_milliseconds: Time out in milliseconds.
138
 
 * @error: Returned error is stored here; NULL to ignore error.
139
 
 * @first_arg_type: Type of first argument.
140
 
 * @...: Rest of arguments, NULL to mark the end.
141
 
 * @returns: TRUE if succeed; FALSE otherwise.
142
 
 *
143
 
 * Call a method of the corresponding service, and returns an IBusPendingCall used to receive a reply to the message.
144
 
 * This function calls ibus_connection_send_with_reply() to do the actual sending.
145
 
 *
146
 
 * @see_also: ibus_connection_send_with_reply(), ibus_proxy_call(),
147
 
 * ibus_proxy_send_with_reply(), ibus_proxy_call_with_reply_and_block().
148
 
 */
149
 
gboolean         ibus_proxy_call_with_reply (IBusProxy          *proxy,
150
 
                                             const gchar        *method,
151
 
                                             IBusPendingCall   **pending,
152
 
                                             gint                timeout_milliseconds,
153
 
                                             IBusError         **error,
154
 
                                             GType              first_arg_type,
155
 
                                             ...);
156
 
 
157
 
/**
158
 
 * ibus_proxy_call_with_reply_and_block:
159
 
 * @proxy: An IBusProxy.
160
 
 * @method: The method to be called.
161
 
 * @timeout_milliseconds: Time out in milliseconds.
162
 
 * @error: Returned error is stored here; NULL to ignore error.
163
 
 * @first_arg_type: Type of first argument.
164
 
 * @...: Rest of arguments, NULL to mark the end.
165
 
 * @returns: An IBusMessage that is the reply or NULL with an error code if the function fails.
166
 
 *
167
 
 * Call a method of the corresponding service and blocks a certain time period while waiting for
168
 
 * an IBusMessage as reply.
169
 
 * If the IBusMessage is not NULL, it calls ibus_connection_send_with_reply_and_block() to do the
170
 
 * actual sending.
171
 
 *
172
 
 * @see_also: ibus_connection_send_with_reply_and_block(), ibus_proxy_call(), 
173
 
 * ibus_proxy_send_with_reply(), ibus_proxy_call_with_reply_and_block().
174
 
 */
175
 
IBusMessage     *ibus_proxy_call_with_reply_and_block
176
 
                                            (IBusProxy          *proxy,
177
 
                                             const gchar        *method,
178
 
                                             gint                timeout_milliseconds,
179
 
                                             IBusError         **error,
180
 
                                             GType               first_arg_type,
181
 
                                            ...);
182
 
 
183
 
/**
184
 
 * ibus_proxy_send_with_reply:
185
 
 * @proxy: An IBusProxy.
186
 
 * @message: The IBusMessage to be sent.
187
 
 * @pending: Return location of a IBusPendingCall object, or NULL if connection is disconnected.
188
 
 * @timeout_milliseconds: Time out in milliseconds.
189
 
 * @returns: TRUE if succeed; FALSE otherwise.
190
 
 *
191
 
 * Send an IBusMessage to the corresponding service and returns
192
 
 * an IBusPendingCall used to receive a reply to the message.
193
 
 * This function calls ibus_connection_send_with_reply() to do the actual sending.
194
 
 *
195
 
 * @see_also: ibus_connection_send_with_reply(), ibus_proxy_send(),
196
 
 * ibus_proxy_call_with_reply(), ibus_proxy_send_with_reply_and_block().
197
 
 */
198
 
gboolean         ibus_proxy_send_with_reply (IBusProxy          *proxy,
199
 
                                             IBusMessage        *message,
200
 
                                             IBusPendingCall   **pending,
201
 
                                             gint                timeout_milliseconds);
202
 
 
203
 
/**
204
 
 * ibus_proxy_send_with_reply_and_block:
205
 
 * @proxy: An IBusProxy.
206
 
 * @message: The IBusMessage to be sent.
207
 
 * @returns: An IBusMessage that is the reply or NULL with an error code if the function fails.
208
 
 *
209
 
 * Send an IBusMessage to the corresponding service and blocks a certain time period while waiting for
210
 
 * an IBusMessage as reply.
211
 
 * If the IBusMessage is not NULL, it calls ibus_connection_send_with_reply_and_block() to do the
212
 
 * actual sending.
213
 
 *
214
 
 * @see_also: ibus_connection_send_with_reply_and_block(), ibus_proxy_send(), ibus_proxy_send_with_reply(), 
215
 
 * ibus_proxy_call_with_reply_and_block().
216
 
 */
217
 
IBusMessage     *ibus_proxy_send_with_reply_and_block
218
 
                                            (IBusProxy          *proxy,
219
 
                                             IBusMessage        *message);
220
 
 
221
 
/**
222
 
 * ibus_proxy_handle_signal:
223
 
 * @proxy: An IBusProxy.
224
 
 * @message: The IBusMessage to be sent.
225
 
 * @returns: TRUE if succeed; FALSE otherwise.
226
 
 *
227
 
 * Handle a signal by emitting IBusProxy::ibus-signal.
228
 
 *
229
 
 * If signal name is <constant>NameOwnerChanged</constant>
230
 
 * and the service name is identical to the old name, then
231
 
 * @proxy will be destroyed by ibus_object_destroy () and FALSE is returned.
232
 
 * Otherwise TRUE is returned.
233
 
 *
234
 
 * Note that if the path of of message is not identical to the IBusProxy:path
235
 
 * this function will not emit IBusProxy::ibus-signal.
236
 
 *
237
 
 */
238
 
gboolean         ibus_proxy_handle_signal   (IBusProxy          *proxy,
239
 
                                             IBusMessage        *message);
240
 
 
241
 
/**
242
 
 * ibus_proxy_get_name:
243
 
 * @proxy: An IBusProxy.
244
 
 * @returns: The service name of the proxy object.
245
 
 *
246
 
 * Get the service name of a proxy object.
247
 
 */
248
 
const gchar     *ibus_proxy_get_name        (IBusProxy          *proxy);
249
 
 
250
 
/**
251
 
 * ibus_proxy_get_unique_name:
252
 
 * @proxy: An IBusProxy.
253
 
 * @returns: The service name of the proxy object.
254
 
 *
255
 
 * Get the unique name of the proxy object.
256
 
 */
257
 
const gchar     *ibus_proxy_get_unique_name (IBusProxy          *proxy);
258
 
 
259
 
/**
260
 
 * ibus_proxy_get_path:
261
 
 * @proxy: An IBusProxy.
262
 
 * @returns: The path of proxy object.
263
 
 *
264
 
 * Get the path of a proxy object.
265
 
 */
266
 
const gchar     *ibus_proxy_get_path        (IBusProxy          *proxy);
267
 
 
268
 
/**
269
 
 * ibus_proxy_get_interface:
270
 
 * @proxy: An IBusProxy.
271
 
 * @returns: The service name of the proxy object.
272
 
 *
273
 
 * Get interface of a proxy object.
274
 
 */
275
 
const gchar     *ibus_proxy_get_interface   (IBusProxy          *proxy);
276
 
 
277
 
/**
278
 
 * ibus_proxy_get_connection:
279
 
 * @proxy: An IBusProxy.
280
 
 * @returns: (transfer none): The connection of the proxy object.
281
 
 *
282
 
 * Get the connection of a proxy object.
283
 
 */
284
 
IBusConnection  *ibus_proxy_get_connection  (IBusProxy          *proxy);
 
94
GType   ibus_proxy_get_type (void);
 
95
 
 
96
/**
 
97
 * ibus_proxy_destroy:
 
98
 *
 
99
 * Dispose the proxy object. If the dbus connection is alive and the own variable above
 
100
 * is TRUE (which is the default), org.freedesktop.IBus.Service.Destroy method will be
 
101
 * called. Note that "destroy" signal might be emitted when ibus_proxy_destroy is called
 
102
 * or the underlying dbus connection for the proxy is terminated. In the callback of the
 
103
 * destroy signal, you might have to call something like 'g_object_unref(the_proxy);'.
 
104
 */
 
105
void    ibus_proxy_destroy  (IBusProxy      *proxy);
285
106
 
286
107
G_END_DECLS
287
108
#endif