gobject-introspection 1.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/Rakefile +50 -0
  2. data/ext/gobject-introspection/extconf.rb +97 -0
  3. data/ext/gobject-introspection/rb-gi-arg-info.c +151 -0
  4. data/ext/gobject-introspection/rb-gi-argument.c +223 -0
  5. data/ext/gobject-introspection/rb-gi-base-info.c +218 -0
  6. data/ext/gobject-introspection/rb-gi-boxed-info.c +48 -0
  7. data/ext/gobject-introspection/rb-gi-callable-info.c +124 -0
  8. data/ext/gobject-introspection/rb-gi-callback-info.c +48 -0
  9. data/ext/gobject-introspection/rb-gi-constant-info.c +77 -0
  10. data/ext/gobject-introspection/rb-gi-constructor-info.c +82 -0
  11. data/ext/gobject-introspection/rb-gi-conversions.h +95 -0
  12. data/ext/gobject-introspection/rb-gi-enum-info.c +145 -0
  13. data/ext/gobject-introspection/rb-gi-field-info.c +149 -0
  14. data/ext/gobject-introspection/rb-gi-flags-info.c +48 -0
  15. data/ext/gobject-introspection/rb-gi-function-info.c +199 -0
  16. data/ext/gobject-introspection/rb-gi-interface-info.c +222 -0
  17. data/ext/gobject-introspection/rb-gi-loader.c +61 -0
  18. data/ext/gobject-introspection/rb-gi-method-info.c +66 -0
  19. data/ext/gobject-introspection/rb-gi-object-info.c +345 -0
  20. data/ext/gobject-introspection/rb-gi-property-info.c +77 -0
  21. data/ext/gobject-introspection/rb-gi-registered-type-info.c +86 -0
  22. data/ext/gobject-introspection/rb-gi-repository.c +164 -0
  23. data/ext/gobject-introspection/rb-gi-signal-info.c +77 -0
  24. data/ext/gobject-introspection/rb-gi-struct-info.c +183 -0
  25. data/ext/gobject-introspection/rb-gi-type-info.c +143 -0
  26. data/ext/gobject-introspection/rb-gi-type-tag.c +43 -0
  27. data/ext/gobject-introspection/rb-gi-types.h +71 -0
  28. data/ext/gobject-introspection/rb-gi-union-info.c +206 -0
  29. data/ext/gobject-introspection/rb-gi-unresolved-info.c +48 -0
  30. data/ext/gobject-introspection/rb-gi-value-info.c +57 -0
  31. data/ext/gobject-introspection/rb-gi-vfunc-info.c +91 -0
  32. data/ext/gobject-introspection/rb-gobject-introspection.c +42 -0
  33. data/ext/gobject-introspection/rb-gobject-introspection.h +105 -0
  34. data/extconf.rb +71 -0
  35. data/lib/gobject-introspection.rb +39 -0
  36. data/lib/gobject-introspection/collection-reader.rb +34 -0
  37. data/lib/gobject-introspection/loader.rb +148 -0
  38. data/lib/gobject-introspection/object-info.rb +33 -0
  39. data/lib/gobject-introspection/repository.rb +32 -0
  40. data/lib/gobject-introspection/struct-info.rb +28 -0
  41. data/sample/clutter-basic-actor.rb +132 -0
  42. data/sample/clutter.rb +29 -0
  43. data/test/gobject-introspection-test-utils.rb +26 -0
  44. data/test/run-test.rb +45 -0
  45. data/test/test-arg-info.rb +68 -0
  46. data/test/test-base-info.rb +31 -0
  47. data/test/test-boxed-info.rb +21 -0
  48. data/test/test-callable-info.rb +49 -0
  49. data/test/test-callback-info.rb +29 -0
  50. data/test/test-constant-info.rb +24 -0
  51. data/test/test-enum-info.rb +56 -0
  52. data/test/test-field-type.rb +42 -0
  53. data/test/test-flags-info.rb +27 -0
  54. data/test/test-function-info.rb +37 -0
  55. data/test/test-interface-info.rb +97 -0
  56. data/test/test-loader.rb +30 -0
  57. data/test/test-object-info.rb +131 -0
  58. data/test/test-property-info.rb +38 -0
  59. data/test/test-registered-type-info.rb +35 -0
  60. data/test/test-repository.rb +59 -0
  61. data/test/test-signal-info.rb +37 -0
  62. data/test/test-struct-info.rb +57 -0
  63. data/test/test-type-info.rb +62 -0
  64. data/test/test-type-tag.rb +29 -0
  65. data/test/test-union-info.rb +21 -0
  66. data/test/test-value-info.rb +28 -0
  67. data/test/test-vfunc-info.rb +42 -0
  68. metadata +162 -0
