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.
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.
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.
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.
23 #if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION)
24 #error "Only <ibus.h> can be included directly"
28 * SECTION: ibusconfigservice
29 * @short_description: Configuration service back-end.
32 * An IBusConfigService is a base class for other configuration services such as GConf.
33 * Currently, directly known sub class is IBusConfigGConf.
35 * IBusConfigServiceClass has following member functions:
38 * <para>gboolean set_value(IBusConfigService *config, const gchar *section, const gchar *name,
39 * const GValue *value, IBusError **error)
43 * <term>config:</term>
44 * <listitem>A configure service</listitem>
47 * <term>section:</term>
48 * <listitem>Section name of the configuration option.</listitem>
52 * <listitem>Name of the configuration option.</listitem>
56 * <listitem>GValue that holds the value.</listitem>
60 * <listitem>Error outputs here.</listitem>
63 * <term>Returns:</term>
64 * <listitem>TRUE if succeed; FALSE otherwise.</listitem>
67 * <para>Set a value to a configuration option.
71 * <para>gboolean get_value(IBusConfigService *config, const gchar *section, const gchar *name,
72 * GValue *value, IBusError **error)
76 * <term>config:</term>
77 * <listitem>A configure service</listitem>
80 * <term>section:</term>
81 * <listitem>Section name of the configuration option.</listitem>
85 * <listitem>Name of the configuration option.</listitem>
89 * <listitem>GValue that holds the value.</listitem>
93 * <listitem>Error outputs here.</listitem>
96 * <term>Returns:</term>
97 * <listitem>TRUE if succeed; FALSE otherwise.</listitem>
100 * <para>Get value of a configuration option.
104 * <para>gboolean unset(IBusConfigService *config, const gchar *section, const gchar *name,
109 * <term>config:</term>
110 * <listitem>A configure service</listitem>
113 * <term>section:</term>
114 * <listitem>Section name of the configuration option.</listitem>
118 * <listitem>Name of the configuration option.</listitem>
121 * <term>error:</term>
122 * <listitem>Error outputs here.</listitem>
125 * <term>Returns:</term>
126 * <listitem>TRUE if succeed; FALSE otherwise.</listitem>
129 * <para>Remove an entry to a configuration option.
134 #ifndef __IBUS_CONFIG_SERVICE_H_
135 #define __IBUS_CONFIG_SERVICE_H_
137 #include "ibusservice.h"
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))
159 typedef struct _IBusConfigService IBusConfigService;
160 typedef struct _IBusConfigServiceClass IBusConfigServiceClass;
165 * An opaque data type representing a configure service.
167 struct _IBusConfigService {
170 /* IBusConfigServicePriv *priv */
172 /* instance members */
175 struct _IBusConfigServiceClass {
177 IBusServiceClass parent;
181 gboolean (* set_value) (IBusConfigService *config,
182 const gchar *section,
188 * @config: An IBusConfig.
189 * @section: section name
192 * @returns: (transfer full): The value in config associated with section and name.
195 GVariant * (* get_value) (IBusConfigService *config,
196 const gchar *section,
199 gboolean (* unset_value) (IBusConfigService *config,
200 const gchar *section,
203 GVariant * (* get_values) (IBusConfigService *config,
204 const gchar *section,
212 GType ibus_config_service_get_type (void);
215 * ibus_config_service_new:
216 * @connection: An GDBusConnection.
217 * @returns: A newly allocated IBusConfigServices.
219 * New an IBusConfigService from an GDBusConnection.
221 IBusConfigService *ibus_config_service_new (GDBusConnection *connection);
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.
230 * Change a value of a configuration option
231 * by sending a "ValueChanged" message to IBus service.
233 void ibus_config_service_value_changed
234 (IBusConfigService *config,
235 const gchar *section,