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