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"
29 * @short_description: Base proxy object.
32 * An IBusProxy is the base of all proxy objects,
33 * which communicate the corresponding #IBusServices on the other end of IBusConnection.
34 * For example, IBus clients (such as editors, web browsers) invoke the proxy object,
35 * IBusInputContext to communicate with the InputContext service of the ibus-daemon.
37 * Almost all services have corresponding proxies, except very simple services.
39 #ifndef __IBUS_PROXY_H_
40 #define __IBUS_PROXY_H_
48 /* define GOBJECT macros */
49 #define IBUS_TYPE_PROXY \
50 (ibus_proxy_get_type ())
51 #define IBUS_PROXY(obj) \
52 (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_PROXY, IBusProxy))
53 #define IBUS_PROXY_CLASS(klass) \
54 (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_PROXY, IBusProxyClass))
55 #define IBUS_IS_PROXY(obj) \
56 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_PROXY))
57 #define IBUS_IS_PROXY_CLASS(klass) \
58 (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_PROXY))
59 #define IBUS_PROXY_GET_CLASS(obj) \
60 (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_PROXY, IBusProxyClass))
64 typedef struct _IBusProxy IBusProxy;
65 typedef struct _IBusProxyClass IBusProxyClass;
67 #define IBUS_PROXY_FLAGS(obj) (IBUS_PROXY (obj)->flags)
68 #define IBUS_PROXY_SET_FLAGS(obj,flag) G_STMT_START{ (IBUS_PROXY_FLAGS (obj) |= (flag)); }G_STMT_END
69 #define IBUS_PROXY_UNSET_FLAGS(obj,flag) G_STMT_START{ (IBUS_PROXY_FLAGS (obj) &= ~(flag)); }G_STMT_END
70 #define IBUS_PROXY_DESTROYED(obj) (IBUS_PROXY_FLAGS (obj) & IBUS_DESTROYED)
75 * An opaque data type representing an IBusProxy.
79 /* instance members */
84 struct _IBusProxyClass {
85 GDBusProxyClass parent;
88 void (* destroy) (IBusProxy *proxy);
94 GType ibus_proxy_get_type (void);
99 * Dispose the proxy object. If the dbus connection is alive and the own variable above
100 * is TRUE (which is the default), org.freedesktop.IBus.Service.Destroy method will be
101 * called. Note that "destroy" signal might be emitted when ibus_proxy_destroy is called
102 * or the underlying dbus connection for the proxy is terminated. In the callback of the
103 * destroy signal, you might have to call something like 'g_object_unref(the_proxy);'.
105 void ibus_proxy_destroy (IBusProxy *proxy);