@@ -0,0 +1,218 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rb-gobject-introspection.h"
22
+
23
+ #define RG_TARGET_NAMESPACE rb_cGIBaseInfo
24
+ #define SELF(self) RVAL2GI_BASE_INFO(self)
25
+
26
+ VALUE
27
+ rb_gi_base_info_to_ruby(GIBaseInfo *info)
28
+ {
29
+ GType g_type;
30
+ GIInfoType info_type;
31
+
32
+ if (!info) {
33
+ return Qnil;
34
+ }
35
+
36
+ info_type = g_base_info_get_type(info);
37
+ switch (info_type) {
38
+ case GI_INFO_TYPE_INVALID:
39
+ g_type = GI_TYPE_BASE_INFO;
40
+ break;
41
+ case GI_INFO_TYPE_FUNCTION:
42
+ {
43
+ GIFunctionInfoFlags flags;
44
+
45
+ flags = g_function_info_get_flags((GIFunctionInfo *)info);
46
+ if (flags & GI_FUNCTION_IS_METHOD) {
47
+ g_type = GI_TYPE_METHOD_INFO;
48
+ } else if (flags & GI_FUNCTION_IS_CONSTRUCTOR) {
49
+ g_type = GI_TYPE_CONSTRUCTOR_INFO;
50
+ } else {
51
+ g_type = GI_TYPE_FUNCTION_INFO;
52
+ }
53
+ }
54
+ break;
55
+ case GI_INFO_TYPE_CALLBACK:
56
+ g_type = GI_TYPE_CALLBACK_INFO;
57
+ break;
58
+ case GI_INFO_TYPE_STRUCT:
59
+ g_type = GI_TYPE_STRUCT_INFO;
60
+ break;
61
+ case GI_INFO_TYPE_BOXED:
62
+ g_type = GI_TYPE_BOXED_INFO;
63
+ break;
64
+ case GI_INFO_TYPE_ENUM:
65
+ g_type = GI_TYPE_ENUM_INFO;
66
+ break;
67
+ case GI_INFO_TYPE_FLAGS:
68
+ g_type = GI_TYPE_FLAGS_INFO;
69
+ break;
70
+ case GI_INFO_TYPE_OBJECT:
71
+ g_type = GI_TYPE_OBJECT_INFO;
72
+ break;
73
+ case GI_INFO_TYPE_INTERFACE:
74
+ g_type = GI_TYPE_INTERFACE_INFO;
75
+ break;
76
+ case GI_INFO_TYPE_CONSTANT:
77
+ g_type = GI_TYPE_CONSTANT_INFO;
78
+ break;
79
+ case GI_INFO_TYPE_INVALID_0:
80
+ g_type = GI_TYPE_BASE_INFO;
81
+ break;
82
+ case GI_INFO_TYPE_UNION:
83
+ g_type = GI_TYPE_UNION_INFO;
84
+ break;
85
+ case GI_INFO_TYPE_VALUE:
86
+ g_type = GI_TYPE_VALUE_INFO;
87
+ break;
88
+ case GI_INFO_TYPE_SIGNAL:
89
+ g_type = GI_TYPE_SIGNAL_INFO;
90
+ break;
91
+ case GI_INFO_TYPE_VFUNC:
92
+ g_type = GI_TYPE_VFUNC_INFO;
93
+ break;
94
+ case GI_INFO_TYPE_PROPERTY:
95
+ g_type = GI_TYPE_PROPERTY_INFO;
96
+ break;
97
+ case GI_INFO_TYPE_FIELD:
98
+ g_type = GI_TYPE_FIELD_INFO;
99
+ break;
100
+ case GI_INFO_TYPE_ARG:
101
+ g_type = GI_TYPE_ARG_INFO;
102
+ break;
103
+ case GI_INFO_TYPE_TYPE:
104
+ g_type = GI_TYPE_TYPE_INFO;
105
+ break;
106
+ case GI_INFO_TYPE_UNRESOLVED:
107
+ g_type = GI_TYPE_UNRESOLVED_INFO;
108
+ break;
109
+ default:
110
+ g_type = GI_TYPE_BASE_INFO;
111
+ break;
112
+ }
113
+
114
+ return BOXED2RVAL(info, g_type);
115
+ }
116
+
117
+ VALUE
118
+ rb_gi_base_info_to_ruby_with_unref(GIBaseInfo *info)
119
+ {
120
+ VALUE rb_info;
121
+
122
+ rb_info = rb_gi_base_info_to_ruby(info);
123
+ if (!NIL_P(rb_info)) {
124
+ g_base_info_unref(info);
125
+ }
126
+
127
+ return rb_info;
128
+ }
129
+
130
+ GIBaseInfo *
131
+ rb_gi_base_info_from_ruby(VALUE rb_info)
132
+ {
133
+ return RVAL2BOXED(rb_info, GI_TYPE_BASE_INFO);
134
+ }
135
+
136
+ static VALUE
137
+ rg_type(VALUE self)
138
+ {
139
+ GIBaseInfo *info;
140
+
141
+ info = SELF(self);
142
+ return GI_INFO_TYPE2RVAL(g_base_info_get_type(info));
143
+ }
144
+
145
+ static VALUE
146
+ rg_name(VALUE self)
147
+ {
148
+ GIBaseInfo *info;
149
+
150
+ info = SELF(self);
151
+ return CSTR2RVAL(g_base_info_get_name(info));
152
+ }
153
+
154
+ static VALUE
155
+ rg_namespace(VALUE self)
156
+ {
157
+ GIBaseInfo *info;
158
+
159
+ info = SELF(self);
160
+ return CSTR2RVAL(g_base_info_get_namespace(info));
161
+ }
162
+
163
+ static VALUE
164
+ rg_operator_aref(VALUE self, VALUE name)
165
+ {
166
+ GIBaseInfo *info;
167
+
168
+ info = SELF(self);
169
+ return CSTR2RVAL(g_base_info_get_attribute(info, RVAL2CSTR(name)));
170
+ }
171
+
172
+ static VALUE
173
+ rg_each(VALUE self)
174
+ {
175
+ GIAttributeIter iter = {0, };
176
+ GIBaseInfo *info;
177
+ gchar *name, *value;
178
+
179
+ RETURN_ENUMERATOR(self, 0, NULL);
180
+
181
+ info = SELF(self);
182
+ while (g_base_info_iterate_attributes(info, &iter, &name, &value)) {
183
+ VALUE rb_name, rb_value;
184
+ rb_name = CSTR2RVAL(name);
185
+ rb_value = CSTR2RVAL(value);
186
+ rb_yield(rb_ary_new3(2, rb_name, rb_value));
187
+ }
188
+
189
+ return Qnil;
190
+ }
191
+
192
+ void
193
+ rb_gi_base_info_init(VALUE rb_mGI)
194
+ {
195
+ VALUE RG_TARGET_NAMESPACE;
196
+
197
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(GI_TYPE_BASE_INFO, "BaseInfo", rb_mGI);
198
+
199
+ rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);
200
+
201
+ RG_DEF_METHOD(type, 0);
202
+ RG_DEF_METHOD(name, 0);
203
+ RG_DEF_METHOD(namespace, 0);
204
+ RG_DEF_METHOD_OPERATOR("[]", aref, 1);
205
+ RG_DEF_METHOD(each, 0);
206
+
207
+ G_DEF_CLASS(G_TYPE_I_INFO_TYPE, "InfoType", rb_mGI);
208
+
209
+ rb_gi_callable_info_init(rb_mGI, RG_TARGET_NAMESPACE);
210
+ rb_gi_registered_type_info_init(rb_mGI, RG_TARGET_NAMESPACE);
211
+ rb_gi_constant_info_init(rb_mGI, RG_TARGET_NAMESPACE);
212
+ rb_gi_value_info_init(rb_mGI, RG_TARGET_NAMESPACE);
213
+ rb_gi_property_info_init(rb_mGI, RG_TARGET_NAMESPACE);
214
+ rb_gi_field_info_init(rb_mGI, RG_TARGET_NAMESPACE);
215
+ rb_gi_arg_info_init(rb_mGI, RG_TARGET_NAMESPACE);
216
+ rb_gi_type_info_init(rb_mGI, RG_TARGET_NAMESPACE);
217
+ rb_gi_unresolved_info_init(rb_mGI, RG_TARGET_NAMESPACE);
218
+ }
@@ -0,0 +1,48 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rb-gobject-introspection.h"
22
+
23
+ #define RG_TARGET_NAMESPACE rb_cGIBoxedInfo
24
+ #define SELF(self) (RVAL2GI_BOXED_INFO(self))
25
+
26
+ GType
27
+ gi_boxed_info_get_type(void)
28
+ {
29
+ static GType type = 0;
30
+ if (type == 0) {
31
+ type = g_boxed_type_register_static("GIBoxedInfo",
32
+ (GBoxedCopyFunc)g_base_info_ref,
33
+ (GBoxedFreeFunc)g_base_info_unref);
34
+ }
35
+ return type;
36
+ }
37
+
38
+ void
39
+ rb_gi_boxed_info_init(VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo)
40
+ {
41
+ VALUE RG_TARGET_NAMESPACE;
42
+
43
+ RG_TARGET_NAMESPACE =
44
+ G_DEF_CLASS_WITH_PARENT(GI_TYPE_BOXED_INFO, "BoxedInfo", rb_mGI,
45
+ rb_cGIRegisteredTypeInfo);
46
+
47
+ (void)RG_TARGET_NAMESPACE; /* suppress a warning. */
48
+ }
@@ -0,0 +1,124 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rb-gobject-introspection.h"
22
+
23
+ #define RG_TARGET_NAMESPACE rb_cGICallableInfo
24
+ #define SELF(self) ((GICallableInfo *)(RVAL2GI_BASE_INFO(self)))
25
+
26
+ GType
27
+ gi_callable_info_get_type(void)
28
+ {
29
+ static GType type = 0;
30
+ if (type == 0) {
31
+ type = g_boxed_type_register_static("GICallableInfo",
32
+ (GBoxedCopyFunc)g_base_info_ref,
33
+ (GBoxedFreeFunc)g_base_info_unref);
34
+ }
35
+ return type;
36
+ }
37
+
38
+ static VALUE
39
+ rg_return_type(VALUE self)
40
+ {
41
+ GICallableInfo *info;
42
+
43
+ info = SELF(self);
44
+ return GI_BASE_INFO2RVAL(g_callable_info_get_return_type(info));
45
+ }
46
+
47
+ static VALUE
48
+ rg_caller_owns(VALUE self)
49
+ {
50
+ GICallableInfo *info;
51
+
52
+ info = SELF(self);
53
+ return GI_TRANSFER2RVAL(g_callable_info_get_caller_owns(info));
54
+ }
55
+
56
+ static VALUE
57
+ rg_may_return_null_p(VALUE self)
58
+ {
59
+ GICallableInfo *info;
60
+
61
+ info = SELF(self);
62
+ return CBOOL2RVAL(g_callable_info_may_return_null(info));
63
+ }
64
+
65
+ static VALUE
66
+ rg_n_args(VALUE self)
67
+ {
68
+ GICallableInfo *info;
69
+
70
+ info = SELF(self);
71
+ return INT2NUM(g_callable_info_get_n_args(info));
72
+ }
73
+
74
+ static VALUE
75
+ rg_operator_aref(VALUE self, VALUE rb_n)
76
+ {
77
+ GICallableInfo *info;
78
+ gint n;
79
+
80
+ info = SELF(self);
81
+ n = NUM2INT(rb_n);
82
+ return GI_BASE_INFO2RVAL_WITH_UNREF(g_callable_info_get_arg(info, n));
83
+ }
84
+
85
+ static VALUE
86
+ rg_args(VALUE self)
87
+ {
88
+ GICallableInfo *info;
89
+ gint i, n;
90
+ VALUE rb_args;
91
+
92
+ info = SELF(self);
93
+ rb_args = rb_ary_new();
94
+ n = g_callable_info_get_n_args(info);
95
+ for (i = 0; i < n; i++) {
96
+ GIArgInfo *arg_info;
97
+ arg_info = g_callable_info_get_arg(info, i);
98
+ rb_ary_push(rb_args, GI_BASE_INFO2RVAL_WITH_UNREF(arg_info));
99
+ }
100
+
101
+ return rb_args;
102
+ }
103
+
104
+ void
105
+ rb_gi_callable_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo)
106
+ {
107
+ VALUE RG_TARGET_NAMESPACE;
108
+
109
+ RG_TARGET_NAMESPACE =
110
+ G_DEF_CLASS_WITH_PARENT(GI_TYPE_CALLABLE_INFO, "CallableInfo", rb_mGI,
111
+ rb_cGIBaseInfo);
112
+
113
+ RG_DEF_METHOD(return_type, 0);
114
+ RG_DEF_METHOD(caller_owns, 0);
115
+ RG_DEF_METHOD_P(may_return_null, 0);
116
+ RG_DEF_METHOD(n_args, 0);
117
+ RG_DEF_METHOD_OPERATOR("[]", aref, 1);
118
+ RG_DEF_METHOD(args, 0);
119
+
120
+ rb_gi_function_info_init(rb_mGI, RG_TARGET_NAMESPACE);
121
+ rb_gi_callback_info_init(rb_mGI, RG_TARGET_NAMESPACE);
122
+ rb_gi_signal_info_init(rb_mGI, RG_TARGET_NAMESPACE);
123
+ rb_gi_vfunc_info_init(rb_mGI, RG_TARGET_NAMESPACE);
124
+ }
@@ -0,0 +1,48 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rb-gobject-introspection.h"
22
+
23
+ #define RG_TARGET_NAMESPACE rb_cGICallbackInfo
24
+ #define SELF(self) RVAL2GI_BASE_INFO(self)
25
+
26
+ GType
27
+ gi_callback_info_get_type(void)
28
+ {
29
+ static GType type = 0;
30
+ if (type == 0) {
31
+ type = g_boxed_type_register_static("GICallbackInfo",
32
+ (GBoxedCopyFunc)g_base_info_ref,
33
+ (GBoxedFreeFunc)g_base_info_unref);
34
+ }
35
+ return type;
36
+ }
37
+
38
+ void
39
+ rb_gi_callback_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo)
40
+ {
41
+ VALUE RG_TARGET_NAMESPACE;
42
+
43
+ RG_TARGET_NAMESPACE =
44
+ G_DEF_CLASS_WITH_PARENT(GI_TYPE_CALLBACK_INFO, "CallbackInfo", rb_mGI,
45
+ rb_cGICallableInfo);
46
+
47
+ (void)RG_TARGET_NAMESPACE; /* suppress a warning. */
48
+ }
@@ -0,0 +1,77 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rb-gobject-introspection.h"
22
+
23
+ #define RG_TARGET_NAMESPACE rb_cGIConstantInfo
24
+ #define SELF(self) (RVAL2GI_CONSTANT_INFO(self))
25
+
26
+ GType
27
+ gi_constant_info_get_type(void)
28
+ {
29
+ static GType type = 0;
30
+ if (type == 0) {
31
+ type = g_boxed_type_register_static("GIConstantInfo",
32
+ (GBoxedCopyFunc)g_base_info_ref,
33
+ (GBoxedFreeFunc)g_base_info_unref);
34
+ }
35
+ return type;
36
+ }
37
+
38
+ static VALUE
39
+ rg_type(VALUE self)
40
+ {
41
+ GIConstantInfo *info;
42
+
43
+ info = SELF(self);
44
+ return GI_BASE_INFO2RVAL_WITH_UNREF(g_constant_info_get_type(info));
45
+ }
46
+
47
+ static VALUE
48
+ rg_value(VALUE self)
49
+ {
50
+ GIConstantInfo *info;
51
+ GIArgument value;
52
+ gint value_size;
53
+ GITypeInfo *type_info;
54
+ VALUE rb_value;
55
+
56
+ info = SELF(self);
57
+ type_info = g_constant_info_get_type(info);
58
+ value_size = g_constant_info_get_value(info, &value);
59
+ rb_value = GI_ARGUMENT2RVAL(&value, type_info);
60
+ g_base_info_unref(type_info);
61
+ g_constant_info_free_value(info, &value);
62
+
63
+ return rb_value;
64
+ }
65
+
66
+ void
67
+ rb_gi_constant_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo)
68
+ {
69
+ VALUE RG_TARGET_NAMESPACE;
70
+
71
+ RG_TARGET_NAMESPACE =
72
+ G_DEF_CLASS_WITH_PARENT(GI_TYPE_CONSTANT_INFO, "ConstantInfo", rb_mGI,
73
+ rb_cGIBaseInfo);
74
+
75
+ RG_DEF_METHOD(type, 0);
76
+ RG_DEF_METHOD(value, 0);
77
+ }