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: ibusservice
29 * @short_description: IBus service back-end.
32 * An IBusService is a base class for services.
35 #ifndef __IBUS_SERVICE_H_
36 #define __IBUS_SERVICE_H_
39 #include "ibusobject.h"
45 /* define GOBJECT macros */
46 #define IBUS_TYPE_SERVICE \
47 (ibus_service_get_type ())
48 #define IBUS_SERVICE(obj) \
49 (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_SERVICE, IBusService))
50 #define IBUS_SERVICE_CLASS(klass) \
51 (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_SERVICE, IBusServiceClass))
52 #define IBUS_IS_SERVICE(obj) \
53 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_SERVICE))
54 #define IBUS_IS_SERVICE_CLASS(klass) \
55 (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_SERVICE))
56 #define IBUS_SERVICE_GET_CLASS(obj) \
57 (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_SERVICE, IBusServiceClass))
61 typedef struct _IBusService IBusService;
62 typedef struct _IBusServiceClass IBusServiceClass;
63 typedef struct _IBusServicePrivate IBusServicePrivate;
68 * An opaque data type representing an IBusService.
73 IBusServicePrivate *priv;
76 struct _IBusServiceClass {
78 IBusObjectClass parent;
81 /* virtual functions */
82 void (* service_method_call)
83 (IBusService *service,
84 GDBusConnection *connection,
86 const gchar *object_path,
87 const gchar *interface_name,
88 const gchar *method_name,
92 GVariant * (* service_get_property)
93 (IBusService *service,
94 GDBusConnection *connection,
96 const gchar *object_path,
97 const gchar *interface_name,
98 const gchar *property_name,
100 gboolean (* service_set_property)
101 (IBusService *service,
102 GDBusConnection *connection,
104 const gchar *object_path,
105 const gchar *interface_name,
106 const gchar *property_name,
117 GType ibus_service_get_type (void);
121 * @path: Object path.
122 * @returns: A newly allocated IBusService
124 * New an IBusService.
126 IBusService *ibus_service_new (GDBusConnection *connection,
129 * ibus_service_get_object_path:
130 * @service: An IBusService.
131 * @returns: The object path of @service
133 * Returns the object path of an IBusService.
135 const gchar *ibus_service_get_object_path (IBusService *service);
138 * ibus_service_get_connection:
139 * @service: An IBusService.
140 * @returns: (transfer none): A #GDBusConnection of an #IBusService instance.
142 * Returns a connections.
144 GDBusConnection *ibus_service_get_connection (IBusService *service);
147 * ibus_service_register:
148 * @service: An IBusService.
149 * @connection: A GDBusConnection the service will be registered to.
150 * @error: Return location for error or NULL.
151 * @returns: TRUE if the service was registered, FALSE otherwise.
153 * Registers service to a connection.
155 gboolean ibus_service_register (IBusService *service,
156 GDBusConnection *connection,
159 * ibus_service_unregister:
160 * @service: An IBusService.
161 * @connection: A GDBusConnection the service was registered with.
163 * Unregisters service from a connection.
165 void ibus_service_unregister (IBusService *service,
166 GDBusConnection *connection);
171 * ibus_service_send_signal:
172 * @service: An IBusService.
173 * @interface: The interface the signal is emitted from.
174 * @name: Name of the signal.
175 * @first_arg_type: Type of first argument.
176 * @...: Rest of arguments, NULL to mark the end.
177 * @returns: TRUE if succeed; FALSE otherwise.
179 * Send signal to all the IBusConnections of an IBusService.
181 * @see_also: g_dbus_connection_emit_signal()
183 gboolean ibus_service_emit_signal (IBusService *service,
184 const gchar *dest_bus_name,
185 const gchar *interface_name,
186 const gchar *signal_name,
187 GVariant *parameters,
190 * ibus_service_class_add_interfaces:
191 * @klass: An IBusServiceClass.
192 * @xml_data: The introspection xml data.
194 * Set the interface introspection information with the service class.
196 gboolean ibus_service_class_add_interfaces
197 (IBusServiceClass *klass,
198 const gchar *xml_data);