1/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
2/* vim:set et sts=4: */
3/* ibus - The Input Bus
4 * Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
5 * Copyright (C) 2008-2013 Red Hat, Inc.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library 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 GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
20 * USA
21 */
22
23#if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION)
24#error "Only <ibus.h> can be included directly"
25#endif
26
27#ifndef __IBUS_BUS_H_
28#define __IBUS_BUS_H_
29
30/**
31 * SECTION: ibusbus
32 * @short_description: Connect with IBus daemon.
33 * @stability: Stable
34 *
35 * An IBusBus connects with IBus daemon.
36 */
37#include <gio/gio.h>
38#include <glib.h>
39#include "ibusinputcontext.h"
40#include "ibusconfig.h"
41#include "ibuscomponent.h"
42#include "ibusshare.h"
43
44/*
45 * Type macros.
46 */
47
48/* define GOBJECT macros */
49#define IBUS_TYPE_BUS \
50 (ibus_bus_get_type ())
51#define IBUS_BUS(obj) \
52 (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_BUS, IBusBus))
53#define IBUS_BUS_CLASS(klass) \
54 (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_BUS, IBusBusClass))
55#define IBUS_IS_BUS(obj) \
56 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_BUS))
57#define IBUS_IS_BUS_CLASS(klass) \
58 (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_BUS))
59#define IBUS_BUS_GET_CLASS(obj) \
60 (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_BUS, IBusBusClass))
61
62G_BEGIN_DECLS
63
64typedef struct _IBusBus IBusBus;
65typedef struct _IBusBusClass IBusBusClass;
66typedef struct _IBusBusPrivate IBusBusPrivate;
67
68/**
69 * IBusBus:
70 *
71 * An opaque data type representing IBus bus (daemon communication) status.
72 */
73struct _IBusBus {
74 IBusObject parent;
75 /* instance members */
76
77 IBusBusPrivate *priv;
78};
79
80struct _IBusBusClass {
81 IBusObjectClass parent;
82 /* class members */
83};
84
85GType ibus_bus_get_type (void);
86
87/**
88 * ibus_bus_new:
89 *
90 * Creates a new #IBusBus instance.
91 *
92 * Returns: A newly allocated #IBusBus instance, and the instance is not
93 * floating.
94 */
95IBusBus *ibus_bus_new (void);
96
97/**
98 * ibus_bus_new_async:
99 *
100 * Creates a new #IBusBus instance. The instance will asynchronously connect
101 * to the IBus daemon.
102 *
103 * Returns: A newly allocated #IBusBus instance, and the instance is not
104 * floating.
105 */
106IBusBus *ibus_bus_new_async (void);
107
108/**
109 * ibus_bus_new_async_client:
110 *
111 * Creates a new #IBusBus instance for client use only. It will possibly
112 * be limited in what it can do.
113 *
114 * The instance will asynchronously connect to the IBus daemon.
115 *
116 * Returns: A newly allocated #IBusBus instance, and the instance is not
117 * floating.
118 */
119IBusBus *ibus_bus_new_async_client (void);
120
121
122/**
123 * ibus_bus_is_connected:
124 * @bus: An #IBusBus.
125 *
126 * Return %TRUE if @bus is connected to IBus daemon.
127 *
128 * Returns: %TRUE if @bus is connected, %FALSE otherwise.
129 */
130gboolean ibus_bus_is_connected (IBusBus *bus);
131
132/**
133 * ibus_bus_get_connection:
134 * @bus: An #IBusBus.
135 *
136 * Gets a #GDBusConnection of an #IBusBus instance.
137 *
138 * Returns: (transfer none): A #GDBusConnection of an #IBusBus instance.
139 */
140GDBusConnection *
141 ibus_bus_get_connection (IBusBus *bus);
142
143/**
144 * ibus_bus_get_service_name:
145 * @bus: An #IBusBus.
146 *
147 * Return the main service name to use for calls on the ibus connection.
148 *
149 * Returns: at dbus name.
150 */
151const gchar * ibus_bus_get_service_name (IBusBus *bus);
152
153/**
154 * ibus_bus_hello:
155 * @bus: An #IBusBus.
156 *
157 * This function sends a "HELLO" message to DBus daemon,
158 * which replies the unique name of current IBus process.
159 *
160 * Returns: The unique name of IBus process in DBus.
161 */
162const gchar *ibus_bus_hello (IBusBus *bus);
163
164/**
165 * ibus_bus_request_name:
166 * @bus: the IBusBus instance to be processed.
167 * @name: Name to be requested.
168 * @flags: IBusBusNameFlag.
169 *
170 * Request a name from IBus daemon synchronously.
171 *
172 * Returns: 0 if failed; IBusBusRequestNameReply otherwise.
173 */
174guint32 ibus_bus_request_name (IBusBus *bus,
175 const gchar *name,
176 guint32 flags);
177
178/**
179 * ibus_bus_request_name_async:
180 * @bus: An #IBusBus.
181 * @name: Name to be requested.
182 * @flags: Flags (FixMe).
183 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
184 * @cancellable: A #GCancellable or %NULL.
185 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL
186 * if you don't care about the result of the method invocation.
187 * @user_data: The data to pass to callback.
188 *
189 * Request a name from IBus daemon asynchronously.
190 */
191void ibus_bus_request_name_async (IBusBus *bus,
192 const gchar *name,
193 guint flags,
194 gint timeout_msec,
195 GCancellable *cancellable,
196 GAsyncReadyCallback
197 callback,
198 gpointer user_data);
199
200/**
201 * ibus_bus_request_name_async_finish:
202 * @bus: An #IBusBus.
203 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
204 * ibus_bus_request_name_async().
205 * @error: Return location for error or %NULL.
206 *
207 * Finishes an operation started with ibus_bus_request_name_async().
208 *
209 * Returns: 0 if failed; positive number otherwise.
210 */
211guint ibus_bus_request_name_async_finish
212 (IBusBus *bus,
213 GAsyncResult *res,
214 GError **error);
215
216/**
217 * ibus_bus_release_name:
218 * @bus: An #IBusBus.
219 * @name: Name to be released.
220 *
221 * Release a name to IBus daemon synchronously.
222 *
223 * Returns: 0 if failed; positive number otherwise.
224 */
225guint ibus_bus_release_name (IBusBus *bus,
226 const gchar *name);
227
228/**
229 * ibus_bus_release_name_async:
230 * @bus: An #IBusBus.
231 * @name: Name to be released.
232 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
233 * @cancellable: A #GCancellable or %NULL.
234 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
235 * or %NULL if you don't care about the result of the method invocation.
236 * @user_data: The data to pass to callback.
237 *
238 * Release a name to IBus daemon asynchronously.
239 */
240void ibus_bus_release_name_async
241 (IBusBus *bus,
242 const gchar *name,
243 gint timeout_msec,
244 GCancellable *cancellable,
245 GAsyncReadyCallback
246 callback,
247 gpointer user_data);
248
249/**
250 * ibus_bus_release_name_async_finish:
251 * @bus: An #IBusBus.
252 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
253 * ibus_bus_release_name_async().
254 * @error: Return location for error or %NULL.
255 *
256 * Finishes an operation started with ibus_bus_release_name_async().
257 *
258 * Returns: 0 if failed; positive number otherwise.
259 */
260guint ibus_bus_release_name_async_finish
261 (IBusBus *bus,
262 GAsyncResult *res,
263 GError **error);
264
265/**
266 * ibus_bus_list_queued_owners:
267 * @bus: An IBusBus.
268 * @name: Name to be queried.
269 *
270 * Lists the unique bus names of connections currently queued for a bus name.
271 * FIXME add an asynchronous version.
272 *
273 * Returns: (transfer full) (element-type utf8):
274 * The unique bus names of connections currently queued for @name.
275 */
276GList * ibus_bus_list_queued_owners
277 (IBusBus *bus,
278 const gchar *name);
279
280/**
281 * ibus_bus_name_has_owner:
282 * @bus: An #IBusBus.
283 * @name: Name to be checked.
284 *
285 * Checks whether the name has owner synchronously.
286 *
287 * Returns: %TRUE if the name has owner, %FALSE otherwise.
288 */
289gboolean ibus_bus_name_has_owner (IBusBus *bus,
290 const gchar *name);
291
292/**
293 * ibus_bus_name_has_owner_async:
294 * @bus: An #IBusBus.
295 * @name: Name to be checked.
296 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
297 * @cancellable: A #GCancellable or %NULL.
298 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
299 * or %NULL if you don't care about the result of the method invocation.
300 * @user_data: The data to pass to callback.
301 *
302 * Checks whether the name has owner asynchronously.
303 */
304void ibus_bus_name_has_owner_async
305 (IBusBus *bus,
306 const gchar *name,
307 gint timeout_msec,
308 GCancellable *cancellable,
309 GAsyncReadyCallback
310 callback,
311 gpointer user_data);
312
313/**
314 * ibus_bus_name_has_owner_async_finish:
315 * @bus: An #IBusBus.
316 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
317 * ibus_bus_name_has_owner_async().
318 * @error: Return location for error or %NULL.
319 *
320 * Finishes an operation started with ibus_bus_name_has_owner_async().
321 *
322 * Returns: %TRUE if the name has owner, %FALSE otherwise.
323 */
324gboolean ibus_bus_name_has_owner_async_finish
325 (IBusBus *bus,
326 GAsyncResult *res,
327 GError **error);
328
329/**
330 * ibus_bus_list_names:
331 * @bus: An #IBusBus.
332 *
333 * Return lists that attached to @bus.
334 * <note><para>[FixMe] Not implemented yet, only return %NULL.</para></note>
335 * <note><para>[FixMe] Add async version.</para></note>
336 *
337 * Returns: (transfer full) (element-type utf8): Lists that attached to @bus.
338 */
339GList *ibus_bus_list_names (IBusBus *bus);
340
341/**
342 * ibus_bus_add_match:
343 * @bus: An #IBusBus.
344 * @rule: Match rule.
345 *
346 * Add a match rule to an #IBusBus synchronously.
347 *
348 * Returns: %TRUE if the rule is added. %FALSE otherwise.
349 */
350gboolean ibus_bus_add_match (IBusBus *bus,
351 const gchar *rule);
352
353/**
354 * ibus_bus_add_match_async:
355 * @bus: An #IBusBus.
356 * @rule: Match rule.
357 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
358 * @cancellable: A #GCancellable or %NULL.
359 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
360 * or %NULL if you don't care about the result of the method invocation.
361 * @user_data: The data to pass to callback.
362 *
363 * Add a match rule to an #IBusBus asynchronously.
364 */
365void ibus_bus_add_match_async (IBusBus *bus,
366 const gchar *rule,
367 gint timeout_msec,
368 GCancellable *cancellable,
369 GAsyncReadyCallback
370 callback,
371 gpointer user_data);
372
373/**
374 * ibus_bus_add_match_async_finish:
375 * @bus: An #IBusBus.
376 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
377 * ibus_bus_add_match_async().
378 * @error: Return location for error or %NULL.
379 *
380 * Finishes an operation started with ibus_bus_add_match_async().
381 *
382 * Returns: %TRUE if the rule is added. %FALSE otherwise.
383 */
384gboolean ibus_bus_add_match_async_finish
385 (IBusBus *bus,
386 GAsyncResult *res,
387 GError **error);
388
389/**
390 * ibus_bus_remove_match:
391 * @bus: An #IBusBus.
392 * @rule: Match rule.
393 *
394 * Remove a match rule to an #IBusBus synchronously.
395 *
396 * Returns: %TRUE if the rule is removed. %FALSE otherwise.
397 */
398gboolean ibus_bus_remove_match (IBusBus *bus,
399 const gchar *rule);
400
401/**
402 * ibus_bus_remove_match_async:
403 * @bus: An #IBusBus.
404 * @rule: Match rule.
405 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
406 * @cancellable: A #GCancellable or %NULL.
407 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
408 * or %NULL if you don't care about the result of the method invocation.
409 * @user_data: The data to pass to callback.
410 *
411 * Remove a match rule to an IBusBus asynchronously.
412 */
413void ibus_bus_remove_match_async
414 (IBusBus *bus,
415 const gchar *rule,
416 gint timeout_msec,
417 GCancellable *cancellable,
418 GAsyncReadyCallback
419 callback,
420 gpointer user_data);
421
422/**
423 * ibus_bus_remove_match_async_finish:
424 * @bus: An #IBusBus.
425 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
426 * ibus_bus_remove_match_async().
427 * @error: Return location for error or %NULL.
428 *
429 * Finishes an operation started with ibus_bus_remove_match_async().
430 *
431 * Returns: %TRUE if the rule is removed. %FALSE otherwise.
432 */
433gboolean ibus_bus_remove_match_async_finish
434 (IBusBus *bus,
435 GAsyncResult *res,
436 GError **error);
437
438/**
439 * ibus_bus_get_name_owner:
440 * @bus: An #IBusBus.
441 * @name: Name.
442 *
443 * Return the name owner synchronously.
444 *
445 * Returns: Owner of the name. The returned value must be freed with g_free().
446 */
447gchar *ibus_bus_get_name_owner (IBusBus *bus,
448 const gchar *name);
449
450/**
451 * ibus_bus_get_name_owner_async:
452 * @bus: An #IBusBus.
453 * @name: Name.
454 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
455 * @cancellable: A #GCancellable or %NULL.
456 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
457 * or %NULL if you don't care about the result of the method invocation.
458 * @user_data: The data to pass to callback.
459 *
460 * Return the name owner asynchronously.
461 */
462void ibus_bus_get_name_owner_async
463 (IBusBus *bus,
464 const gchar *name,
465 gint timeout_msec,
466 GCancellable *cancellable,
467 GAsyncReadyCallback
468 callback,
469 gpointer user_data);
470
471/**
472 * ibus_bus_get_name_owner_async_finish:
473 * @bus: An #IBusBus.
474 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
475 * ibus_bus_get_name_owner_async().
476 * @error: Return location for error or %NULL.
477 *
478 * Finishes an operation started with ibus_bus_get_name_owner_async().
479 *
480 * Returns: Owner of the name. The returned value must be freed with g_free().
481 */
482gchar *ibus_bus_get_name_owner_async_finish
483 (IBusBus *bus,
484 GAsyncResult *res,
485 GError **error);
486/* declare ibus methods */
487
488/**
489 * ibus_bus_exit:
490 * @bus: An #IBusBus.
491 * @restart: Whether restarting the ibus.
492 *
493 * Exit or restart ibus-daemon synchronously.
494 *
495 * Returns: %TRUE if the "Exit" call is suceeded, %FALSE otherwise.
496 */
497gboolean ibus_bus_exit (IBusBus *bus,
498 gboolean restart);
499
500/**
501 * ibus_bus_exit_async:
502 * @bus: An #IBusBus.
503 * @restart: Whether restarting the ibus.
504 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
505 * @cancellable: A #GCancellable or %NULL.
506 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
507 * or %NULL if you don't care about the result of the method invocation.
508 * @user_data: The data to pass to callback.
509 *
510 * Exit or restart ibus-daemon asynchronously.
511 */
512void ibus_bus_exit_async (IBusBus *bus,
513 gboolean restart,
514 gint timeout_msec,
515 GCancellable *cancellable,
516 GAsyncReadyCallback
517 callback,
518 gpointer user_data);
519
520/**
521 * ibus_bus_exit_async_finish:
522 * @bus: An #IBusBus.
523 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
524 * ibus_bus_exit_async().
525 * @error: Return location for error or %NULL.
526 *
527 * Finishes an operation started with ibus_bus_exit_async().
528 *
529 * Returns: %TRUE if the "Exit" call is suceeded, %FALSE otherwise.
530 */
531gboolean ibus_bus_exit_async_finish (IBusBus *bus,
532 GAsyncResult *res,
533 GError **error);
534
535/**
536 * ibus_bus_create_input_context:
537 * @bus: An #IBusBus.
538 * @client_name: Name of client.
539 * "CreateInputContext" call is suceeded, %NULL otherwise.
540 *
541 * Create an input context for client synchronously.
542 *
543 * Returns: (transfer full): An newly allocated #IBusInputContext if the
544 */
545IBusInputContext *
546 ibus_bus_create_input_context
547 (IBusBus *bus,
548 const gchar *client_name);
549
550/**
551 * ibus_bus_create_input_context_async:
552 * @bus: An #IBusBus.
553 * @client_name: Name of client.
554 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
555 * @cancellable: A #GCancellable or %NULL.
556 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
557 * It should not be %NULL.
558 * @user_data: The data to pass to callback.
559 *
560 * Create an input context for client asynchronously.
561 */
562void ibus_bus_create_input_context_async
563 (IBusBus *bus,
564 const gchar *client_name,
565 gint timeout_msec,
566 GCancellable *cancellable,
567 GAsyncReadyCallback
568 callback,
569 gpointer user_data);
570
571/**
572 * ibus_bus_create_input_context_async_finish:
573 * @bus: An #IBusBus.
574 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
575 * ibus_bus_create_input_context_async().
576 * @error: Return location for error or %NULL.
577 *
578 * Finishes an operation started with ibus_bus_create_input_context_async().
579 *
580 * Returns: (transfer full): An newly allocated #IBusInputContext if the
581 * "CreateInputContext" call is suceeded, %NULL otherwise.
582 */
583IBusInputContext *
584 ibus_bus_create_input_context_async_finish
585 (IBusBus *bus,
586 GAsyncResult *res,
587 GError **error);
588
589/**
590 * ibus_bus_current_input_context:
591 * @bus: An #IBusBus.
592 *
593 * Get the current focused input context synchronously.
594 *
595 * Returns: The named of currently focued #IBusInputContext if the
596 * "CurrentInputContext" call suceeded, %NULL otherwise. The return
597 * value must be freed with g_free().
598 */
599gchar *ibus_bus_current_input_context
600 (IBusBus *bus);
601
602/**
603 * ibus_bus_current_input_context_async:
604 * @bus: An #IBusBus.
605 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
606 * @cancellable: A #GCancellable or %NULL.
607 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
608 * or %NULL if you don't care about the result of the method invocation.
609 * @user_data: The data to pass to callback.
610 *
611 * Get the current focused input context asynchronously.
612 */
613void ibus_bus_current_input_context_async
614 (IBusBus *bus,
615 gint timeout_msec,
616 GCancellable *cancellable,
617 GAsyncReadyCallback
618 callback,
619 gpointer user_data);
620
621/**
622 * ibus_bus_current_input_context_async_finish:
623 * @bus: An #IBusBus.
624 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
625 * ibus_bus_current_input_context_async().
626 * @error: Return location for error or %NULL.
627 *
628 * Finishes an operation started with ibus_bus_current_input_context_async().
629 *
630 * Returns: The named of currently focued IBusInputContext if the
631 * "CurrentInputContext" call suceeded, %NULL otherwise. The return
632 * value must be freed with g_free().
633 */
634gchar *ibus_bus_current_input_context_async_finish
635 (IBusBus *bus,
636 GAsyncResult *res,
637 GError **error);
638
639/**
640 * ibus_bus_register_component:
641 * @bus: An #IBusBus.
642 * @component: A input engine component.
643 *
644 * Register a componet to an #IBusBus synchronously.
645 *
646 * Returns: %TRUE if the "RegisterComponent" call is suceeded, %FALSE otherwise.
647 */
648gboolean ibus_bus_register_component
649 (IBusBus *bus,
650 IBusComponent *component);
651
652/**
653 * ibus_bus_register_component_async:
654 * @bus: An #IBusBus.
655 * @component: A input engine component.
656 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
657 * @cancellable: A #GCancellable or %NULL.
658 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
659 * or %NULL if you don't care about the result of the method invocation.
660 * @user_data: The data to pass to callback.
661 *
662 * Register a componet to an #IBusBus asynchronously.
663 */
664void ibus_bus_register_component_async
665 (IBusBus *bus,
666 IBusComponent *component,
667 gint timeout_msec,
668 GCancellable *cancellable,
669 GAsyncReadyCallback
670 callback,
671 gpointer user_data);
672
673/**
674 * ibus_bus_register_component_async_finish:
675 * @bus: An #IBusBus.
676 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
677 * ibus_bus_register_component_async().
678 * @error: Return location for error or %NULL.
679 *
680 * Finishes an operation started with ibus_bus_register_component_async().
681 *
682 * Returns: %TRUE if the "RegisterComponent" call is suceeded, %FALSE otherwise.
683 */
684gboolean ibus_bus_register_component_async_finish
685 (IBusBus *bus,
686 GAsyncResult *res,
687 GError **error);
688
689/**
690 * ibus_bus_list_engines:
691 * @bus: An #IBusBus.
692 *
693 * List engines synchronously.
694 *
695 * Returns: (transfer container) (element-type IBusEngineDesc):
696 * A List of engines.
697 */
698GList *ibus_bus_list_engines (IBusBus *bus);
699
700/**
701 * ibus_bus_list_engines_async:
702 * @bus: An #IBusBus.
703 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
704 * @cancellable: A #GCancellable or %NULL.
705 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL
706 * if you don't care about the result of the method invocation.
707 * @user_data: The data to pass to callback.
708 *
709 * List engines asynchronously.
710 */
711void ibus_bus_list_engines_async
712 (IBusBus *bus,
713 gint timeout_msec,
714 GCancellable *cancellable,
715 GAsyncReadyCallback
716 callback,
717 gpointer user_data);
718
719/**
720 * ibus_bus_list_engines_async_finish:
721 * @bus: An #IBusBus.
722 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
723 * ibus_bus_list_engines_async().
724 * @error: Return location for error or %NULL.
725 *
726 * Finishes an operation started with ibus_bus_list_engines_async().
727 *
728 * Returns: (transfer container) (element-type IBusEngineDesc):
729 * A List of engines.
730 */
731GList *ibus_bus_list_engines_async_finish
732 (IBusBus *bus,
733 GAsyncResult *res,
734 GError **error);
735
736#ifndef IBUS_DISABLE_DEPRECATED
737/**
738 * ibus_bus_list_active_engines:
739 * @bus: An #IBusBus.
740 *
741 * List active engines synchronously.
742 *
743 * Returns: (transfer container) (element-type IBusEngineDesc):
744 * A List of active engines.
745 *
746 * Deprecated: 1.5.3: Read dconf value
747 * /desktop/ibus/general/preload-engines instead.
748 */
749IBUS_DEPRECATED
750GList *ibus_bus_list_active_engines
751 (IBusBus *bus);
752
753/**
754 * ibus_bus_list_active_engines_async:
755 * @bus: An #IBusBus.
756 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
757 * @cancellable: A #GCancellable or %NULL.
758 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL
759 * if you don't care about the result of the method invocation.
760 * @user_data: The data to pass to callback.
761 *
762 * List active engines asynchronously.
763 *
764 * Deprecated: 1.5.3: Read dconf value
765 * /desktop/ibus/general/preload-engines instead.
766 */
767IBUS_DEPRECATED
768void ibus_bus_list_active_engines_async
769 (IBusBus *bus,
770 gint timeout_msec,
771 GCancellable *cancellable,
772 GAsyncReadyCallback
773 callback,
774 gpointer user_data);
775
776/**
777 * ibus_bus_list_active_engines_async_finish:
778 * @bus: An #IBusBus.
779 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
780 * ibus_bus_list_active_engines_async().
781 * @error: Return location for error or %NULL.
782 *
783 * Finishes an operation started with ibus_bus_list_active_engines_async().
784 *
785 * Returns: (transfer container) (element-type IBusEngineDesc):
786 * A List of active engines.
787 *
788 * Deprecated: 1.5.3: Read dconf value
789 * /desktop/ibus/general/preload-engines instead.
790 */
791IBUS_DEPRECATED
792GList *ibus_bus_list_active_engines_async_finish
793 (IBusBus *bus,
794 GAsyncResult *res,
795 GError **error);
796#endif /* IBUS_DISABLE_DEPRECATED */
797
798/**
799 * ibus_bus_get_engines_by_names:
800 * @bus: An #IBusBus.
801 * @names: (array zero-terminated=1): A %NULL-terminated array of names.
802 *
803 * Get engines by given names synchronously. If some engine names do not exist,
804 * this function will simply ignore them, and return rest of engines.
805 * TODO(penghuang): add asynchronous version
806 *
807 * Returns: (array zero-terminated=1) (transfer full):
808 * A %NULL-terminated array of engines.
809 */
810IBusEngineDesc **
811 ibus_bus_get_engines_by_names
812 (IBusBus *bus,
813 const gchar * const *names);
814#ifndef IBUS_DISABLE_DEPRECATED
815/**
816 * ibus_bus_get_use_sys_layout:
817 * @bus: An #IBusBus.
818 *
819 * Check if the bus's "use_sys_layout" option is enabled or not synchronously.
820 *
821 * Returns: %TRUE if "use_sys_layout" option is enabled.
822 *
823 * Deprecated: 1.5.3: Read dconf value
824 * /desktop/ibus/general/use_system_keyboard_layout instead.
825 */
826IBUS_DEPRECATED
827gboolean ibus_bus_get_use_sys_layout
828 (IBusBus *bus);
829
830/**
831 * ibus_bus_get_use_sys_layout_async:
832 * @bus: An #IBusBus.
833 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
834 * @cancellable: A #GCancellable or %NULL.
835 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
836 * or %NULL if you don't care about the result of the method invocation.
837 * @user_data: The data to pass to callback.
838 *
839 * Check if the bus's "use_sys_layout" option is enabled or not asynchronously.
840 *
841 * Deprecated: 1.5.3: Read dconf value
842 * /desktop/ibus/general/use_system_keyboard_layout instead.
843 */
844IBUS_DEPRECATED
845void ibus_bus_get_use_sys_layout_async
846 (IBusBus *bus,
847 gint timeout_msec,
848 GCancellable *cancellable,
849 GAsyncReadyCallback
850 callback,
851 gpointer user_data);
852
853/**
854 * ibus_bus_get_use_sys_layout_async_finish:
855 * @bus: An #IBusBus.
856 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
857 * ibus_bus_get_use_sys_layout_async().
858 * @error: Return location for error or %NULL.
859 *
860 * Finishes an operation started with ibus_bus_get_use_sys_layout_async().
861 *
862 * Returns: TRUE if "use_sys_layout" option is enabled.
863 *
864 * Deprecated: 1.5.3: Read dconf value
865 * /desktop/ibus/general/use_system_keyboard_layout instead.
866 */
867IBUS_DEPRECATED
868gboolean ibus_bus_get_use_sys_layout_async_finish
869 (IBusBus *bus,
870 GAsyncResult *res,
871 GError **error);
872
873/**
874 * ibus_bus_get_use_global_engine:
875 * @bus: An #IBusBus.
876 *
877 * Check if the bus's "use_global_engine" option is enabled or not
878 * synchronously.
879 *
880 * Returns: TRUE if "use_global_engine" option is enabled.
881 *
882 * Deprecated: 1.5.3: Currently global engine is always used.
883 */
884IBUS_DEPRECATED
885gboolean ibus_bus_get_use_global_engine
886 (IBusBus *bus);
887
888/**
889 * ibus_bus_get_use_global_engine_async:
890 * @bus: An #IBusBus.
891 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
892 * @cancellable: A #GCancellable or %NULL.
893 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
894 * or %NULL if you don't care about the result of the method invocation.
895 * @user_data: The data to pass to callback.
896 *
897 * Check if the bus's "use_global_engine" option is enabled or not asynchronously.
898 *
899 * Deprecated: 1.5.3: Currently global engine is always used.
900 */
901IBUS_DEPRECATED
902void ibus_bus_get_use_global_engine_async
903 (IBusBus *bus,
904 gint timeout_msec,
905 GCancellable *cancellable,
906 GAsyncReadyCallback
907 callback,
908 gpointer user_data);
909
910/**
911 * ibus_bus_get_use_global_engine_async_finish:
912 * @bus: An #IBusBus.
913 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
914 * ibus_bus_get_use_global_engine_async().
915 * @error: Return location for error or %NULL.
916 *
917 * Finishes an operation started with ibus_bus_get_use_global_engine_async().
918 *
919 * Returns: %TRUE if "use_global_engine" option is enabled.
920 *
921 * Deprecated: 1.5.3: Currently global engine is always used.
922 */
923IBUS_DEPRECATED
924gboolean ibus_bus_get_use_global_engine_async_finish
925 (IBusBus *bus,
926 GAsyncResult *res,
927 GError **error);
928
929/**
930 * ibus_bus_is_global_engine_enabled:
931 * @bus: An #IBusBus.
932 *
933 * Check if the current global engine is enabled or not synchronously.
934 *
935 * Returns: %TRUE if the current global engine is enabled.
936 *
937 * Deprecated: 1.5.3: Probably this would be used for Chrome OS only.
938 * Currently global engine is always used and ibus_bus_get_global_engine()
939 * returns NULL until the first global engine is assigned.
940 * You can use ibus_set_log_handler() to disable a warning when
941 * ibus_bus_get_global_engine() returns NULL.
942 */
943IBUS_DEPRECATED
944gboolean ibus_bus_is_global_engine_enabled
945 (IBusBus *bus);
946
947/**
948 * ibus_bus_is_global_engine_enabled_async:
949 * @bus: An #IBusBus.
950 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
951 * @cancellable: A #GCancellable or %NULL.
952 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
953 * or %NULL if you don't care about the result of the method invocation.
954 * @user_data: The data to pass to callback.
955 *
956 * Check if the current global engine is enabled or not asynchronously.
957 *
958 * Deprecated: 1.5.3: Probably this would be used for Chrome OS only.
959 * Currently global engine is always used and ibus_bus_get_global_engine()
960 * returns NULL until the first global engine is assigned.
961 * You can use ibus_set_log_handler() to disable a warning when
962 * ibus_bus_get_global_engine() returns NULL.
963 */
964IBUS_DEPRECATED
965void ibus_bus_is_global_engine_enabled_async
966 (IBusBus *bus,
967 gint timeout_msec,
968 GCancellable *cancellable,
969 GAsyncReadyCallback
970 callback,
971 gpointer user_data);
972
973/**
974 * ibus_bus_is_global_engine_enabled_async_finish:
975 * @bus: An #IBusBus.
976 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
977 * ibus_bus_is_global_engine_enabled_async().
978 * @error: Return location for error or %NULL.
979 *
980 * Finishes an operation started with ibus_bus_is_global_engine_enabled_async().
981 *
982 * Returns: %TRUE if the current global engine is enabled.
983 *
984 * Deprecated: 1.5.3: Probably this would be used for Chrome OS only.
985 * Currently global engine is always used and ibus_bus_get_global_engine()
986 * returns NULL until the first global engine is assigned.
987 * You can use ibus_set_log_handler() to disable a warning when
988 * ibus_bus_get_global_engine() returns NULL.
989 */
990IBUS_DEPRECATED
991gboolean ibus_bus_is_global_engine_enabled_async_finish
992 (IBusBus *bus,
993 GAsyncResult *res,
994 GError **error);
995#endif /* IBUS_DISABLE_DEPRECATED */
996
997/**
998 * ibus_bus_get_global_engine:
999 * @bus: An #IBusBus.
1000 *
1001 * Get the description of current global engine synchronously.
1002 *
1003 * Returns: (transfer full): The description of current global engine,
1004 * or %NULL if there is no global engine.
1005 */
1006IBusEngineDesc *
1007 ibus_bus_get_global_engine (IBusBus *bus);
1008
1009/**
1010 * ibus_bus_get_global_engine_async:
1011 * @bus: An #IBusBus.
1012 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
1013 * @cancellable: A #GCancellable or %NULL.
1014 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL
1015 * if you don't care about the result of the method invocation.
1016 * @user_data: The data to pass to callback.
1017 *
1018 * Get the description of current global engine asynchronously.
1019 */
1020void ibus_bus_get_global_engine_async
1021 (IBusBus *bus,
1022 gint timeout_msec,
1023 GCancellable *cancellable,
1024 GAsyncReadyCallback
1025 callback,
1026 gpointer user_data);
1027
1028/**
1029 * ibus_bus_get_global_engine_async_finish:
1030 * @bus: An #IBusBus.
1031 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
1032 * ibus_bus_get_global_engine_async_finish().
1033 * @error: Return location for error or %NULL.
1034 *
1035 * Finishes an operation started with ibus_bus_get_global_engine_async_finish().
1036 *
1037 * Returns: (transfer none): The description of current global engine,
1038 * or %NULL if there is no global engine.
1039 */
1040IBusEngineDesc *
1041 ibus_bus_get_global_engine_async_finish
1042 (IBusBus *bus,
1043 GAsyncResult *res,
1044 GError **error);
1045
1046/**
1047 * ibus_bus_set_global_engine:
1048 * @bus: An #IBusBus.
1049 * @global_engine: A new engine name.
1050 *
1051 * Set current global engine synchronously.
1052 *
1053 * Returns: %TRUE if the global engine was set successfully.
1054 */
1055gboolean ibus_bus_set_global_engine (IBusBus *bus,
1056 const gchar *global_engine);
1057
1058/**
1059 * ibus_bus_set_global_engine_async:
1060 * @bus: An #IBusBus.
1061 * @global_engine: A new engine name.
1062 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
1063 * @cancellable: A #GCancellable or %NULL.
1064 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
1065 * or %NULL if you don't care about the result of the method invocation.
1066 * @user_data: The data to pass to callback.
1067 *
1068 * Set current global engine asynchronously.
1069 */
1070void ibus_bus_set_global_engine_async
1071 (IBusBus *bus,
1072 const gchar *global_engine,
1073 gint timeout_msec,
1074 GCancellable *cancellable,
1075 GAsyncReadyCallback
1076 callback,
1077 gpointer user_data);
1078
1079/**
1080 * ibus_bus_set_global_engine_async_finish:
1081 * @bus: An #IBusBus.
1082 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
1083 * ibus_bus_set_global_engine_async().
1084 * @error: Return location for error or %NULL.
1085 *
1086 * Finishes an operation started with ibus_bus_set_global_engine_async().
1087 *
1088 * Returns: %TRUE if no IPC errros. %FALSE otherwise.
1089 */
1090gboolean ibus_bus_set_global_engine_async_finish
1091 (IBusBus *bus,
1092 GAsyncResult *res,
1093 GError **error);
1094
1095/**
1096 * ibus_bus_set_watch_dbus_signal:
1097 * @bus: An #IBusBus.
1098 * @watch: %TRUE if you want ibusbus to emit "name-owner-changed" signal when
1099 * ibus-daemon emits the NameOwnerChanged DBus signal.
1100 *
1101 * Start or stop watching the NameOwnerChanged DBus signal.
1102 */
1103void ibus_bus_set_watch_dbus_signal
1104 (IBusBus *bus,
1105 gboolean watch);
1106
1107/**
1108 * ibus_bus_set_watch_ibus_signal:
1109 * @bus: An #IBusBus.
1110 * @watch: %TRUE if you want ibusbus to emit "global-engine-changed" signal when
1111 * ibus-daemon emits the GlobalEngineChanged IBus signal.
1112 *
1113 * Start or stop watching the GlobalEngineChanged IBus signal.
1114 */
1115void ibus_bus_set_watch_ibus_signal
1116 (IBusBus *bus,
1117 gboolean watch);
1118
1119/* declare config apis */
1120/**
1121 * ibus_bus_get_config:
1122 * @bus: An #IBusBus.
1123 *
1124 * Get the config instance from #IBusBus.
1125 *
1126 * Returns: (transfer none): An #IBusConfig object which is configurable with
1127 * @bus.
1128 */
1129IBusConfig *ibus_bus_get_config (IBusBus *bus);
1130
1131/**
1132 * ibus_bus_preload_engines:
1133 * @bus: An #IBusBus.
1134 * @names: (array zero-terminated=1): A %NULL-terminated array of engine names.
1135 *
1136 * Start bus components by engine names synchronously.
1137 *
1138 * Returns: %TRUE if components start. %FALSE otherwise.
1139 */
1140gboolean ibus_bus_preload_engines (IBusBus *bus,
1141 const gchar * const *names);
1142
1143/**
1144 * ibus_bus_preload_engines_async:
1145 * @bus: An #IBusBus.
1146 * @names: (array zero-terminated=1): A %NULL-terminated array of engine names.
1147 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
1148 * @cancellable: A #GCancellable or %NULL.
1149 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
1150 * or %NULL if you don't care about the result of the method invocation.
1151 * @user_data: The data to pass to callback.
1152 *
1153 * Start bus components by engine names asynchronously.
1154 */
1155void ibus_bus_preload_engines_async
1156 (IBusBus *bus,
1157 const gchar * const
1158 *names,
1159 gint timeout_msec,
1160 GCancellable *cancellable,
1161 GAsyncReadyCallback
1162 callback,
1163 gpointer user_data);
1164
1165/**
1166 * ibus_bus_preload_engines_async_finish:
1167 * @bus: An #IBusBus.
1168 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
1169 * ibus_bus_preload_engines_async().
1170 * @error: Return location for error or %NULL.
1171 *
1172 * Finishes an operation started with ibus_bus_preload_engines_async().
1173 *
1174 * Returns: %TRUE if component starts. %FALSE otherwise.
1175 */
1176gboolean ibus_bus_preload_engines_async_finish
1177 (IBusBus *bus,
1178 GAsyncResult *res,
1179 GError **error);
1180
1181/**
1182 * ibus_bus_get_ibus_property:
1183 * @bus: An #IBusBus.
1184 * @property_name: property name in org.freedesktop.DBus.Properties.Get
1185 *
1186 * Get org.freedesktop.DBus.Properties.
1187 *
1188 * Returns: (transfer full): The value in org.freedesktop.DBus.Properties.Get
1189 * The returned value must be freed with g_variant_unref().
1190 */
1191GVariant * ibus_bus_get_ibus_property (IBusBus *bus,
1192 const gchar *property_name);
1193
1194/**
1195 * ibus_bus_get_ibus_property_async:
1196 * @bus: An #IBusBus.
1197 * @property_name: property name in org.freedesktop.DBus.Properties.Get
1198 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
1199 * @cancellable: A #GCancellable or %NULL.
1200 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
1201 * or %NULL if you don't care about the result of the method invocation.
1202 * @user_data: The data to pass to callback.
1203 *
1204 * Get org.freedesktop.DBus.Properties asynchronously.
1205 */
1206void ibus_bus_get_ibus_property_async
1207 (IBusBus *bus,
1208 const gchar *property_name,
1209 gint timeout_msec,
1210 GCancellable *cancellable,
1211 GAsyncReadyCallback
1212 callback,
1213 gpointer user_data);
1214
1215/**
1216 * ibus_bus_get_ibus_property_async_finish:
1217 * @bus: An #IBusBus.
1218 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
1219 * ibus_bus_get_ibus_property_async().
1220 * @error: Return location for error or %NULL.
1221 *
1222 * Finishes an operation started with ibus_bus_get_ibus_property_async().
1223 *
1224 * Returns: (transfer full): The value in org.freedesktop.DBus.Properties.Get
1225 * The returned value must be freed with g_variant_unref().
1226 */
1227GVariant * ibus_bus_get_ibus_property_async_finish
1228 (IBusBus *bus,
1229 GAsyncResult *res,
1230 GError **error);
1231
1232/**
1233 * ibus_bus_set_ibus_property:
1234 * @bus: An #IBusBus.
1235 * @property_name: property name in org.freedesktop.DBus.Properties.Set
1236 * @value: value in org.freedesktop.DBus.Properties.Set
1237 *
1238 * Set org.freedesktop.DBus.Properties.
1239 */
1240void ibus_bus_set_ibus_property (IBusBus *bus,
1241 const gchar *property_name,
1242 GVariant *value);
1243
1244/**
1245 * ibus_bus_set_ibus_property_async:
1246 * @bus: An #IBusBus.
1247 * @property_name: property name in org.freedesktop.DBus.Properties.Set
1248 * @value: value in org.freedesktop.DBus.Properties.Set
1249 * @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
1250 * @cancellable: A #GCancellable or %NULL.
1251 * @callback: A #GAsyncReadyCallback to call when the request is satisfied
1252 * or %NULL if you don't care about the result of the method invocation.
1253 * @user_data: The data to pass to callback.
1254 *
1255 * Set org.freedesktop.DBus.Properties asynchronously.
1256 */
1257void ibus_bus_set_ibus_property_async
1258 (IBusBus *bus,
1259 const gchar *property_name,
1260 GVariant *value,
1261 gint timeout_msec,
1262 GCancellable *cancellable,
1263 GAsyncReadyCallback
1264 callback,
1265 gpointer user_data);
1266
1267/**
1268 * ibus_bus_set_ibus_property_async_finish:
1269 * @bus: An #IBusBus.
1270 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
1271 * ibus_bus_set_ibus_property_async().
1272 * @error: Return location for error or %NULL.
1273 *
1274 * Finishes an operation started with ibus_bus_set_ibus_property_async().
1275 *
1276 * Returns: %TRUE if property is set with async. %FALSE failed.
1277 */
1278gboolean ibus_bus_set_ibus_property_async_finish
1279 (IBusBus *bus,
1280 GAsyncResult *res,
1281 GError **error);
1282
1283G_END_DECLS
1284#endif
1285