Fix make rpm errors due to ibus-dconf and pygobject override
[platform/upstream/ibus.git] / src / ibusconfigservice.h
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-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
23 #if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION)
24 #error "Only <ibus.h> can be included directly"
25 #endif
26
27 /**
28  * SECTION: ibusconfigservice
29  * @short_description: Configuration service back-end.
30  * @stability: Stable
31  *
32  * An IBusConfigService is a base class for other configuration services such as GConf.
33  * Currently, directly known sub class is IBusConfigGConf.
34  *
35  * IBusConfigServiceClass has following member functions:
36  * <itemizedlist>
37  *     <listitem>
38  *         <para>gboolean set_value(IBusConfigService *config, const gchar *section, const gchar *name,
39  *             const GValue *value, IBusError **error)
40  *         </para>
41  *         <variablelist>
42  *             <varlistentry>
43  *                 <term>config:</term>
44  *                 <listitem>A configure service</listitem>
45  *             </varlistentry>
46  *             <varlistentry>
47  *                 <term>section:</term>
48  *                 <listitem>Section name of the configuration option.</listitem>
49  *             </varlistentry>
50  *             <varlistentry>
51  *                 <term>name:</term>
52  *                 <listitem>Name of the configuration option.</listitem>
53  *             </varlistentry>
54  *             <varlistentry>
55  *                 <term>value:</term>
56  *                 <listitem>GValue that holds the value.</listitem>
57  *             </varlistentry>
58  *             <varlistentry>
59  *                 <term>error:</term>
60  *                 <listitem>Error outputs here.</listitem>
61  *             </varlistentry>
62  *             <varlistentry>
63  *                 <term>Returns:</term>
64  *                 <listitem>TRUE if succeed; FALSE otherwise.</listitem>
65  *             </varlistentry>
66  *         </variablelist>
67  *         <para>Set a value to a configuration option.
68  *         </para>
69  *     </listitem>
70  *     <listitem>
71  *         <para>gboolean get_value(IBusConfigService *config, const gchar *section, const gchar *name,
72  *             GValue *value, IBusError **error)
73  *         </para>
74  *         <variablelist>
75  *             <varlistentry>
76  *                 <term>config:</term>
77  *                 <listitem>A configure service</listitem>
78  *             </varlistentry>
79  *             <varlistentry>
80  *                 <term>section:</term>
81  *                 <listitem>Section name of the configuration option.</listitem>
82  *             </varlistentry>
83  *             <varlistentry>
84  *                 <term>name:</term>
85  *                 <listitem>Name of the configuration option.</listitem>
86  *             </varlistentry>
87  *             <varlistentry>
88  *                 <term>value:</term>
89  *                 <listitem>GValue that holds the value.</listitem>
90  *             </varlistentry>
91  *             <varlistentry>
92  *                 <term>error:</term>
93  *                 <listitem>Error outputs here.</listitem>
94  *             </varlistentry>
95  *             <varlistentry>
96  *                 <term>Returns:</term>
97  *                 <listitem>TRUE if succeed; FALSE otherwise.</listitem>
98 *             </varlistentry>
99 *         </variablelist>
100  *        <para>Get value of a configuration option.
101  *        </para>
102  *     </listitem>
103  *     <listitem>
104  *         <para>gboolean unset(IBusConfigService *config, const gchar *section, const gchar *name,
105  *             IBusError **error)
106  *         </para>
107  *         <variablelist>
108  *             <varlistentry>
109  *                 <term>config:</term>
110  *                 <listitem>A configure service</listitem>
111  *             </varlistentry>
112  *             <varlistentry>
113  *                 <term>section:</term>
114  *                 <listitem>Section name of the configuration option.</listitem>
115  *             </varlistentry>
116  *             <varlistentry>
117  *                 <term>name:</term>
118  *                 <listitem>Name of the configuration option.</listitem>
119  *             </varlistentry>
120  *             <varlistentry>
121  *                 <term>error:</term>
122  *                 <listitem>Error outputs here.</listitem>
123  *             </varlistentry>
124  *             <varlistentry>
125  *                 <term>Returns:</term>
126  *                 <listitem>TRUE if succeed; FALSE otherwise.</listitem>
127  *             </varlistentry>
128  *         </variablelist>
129  *         <para>Remove an entry to a configuration option.
130  *         </para>
131  *     </listitem>
132  * </itemizedlist>
133  */
134 #ifndef __IBUS_CONFIG_SERVICE_H_
135 #define __IBUS_CONFIG_SERVICE_H_
136
137 #include "ibusservice.h"
138
139 /*
140  * Type macros.
141  */
142
143 /* define GOBJECT macros */
144 #define IBUS_TYPE_CONFIG_SERVICE             \
145     (ibus_config_service_get_type ())
146 #define IBUS_CONFIG_SERVICE(obj)             \
147     (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_CONFIG_SERVICE, IBusConfigService))
148 #define IBUS_CONFIG_SERVICE_CLASS(klass)     \
149     (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_CONFIG_SERVICE, IBusConfigServiceClass))
150 #define IBUS_IS_CONFIG_SERVICE(obj)          \
151     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_CONFIG_SERVICE))
152 #define IBUS_IS_CONFIG_SERVICE_CLASS(klass)  \
153     (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_CONFIG_SERVICE))
154 #define IBUS_CONFIG_SERVICE_GET_CLASS(obj)   \
155     (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_CONFIG_SERVICE, IBusConfigServiceClass))
156
157 G_BEGIN_DECLS
158
159 typedef struct _IBusConfigService IBusConfigService;
160 typedef struct _IBusConfigServiceClass IBusConfigServiceClass;
161
162 /**
163  * IBusConfigService:
164  *
165  * An opaque data type representing a configure service.
166  */
167 struct _IBusConfigService {
168     /*< private >*/
169     IBusService parent;
170     /* IBusConfigServicePriv *priv */
171
172     /* instance members */
173 };
174
175 struct _IBusConfigServiceClass {
176     /*< private >*/
177     IBusServiceClass parent;
178
179     /*< public >*/
180     /* class members */
181     gboolean    (* set_value)   (IBusConfigService    *config,
182                                  const gchar          *section,
183                                  const gchar          *name,
184                                  GVariant             *value,
185                                  GError              **error);
186     /**
187      * get_value:
188      * @config: An IBusConfig.
189      * @section: section name
190      * @name: value name
191      *
192      * @returns: (transfer full): The value in config associated with section and name.
193      *
194      */
195     GVariant *  (* get_value)   (IBusConfigService    *config,
196                                  const gchar          *section,
197                                  const gchar          *name,
198                                  GError              **error);
199     gboolean    (* unset_value) (IBusConfigService    *config,
200                                  const gchar          *section,
201                                  const gchar          *name,
202                                  GError              **error);
203     GVariant *  (* get_values)  (IBusConfigService    *config,
204                                  const gchar          *section,
205                                  GError              **error);
206
207     /*< private >*/
208     /* padding */
209     gpointer pdummy[12];
210 };
211
212 GType                ibus_config_service_get_type   (void);
213
214 /**
215  * ibus_config_service_new:
216  * @connection: An GDBusConnection.
217  * @returns: A newly allocated IBusConfigServices.
218  *
219  * New an IBusConfigService from an GDBusConnection.
220  */
221 IBusConfigService   *ibus_config_service_new        (GDBusConnection     *connection);
222
223 /**
224  * ibus_config_service_value_changed:
225  * @config: An IBusConfigService.
226  * @section: Section name of the configuration option.
227  * @name: Name of the configure option.
228  * @value: GVariant that holds the value.
229  *
230  * Change a value of a configuration option
231  * by sending a "ValueChanged" message to IBus service.
232  */
233 void                 ibus_config_service_value_changed
234                                                     (IBusConfigService  *config,
235                                                      const gchar        *section,
236                                                      const gchar        *name,
237                                                      GVariant           *value);
238
239 G_END_DECLS
240 #endif
241