Add Ctrl+space customization.
[platform/upstream/ibus.git] / bus / registry.h
1 /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
2 /* vim:set et sts=4: */
3 /* bus - The Input Bus
4  * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
5  * Copyright (C) 2008-2010 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 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
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22 #ifndef __BUS_REGISTRY_H_
23 #define __BUS_REGISTRY_H_
24
25 #include <ibus.h>
26 #include "component.h"
27
28 /*
29  * Type macros.
30  */
31
32 /* define GOBJECT macros */
33 #define BUS_TYPE_REGISTRY             \
34     (bus_registry_get_type ())
35 #define BUS_REGISTRY(obj)             \
36     (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUS_TYPE_REGISTRY, BusRegistry))
37 #define BUS_REGISTRY_CLASS(klass)     \
38     (G_TYPE_CHECK_CLASS_CAST ((klass), BUS_TYPE_REGISTRY, BusRegistryClass))
39 #define BUS_IS_REGISTRY(obj)          \
40     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUS_TYPE_REGISTRY))
41 #define BUS_IS_REGISTRY_CLASS(klass)  \
42     (G_TYPE_CHECK_CLASS_TYPE ((klass), BUS_TYPE_REGISTRY))
43 #define BUS_REGISTRY_GET_CLASS(obj)   \
44     (G_TYPE_INSTANCE_GET_CLASS ((obj), BUS_TYPE_REGISTRY, BusRegistryClass))
45
46 G_BEGIN_DECLS
47
48 typedef struct _BusRegistry BusRegistry;
49 typedef struct _BusRegistryClass BusRegistryClass;
50
51 GType            bus_registry_get_type          (void);
52 BusRegistry     *bus_registry_new               (void);
53
54 /**
55  * bus_registry_get_components:
56  * @returns: a list of BusComponent objects. The caller has to call g_list_free for the returned list.
57  */
58 GList           *bus_registry_get_components    (BusRegistry    *registry);
59
60 /**
61  * bus_registry_get_engines:
62  * @returns: a list of all IBusEngineDesc objects available. The caller has to call g_list_free for the returned list.
63  */
64 GList           *bus_registry_get_engines       (BusRegistry    *registry);
65
66 /**
67  * bus_registry_get_engines_by_language:
68  * @language: a language name like 'ja'
69  * @returns: a list of IBusEngineDesc objects for the language. The caller has to call g_list_free for the returned list.
70  */
71 GList           *bus_registry_get_engines_by_language
72                                                 (BusRegistry    *registry,
73                                                  const gchar    *language);
74
75 /**
76  * bus_registry_stop_all_components:
77  *
78  * Terminate all component processes.
79  */
80 void             bus_registry_stop_all_components
81                                                 (BusRegistry    *registry);
82
83 /**
84  * bus_registry_lookup_component_by_name:
85  * @name: a component name such as 'org.freedesktop.IBus.Panel' and 'com.google.IBus.Mozc'
86  * @returns: a BusComponent object, or NULL if such component is not found.
87  */
88 BusComponent    *bus_registry_lookup_component_by_name
89                                                 (BusRegistry    *registry,
90                                                  const gchar    *name);
91
92 /**
93  * bus_registry_find_engine_by_name:
94  * @name: an engine name like 'pinyin'
95  * @returns: an IBusEngineDesc object, or NULL if not found.
96  */
97 IBusEngineDesc  *bus_registry_find_engine_by_name
98                                                 (BusRegistry    *registry,
99                                                  const gchar    *name);
100
101 /**
102  * bus_registry_name_owner_changed:
103  * @name: a unique or well-known name like ":1.1", "org.freedesktop.IBus.Config", "com.google.IBus.Mozc".
104  * @old_name: a unique name like ":1.1", or empty string "" when the client is started.
105  * @new_name: a unique name like ":1.1", or empty string "" when the client is stopped.
106  *
107  * Handle the "name-owner-changed" glib signal from dbusimpl. If a component is stopped, remove a BusFactoryProxy object from the
108  * bus for the component. If a component is started, create a new BusFactoryProxy object for the bus.
109  */
110 void             bus_registry_name_owner_changed
111                                                 (BusRegistry    *registry,
112                                                  const gchar    *name,
113                                                  const gchar    *old_name,
114                                                  const gchar    *new_name);
115
116 void             bus_registry_start_monitor_changes
117                                                 (BusRegistry    *registry);
118 gboolean         bus_registry_is_changed        (BusRegistry    *registry);
119
120 G_END_DECLS
121 #endif
122