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_PROP_LIST_H_ |
28 | #define __IBUS_PROP_LIST_H_ |
29 | |
30 | /** |
31 | * SECTION: ibusproplist |
32 | * @Title: IBusPropList |
33 | * @Short_description: An #IBusProperty container. |
34 | * @Stability: Stable |
35 | * |
36 | * See_also: #IBusProperty, #IBusEngine |
37 | * |
38 | */ |
39 | |
40 | #include "ibusserializable.h" |
41 | #include "ibusproperty.h" |
42 | |
43 | G_BEGIN_DECLS |
44 | |
45 | /* |
46 | * Type macros. |
47 | */ |
48 | /* define IBusPropList macros */ |
49 | #define IBUS_TYPE_PROP_LIST \ |
50 | (ibus_prop_list_get_type ()) |
51 | #define IBUS_PROP_LIST(obj) \ |
52 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_PROP_LIST, IBusPropList)) |
53 | #define IBUS_PROP_LIST_CLASS(klass) \ |
54 | (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_PROP_LIST, IBusPropListClass)) |
55 | #define IBUS_IS_PROP_LIST(obj) \ |
56 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_PROP_LIST)) |
57 | #define IBUS_IS_PROP_LIST_CLASS(klass) \ |
58 | (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_PROP_LIST)) |
59 | #define IBUS_PROP_LIST_GET_CLASS(obj) \ |
60 | (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_PROP_LIST, IBusPropListClass)) |
61 | |
62 | /* FIXME: https://mail.gnome.org/archives/gtk-doc-list/2015-July/msg00004.html |
63 | * If ibusproperty.h and ibusproplist.h includes each other, |
64 | * gtk-doc build outputs several warnings: |
65 | * |
66 | * # cd html && gtkdoc-mkhtml ibus ../ibus-docs.sgml |
67 | * ../ibus-docs.sgml:4: element refentry: validity error : ID IBusPropList |
68 | * already defined |
69 | * ../ibus-docs.sgml:172: element refsect2: validity error : ID |
70 | * IBusPropListClass already defined |
71 | * Warning: multiple "IDs" for constraint linkend: IBusPropList. |
72 | * Warning: multiple "IDs" for constraint linkend: IBusPropList. |
73 | * Warning: multiple "IDs" for constraint linkend: IBusPropListClass. |
74 | */ |
75 | #ifndef __PROPLIST_DEFINED |
76 | #define __PROPLIST_DEFINED |
77 | typedef struct _IBusPropList IBusPropList; |
78 | typedef struct _IBusPropListClass IBusPropListClass; |
79 | #endif |
80 | |
81 | /** |
82 | * IBusPropList: |
83 | * @properties: GArray that holds IBusProperties. |
84 | * |
85 | * An array of IBusProperties. |
86 | */ |
87 | struct _IBusPropList { |
88 | IBusSerializable parent; |
89 | |
90 | /*< public >*/ |
91 | GArray *properties; |
92 | }; |
93 | |
94 | /** |
95 | * IBusPropListClass: |
96 | * @parent: The parent class. |
97 | * |
98 | * Class structure for #IBusPropList. |
99 | */ |
100 | struct _IBusPropListClass { |
101 | IBusSerializableClass parent; |
102 | }; |
103 | |
104 | GType ibus_prop_list_get_type (); |
105 | |
106 | /** |
107 | * ibus_prop_list_new: |
108 | * |
109 | * Create a new #IBusPropList. |
110 | * |
111 | * Returns: A newly allocated #IBusPropList. |
112 | */ |
113 | IBusPropList *ibus_prop_list_new (); |
114 | |
115 | /** |
116 | * ibus_prop_list_append: |
117 | * @prop_list: An IBusPropList. |
118 | * @prop: IBusProperty to be append to @prop_list. |
119 | * |
120 | * Append an IBusProperty to an IBusPropList, and increase reference. |
121 | */ |
122 | void ibus_prop_list_append (IBusPropList *prop_list, |
123 | IBusProperty *prop); |
124 | |
125 | /** |
126 | * ibus_prop_list_get: |
127 | * @prop_list: An IBusPropList. |
128 | * @index: Index of an IBusPropList. |
129 | * |
130 | * Gets #IBusProperty at given index. Borrowed reference. |
131 | * |
132 | * Returns: (transfer none): #IBusProperty at given index, %NULL if no such |
133 | * #IBusProperty. |
134 | */ |
135 | IBusProperty *ibus_prop_list_get (IBusPropList *prop_list, |
136 | guint index); |
137 | |
138 | /** |
139 | * ibus_prop_list_update_property: |
140 | * @prop_list: An IBusPropList. |
141 | * @prop: IBusProperty to be update. |
142 | * |
143 | * Update an IBusProperty in IBusPropList. |
144 | * |
145 | * Returns: %TRUE if succeeded, %FALSE otherwise. |
146 | */ |
147 | gboolean ibus_prop_list_update_property |
148 | (IBusPropList *prop_list, |
149 | IBusProperty *prop); |
150 | G_END_DECLS |
151 | #endif |
152 | |