| 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-2013 Peng Huang <shawn.p.huang@gmail.com> |
| 5 | * Copyright (C) 2008-2013 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.1 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 Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
| 20 | * 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 | #ifndef __IBUS_PROXY_H_ |
| 28 | #define __IBUS_PROXY_H_ |
| 29 | |
| 30 | /** |
| 31 | * SECTION: ibusproxy |
| 32 | * @short_description: Base proxy object. |
| 33 | * @stability: Stable |
| 34 | * |
| 35 | * An IBusProxy is the base of all proxy objects, |
| 36 | * which communicate the corresponding #IBusServices on the other end of |
| 37 | * IBusConnection. |
| 38 | * For example, IBus clients (such as editors, web browsers) invoke the proxy |
| 39 | * object, |
| 40 | * IBusInputContext to communicate with the InputContext service of the |
| 41 | * ibus-daemon. |
| 42 | * |
| 43 | * Almost all services have corresponding proxies, except very simple services. |
| 44 | */ |
| 45 | |
| 46 | #include <gio/gio.h> |
| 47 | |
| 48 | /* |
| 49 | * Type macros. |
| 50 | */ |
| 51 | |
| 52 | /* define GOBJECT macros */ |
| 53 | #define IBUS_TYPE_PROXY \ |
| 54 | (ibus_proxy_get_type ()) |
| 55 | #define IBUS_PROXY(obj) \ |
| 56 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_PROXY, IBusProxy)) |
| 57 | #define IBUS_PROXY_CLASS(klass) \ |
| 58 | (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_PROXY, IBusProxyClass)) |
| 59 | #define IBUS_IS_PROXY(obj) \ |
| 60 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_PROXY)) |
| 61 | #define IBUS_IS_PROXY_CLASS(klass) \ |
| 62 | (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_PROXY)) |
| 63 | #define IBUS_PROXY_GET_CLASS(obj) \ |
| 64 | (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_PROXY, IBusProxyClass)) |
| 65 | |
| 66 | G_BEGIN_DECLS |
| 67 | |
| 68 | typedef struct _IBusProxy IBusProxy; |
| 69 | typedef struct _IBusProxyClass IBusProxyClass; |
| 70 | |
| 71 | #define IBUS_PROXY_FLAGS(obj) (IBUS_PROXY (obj)->flags) |
| 72 | #define IBUS_PROXY_SET_FLAGS(obj,flag) G_STMT_START{ (IBUS_PROXY_FLAGS (obj) |= (flag)); }G_STMT_END |
| 73 | #define IBUS_PROXY_UNSET_FLAGS(obj,flag) G_STMT_START{ (IBUS_PROXY_FLAGS (obj) &= ~(flag)); }G_STMT_END |
| 74 | #define IBUS_PROXY_DESTROYED(obj) (IBUS_PROXY_FLAGS (obj) & IBUS_DESTROYED) |
| 75 | |
| 76 | /** |
| 77 | * IBusProxy: |
| 78 | * |
| 79 | * An opaque data type representing an IBusProxy. |
| 80 | */ |
| 81 | struct _IBusProxy { |
| 82 | GDBusProxy parent; |
| 83 | /* instance members */ |
| 84 | guint32 flags; |
| 85 | gboolean own; |
| 86 | }; |
| 87 | |
| 88 | struct _IBusProxyClass { |
| 89 | GDBusProxyClass parent; |
| 90 | |
| 91 | /* class members */ |
| 92 | void (* destroy) (IBusProxy *proxy); |
| 93 | /*< private >*/ |
| 94 | /* padding */ |
| 95 | gpointer pdummy[7]; |
| 96 | }; |
| 97 | |
| 98 | GType ibus_proxy_get_type (void); |
| 99 | |
| 100 | /** |
| 101 | * ibus_proxy_destroy: |
| 102 | * @proxy: An #IBusProxy |
| 103 | * |
| 104 | * Dispose the proxy object. If the dbus connection is alive and the own |
| 105 | * variable above is TRUE (which is the default), |
| 106 | * org.freedesktop.IBus.Service.Destroy method will be called. |
| 107 | * Note that "destroy" signal might be emitted when ibus_proxy_destroy is |
| 108 | * called or the underlying dbus connection for the proxy is terminated. |
| 109 | * In the callback of the destroy signal, you might have to call something |
| 110 | * like 'g_object_unref(the_proxy);'. |
| 111 | */ |
| 112 | void ibus_proxy_destroy (IBusProxy *proxy); |
| 113 | |
| 114 | G_END_DECLS |
| 115 | #endif |
| 116 | |
| 117 | |