gobject-introspection 3.1.1-x64-mingw32 → 3.1.2-x64-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/ext/gobject-introspection/extconf.rb +2 -2
- data/ext/gobject-introspection/rb-gi-argument.c +65 -10
- data/ext/gobject-introspection/rb-gi-field-info.c +81 -14
- data/ext/gobject-introspection/rb-gi-loader.c +8 -3
- data/ext/gobject-introspection/rb-gi-repository.c +5 -1
- data/lib/2.2/gobject_introspection.so +0 -0
- data/lib/2.3/gobject_introspection.so +0 -0
- data/lib/2.4/gobject_introspection.so +0 -0
- data/lib/gobject-introspection/loader.rb +49 -13
- data/lib/gobject-introspection/repository.rb +7 -0
- data/test/test-union-info.rb +34 -2
- data/vendor/local/bin/g-ir-compiler.exe +0 -0
- data/vendor/local/bin/g-ir-generate.exe +0 -0
- data/vendor/local/bin/g-ir-inspect.exe +0 -0
- data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
- data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.py +5 -4
- data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.py +8 -7
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.py +1 -1
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +3 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.py +1 -6
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
- data/vendor/local/lib/libgirepository-1.0.a +0 -0
- data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
- data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +1 -1
- data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +1 -1
- data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +18 -6
- data/vendor/local/share/gir-1.0/GLib-2.0.gir +186 -61
- data/vendor/local/share/gir-1.0/GObject-2.0.gir +565 -389
- data/vendor/local/share/gir-1.0/Gio-2.0.gir +921 -57
- data/vendor/local/share/gobject-introspection-1.0/Makefile.introspection +4 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +262 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.h +45 -1
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +37 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +4 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79e9eb23e75d06f3e3e6435243ed17bfcfe01505
|
4
|
+
data.tar.gz: 744f2fead7bed865f3eb48407c579943f1fca5f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebe39293a4c14a2346f1d174c25693c287ff029b8233639c5d85e9bae8ceca410f2547b1b1ee7a2638c4e49a8643015c3d4f22bfe2d02723882c0500e89d1c92
|
7
|
+
data.tar.gz: 25590862a83dfbd36b514e0778246d12e8e9b9c52cf79ceb3d57abce6b4a01c5ccf80d6f5d7448af0b0c9e8e4df2a55ce8702f2cbd6b542aa0c086205e486201
|
data/Rakefile
CHANGED
@@ -32,7 +32,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
32
32
|
:name => "glib",
|
33
33
|
:download_site => :gnome,
|
34
34
|
:label => "GLib",
|
35
|
-
:version => "2.
|
35
|
+
:version => "2.52.1",
|
36
36
|
:compression_method => "xz",
|
37
37
|
:windows => {
|
38
38
|
:build => false,
|
@@ -47,7 +47,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
47
47
|
:name => "gobject-introspection",
|
48
48
|
:download_site => :gnome,
|
49
49
|
:label => "gobject-introspection",
|
50
|
-
:version => "1.
|
50
|
+
:version => "1.52.1",
|
51
51
|
:compression_method => "xz",
|
52
52
|
:windows => {
|
53
53
|
:configure_args => [
|
@@ -57,11 +57,11 @@ end
|
|
57
57
|
setup_windows(module_name, base_dir)
|
58
58
|
|
59
59
|
unless required_pkg_config_package(package_id,
|
60
|
-
:
|
60
|
+
:alt_linux => "gobject-introspection-devel",
|
61
61
|
:debian => "libgirepository1.0-dev",
|
62
62
|
:redhat => "gobject-introspection-devel",
|
63
63
|
:homebrew => "gobject-introspection",
|
64
|
-
:
|
64
|
+
:arch_linux => "gobject-introspection",
|
65
65
|
:macports => "gobject-introspection")
|
66
66
|
exit(false)
|
67
67
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2012-
|
3
|
+
* Copyright (C) 2012-2017 Ruby-GNOME2 Project Team
|
4
4
|
*
|
5
5
|
* This library is free software; you can redistribute it and/or
|
6
6
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -37,8 +37,28 @@ interface_struct_to_ruby(gpointer object,
|
|
37
37
|
|
38
38
|
namespace = g_base_info_get_namespace(interface_info);
|
39
39
|
name = g_base_info_get_name(interface_info);
|
40
|
+
|
41
|
+
if (strcmp(namespace, "cairo") == 0) {
|
42
|
+
gchar *gtype_name;
|
43
|
+
GType gtype;
|
44
|
+
|
45
|
+
gtype_name = g_strdup_printf("Cairo%s", name);
|
46
|
+
gtype = g_type_from_name(gtype_name);
|
47
|
+
g_free(gtype_name);
|
48
|
+
return BOXED2RVAL(target_object, gtype);
|
49
|
+
}
|
50
|
+
|
40
51
|
rb_module = rb_const_get(rb_cObject, rb_intern(namespace));
|
41
52
|
rb_class = rb_const_get(rb_module, rb_intern(name));
|
53
|
+
if (rb_respond_to(rb_class, rb_intern("gtype"))) {
|
54
|
+
VALUE rb_gtype;
|
55
|
+
GType gtype;
|
56
|
+
|
57
|
+
rb_gtype = rb_funcall(rb_class, rb_intern("gtype"), 0);
|
58
|
+
gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
|
59
|
+
return BOXED2RVAL(target_object, gtype);
|
60
|
+
}
|
61
|
+
|
42
62
|
if (duplicate) {
|
43
63
|
size_t object_size;
|
44
64
|
object_size = g_struct_info_get_size(interface_info);
|
@@ -166,12 +186,20 @@ array_c_to_ruby_sized(gconstpointer *elements,
|
|
166
186
|
switch (element_type_tag) {
|
167
187
|
case GI_TYPE_TAG_VOID:
|
168
188
|
case GI_TYPE_TAG_BOOLEAN:
|
169
|
-
case GI_TYPE_TAG_INT8:
|
170
189
|
g_base_info_unref(element_type_info);
|
171
190
|
rb_raise(rb_eNotImpError,
|
172
191
|
"TODO: GIArgument(array)[c][%s] -> Ruby",
|
173
192
|
g_type_tag_to_string(element_type_tag));
|
174
193
|
break;
|
194
|
+
case GI_TYPE_TAG_INT8:
|
195
|
+
g_base_info_unref(element_type_info);
|
196
|
+
{
|
197
|
+
const gint8 *numbers = (const gint8 *)elements;
|
198
|
+
for (i = 0; i < n_elements; i++) {
|
199
|
+
rb_ary_push(rb_array, INT2NUM(numbers[i]));
|
200
|
+
}
|
201
|
+
}
|
202
|
+
break;
|
175
203
|
case GI_TYPE_TAG_UINT8:
|
176
204
|
g_base_info_unref(element_type_info);
|
177
205
|
{
|
@@ -198,7 +226,20 @@ array_c_to_ruby_sized(gconstpointer *elements,
|
|
198
226
|
}
|
199
227
|
break;
|
200
228
|
case GI_TYPE_TAG_UINT32:
|
229
|
+
g_base_info_unref(element_type_info);
|
230
|
+
rb_raise(rb_eNotImpError,
|
231
|
+
"TODO: GIArgument(array)[c][%s] -> Ruby",
|
232
|
+
g_type_tag_to_string(element_type_tag));
|
233
|
+
break;
|
201
234
|
case GI_TYPE_TAG_INT64:
|
235
|
+
g_base_info_unref(element_type_info);
|
236
|
+
{
|
237
|
+
const gint64 *numbers = (const gint64 *)elements;
|
238
|
+
for (i = 0; i < n_elements; i++) {
|
239
|
+
rb_ary_push(rb_array, LL2NUM(numbers[i]));
|
240
|
+
}
|
241
|
+
}
|
242
|
+
break;
|
202
243
|
case GI_TYPE_TAG_UINT64:
|
203
244
|
case GI_TYPE_TAG_FLOAT:
|
204
245
|
case GI_TYPE_TAG_DOUBLE:
|
@@ -570,12 +611,6 @@ rb_gi_argument_to_ruby_interface(GIArgument *argument,
|
|
570
611
|
duplicate,
|
571
612
|
type_info,
|
572
613
|
interface_info);
|
573
|
-
} else if (gtype == G_TYPE_BYTES) {
|
574
|
-
GBytes *bytes = argument->v_pointer;
|
575
|
-
gconstpointer data;
|
576
|
-
gsize size;
|
577
|
-
data = g_bytes_get_data(bytes, &size);
|
578
|
-
rb_interface = rb_enc_str_new(data, size, rb_ascii8bit_encoding());
|
579
614
|
} else if (gtype == G_TYPE_VARIANT) {
|
580
615
|
GVariant *variant = argument->v_pointer;
|
581
616
|
rb_interface = rbg_variant_to_ruby(variant);
|
@@ -1234,7 +1269,14 @@ rb_gi_out_argument_init_array_c(GIArgument *argument,
|
|
1234
1269
|
break;
|
1235
1270
|
case GI_TYPE_TAG_FILENAME:
|
1236
1271
|
case GI_TYPE_TAG_ARRAY:
|
1272
|
+
g_base_info_unref(element_type_info);
|
1273
|
+
rb_raise(rb_eNotImpError,
|
1274
|
+
"TODO: allocates GIArgument(array)[c][%s] for output",
|
1275
|
+
g_type_tag_to_string(element_type_tag));
|
1276
|
+
break;
|
1237
1277
|
case GI_TYPE_TAG_INTERFACE:
|
1278
|
+
argument->v_pointer = xmalloc(sizeof(gpointer *));
|
1279
|
+
break;
|
1238
1280
|
case GI_TYPE_TAG_GLIST:
|
1239
1281
|
case GI_TYPE_TAG_GSLIST:
|
1240
1282
|
case GI_TYPE_TAG_GHASH:
|
@@ -1791,7 +1833,14 @@ rb_gi_out_argument_fin_array_c(GIArgument *argument,
|
|
1791
1833
|
break;
|
1792
1834
|
case GI_TYPE_TAG_FILENAME:
|
1793
1835
|
case GI_TYPE_TAG_ARRAY:
|
1836
|
+
g_base_info_unref(element_type_info);
|
1837
|
+
rb_raise(rb_eNotImpError,
|
1838
|
+
"TODO: free out GIArgument(array)[c][%s]",
|
1839
|
+
g_type_tag_to_string(element_type_tag));
|
1840
|
+
break;
|
1794
1841
|
case GI_TYPE_TAG_INTERFACE:
|
1842
|
+
xfree(argument->v_pointer);
|
1843
|
+
break;
|
1795
1844
|
case GI_TYPE_TAG_GLIST:
|
1796
1845
|
case GI_TYPE_TAG_GSLIST:
|
1797
1846
|
case GI_TYPE_TAG_GHASH:
|
@@ -2805,11 +2854,17 @@ rb_gi_value_argument_from_ruby(GIArgument *argument, GITypeInfo *type_info,
|
|
2805
2854
|
break;
|
2806
2855
|
case GI_TYPE_TAG_GHASH:
|
2807
2856
|
case GI_TYPE_TAG_ERROR:
|
2808
|
-
case GI_TYPE_TAG_UNICHAR:
|
2809
2857
|
rb_raise(rb_eNotImpError,
|
2810
2858
|
"TODO: Ruby -> GIArgument(%s)",
|
2811
2859
|
g_type_tag_to_string(type_tag));
|
2812
2860
|
break;
|
2861
|
+
case GI_TYPE_TAG_UNICHAR:
|
2862
|
+
if (NIL_P(rb_argument)) {
|
2863
|
+
argument->v_uint32 = 0;
|
2864
|
+
} else {
|
2865
|
+
argument->v_uint32 = NUM2UINT(rb_argument);
|
2866
|
+
}
|
2867
|
+
break;
|
2813
2868
|
default:
|
2814
2869
|
g_assert_not_reached();
|
2815
2870
|
break;
|
@@ -2917,7 +2972,7 @@ static void
|
|
2917
2972
|
rb_gi_in_argument_transfer_interface(GIArgument *argument,
|
2918
2973
|
G_GNUC_UNUSED GITransfer transfer,
|
2919
2974
|
GITypeInfo *type_info,
|
2920
|
-
|
2975
|
+
VALUE rb_argument)
|
2921
2976
|
{
|
2922
2977
|
GIBaseInfo *interface_info;
|
2923
2978
|
GIInfoType interface_type;
|
@@ -75,6 +75,7 @@ VALUE
|
|
75
75
|
rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory)
|
76
76
|
{
|
77
77
|
GIArgument argument;
|
78
|
+
gboolean processed = FALSE;
|
78
79
|
GITypeInfo *type_info;
|
79
80
|
GITypeTag type_tag;
|
80
81
|
VALUE rb_field_value;
|
@@ -82,17 +83,51 @@ rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory)
|
|
82
83
|
type_info = g_field_info_get_type(info);
|
83
84
|
type_tag = g_type_info_get_tag(type_info);
|
84
85
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
86
|
+
switch (type_tag) {
|
87
|
+
case GI_TYPE_TAG_INTERFACE:
|
88
|
+
{
|
89
|
+
GIBaseInfo *interface_info;
|
90
|
+
GIInfoType interface_type;
|
91
|
+
|
92
|
+
interface_info = g_type_info_get_interface(type_info);
|
93
|
+
interface_type = g_base_info_get_type(interface_info);
|
94
|
+
switch (interface_type) {
|
95
|
+
case GI_INFO_TYPE_STRUCT:
|
96
|
+
case GI_INFO_TYPE_UNION:
|
97
|
+
case GI_INFO_TYPE_BOXED:
|
98
|
+
{
|
99
|
+
int offset;
|
100
|
+
|
101
|
+
offset = g_field_info_get_offset(info);
|
102
|
+
argument.v_pointer = G_STRUCT_MEMBER(gpointer, memory, offset);
|
103
|
+
processed = TRUE;
|
104
|
+
}
|
105
|
+
break;
|
106
|
+
default:
|
107
|
+
break;
|
108
|
+
}
|
109
|
+
g_base_info_unref(interface_info);
|
110
|
+
}
|
111
|
+
break;
|
112
|
+
case GI_TYPE_TAG_UTF8:
|
113
|
+
{
|
114
|
+
int offset;
|
115
|
+
offset = g_field_info_get_offset(info);
|
116
|
+
argument.v_string = G_STRUCT_MEMBER(gchar *, memory, offset);
|
117
|
+
processed = TRUE;
|
118
|
+
}
|
119
|
+
break;
|
120
|
+
default:
|
121
|
+
break;
|
90
122
|
}
|
91
123
|
|
92
|
-
if (
|
93
|
-
|
94
|
-
|
95
|
-
|
124
|
+
if (!processed) {
|
125
|
+
if (!g_field_info_get_field(info, memory, &argument)) {
|
126
|
+
g_base_info_unref(type_info);
|
127
|
+
rb_raise(rb_eArgError, "failed to get field value: %s[%s]",
|
128
|
+
g_base_info_get_name(info),
|
129
|
+
g_type_tag_to_string(type_tag));
|
130
|
+
}
|
96
131
|
}
|
97
132
|
|
98
133
|
rb_field_value = GI_ARGUMENT2RVAL(&argument, FALSE, type_info,
|
@@ -117,11 +152,43 @@ rb_gi_field_info_set_field_raw(GIFieldInfo *info, gpointer memory,
|
|
117
152
|
|
118
153
|
succeeded = g_field_info_set_field(info, memory, &field_value);
|
119
154
|
if (!succeeded) {
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
155
|
+
switch (type_tag) {
|
156
|
+
case GI_TYPE_TAG_INTERFACE:
|
157
|
+
{
|
158
|
+
GIBaseInfo *interface_info;
|
159
|
+
GIInfoType interface_type;
|
160
|
+
|
161
|
+
interface_info = g_type_info_get_interface(type_info);
|
162
|
+
interface_type = g_base_info_get_type(interface_info);
|
163
|
+
switch (interface_type) {
|
164
|
+
case GI_INFO_TYPE_STRUCT:
|
165
|
+
case GI_INFO_TYPE_UNION:
|
166
|
+
case GI_INFO_TYPE_BOXED:
|
167
|
+
{
|
168
|
+
int offset;
|
169
|
+
|
170
|
+
offset = g_field_info_get_offset(info);
|
171
|
+
G_STRUCT_MEMBER(gpointer, memory, offset) =
|
172
|
+
field_value.v_pointer;
|
173
|
+
succeeded = TRUE;
|
174
|
+
}
|
175
|
+
break;
|
176
|
+
default:
|
177
|
+
break;
|
178
|
+
}
|
179
|
+
g_base_info_unref(interface_info);
|
180
|
+
}
|
181
|
+
break;
|
182
|
+
case GI_TYPE_TAG_UTF8:
|
183
|
+
{
|
184
|
+
int offset;
|
185
|
+
offset = g_field_info_get_offset(info);
|
186
|
+
G_STRUCT_MEMBER(gchar *, memory, offset) = field_value.v_string;
|
187
|
+
succeeded = TRUE;
|
188
|
+
}
|
189
|
+
break;
|
190
|
+
default:
|
191
|
+
break;
|
125
192
|
}
|
126
193
|
}
|
127
194
|
rb_gi_value_argument_free(rb_field_value, &field_value, type_info);
|
@@ -57,6 +57,12 @@ rg_s_define_interface(G_GNUC_UNUSED VALUE klass,
|
|
57
57
|
return G_DEF_INTERFACE(gtype, RVAL2CSTR(rb_name), rb_module);
|
58
58
|
}
|
59
59
|
|
60
|
+
static void
|
61
|
+
struct_free(void *pointer)
|
62
|
+
{
|
63
|
+
xfree(pointer);
|
64
|
+
}
|
65
|
+
|
60
66
|
static VALUE
|
61
67
|
struct_alloc(VALUE klass)
|
62
68
|
{
|
@@ -66,9 +72,8 @@ struct_alloc(VALUE klass)
|
|
66
72
|
|
67
73
|
rb_size = rb_iv_get(klass, "@size");
|
68
74
|
size = NUM2ULONG(rb_size);
|
69
|
-
instance =
|
70
|
-
|
71
|
-
return Data_Wrap_Struct(klass, NULL, xfree, instance);
|
75
|
+
instance = xcalloc(1, size);
|
76
|
+
return Data_Wrap_Struct(klass, NULL, struct_free, instance);
|
72
77
|
}
|
73
78
|
|
74
79
|
static VALUE
|
@@ -270,5 +270,9 @@ rb_gi_repository_init(VALUE rb_mGI)
|
|
270
270
|
RG_DEF_METHOD(get_version, 1);
|
271
271
|
|
272
272
|
G_DEF_CLASS(G_TYPE_I_REPOSITORY_LOAD_FLAGS, "RepositoryLoadFlags", rb_mGI);
|
273
|
-
|
273
|
+
G_DEF_ERROR(G_IREPOSITORY_ERROR,
|
274
|
+
"RepositoryError",
|
275
|
+
rb_mGI,
|
276
|
+
rb_eLoadError,
|
277
|
+
G_TYPE_I_REPOSITORY_ERROR);
|
274
278
|
}
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2012-
|
1
|
+
# Copyright (C) 2012-2017 Ruby-GNOME2 Project Team
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -118,9 +118,11 @@ module GObjectIntrospection
|
|
118
118
|
klass = self.class.define_struct(info.size, name, @base_module,
|
119
119
|
:parent => options[:parent])
|
120
120
|
else
|
121
|
+
size = info.size
|
122
|
+
size = nil if size.zero?
|
121
123
|
klass = self.class.define_class(info.gtype, name, @base_module,
|
122
124
|
:parent => options[:parent],
|
123
|
-
:size =>
|
125
|
+
:size => size)
|
124
126
|
end
|
125
127
|
load_fields(info, klass)
|
126
128
|
load_methods(info, klass)
|
@@ -133,7 +135,7 @@ module GObjectIntrospection
|
|
133
135
|
method_infos = info.methods.find_all do |method_info|
|
134
136
|
method_info.is_a?(MethodInfo)
|
135
137
|
end
|
136
|
-
unless
|
138
|
+
unless method_infos.empty?
|
137
139
|
base_class = @base_module.const_get(base_class_name)
|
138
140
|
load_method_infos(method_infos, base_class.singleton_class)
|
139
141
|
end
|
@@ -233,23 +235,33 @@ module GObjectIntrospection
|
|
233
235
|
field_info.name
|
234
236
|
end
|
235
237
|
|
236
|
-
def load_field(info, i, field_info, klass)
|
238
|
+
def load_field(info, i, field_info, klass, options={})
|
237
239
|
name = field_name(field_info, klass)
|
238
240
|
flags = field_info.flags
|
239
241
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
242
|
+
readable = options[:readable]
|
243
|
+
readable = flags.readable? if readable.nil?
|
244
|
+
need_number_to_bool_convert = false
|
245
|
+
if name.start_with?("is_") and
|
246
|
+
field_info.type.tag == TypeTag::UINT32
|
247
|
+
need_number_to_bool_convert = true
|
248
|
+
end
|
249
|
+
if readable
|
250
|
+
reader_method_name = rubyish_field_reader_name(field_info, name)
|
246
251
|
remove_existing_method(klass, reader_method_name)
|
247
252
|
klass.__send__(:define_method, reader_method_name) do ||
|
248
|
-
info.get_field_value(self, i)
|
253
|
+
value = info.get_field_value(self, i)
|
254
|
+
if need_number_to_bool_convert
|
255
|
+
value != 0
|
256
|
+
else
|
257
|
+
value
|
258
|
+
end
|
249
259
|
end
|
250
260
|
end
|
251
261
|
|
252
|
-
|
262
|
+
writable = options[:writable]
|
263
|
+
writable = flags.writable? if writable.nil?
|
264
|
+
if writable
|
253
265
|
klass.__send__(:define_method, "#{name}=") do |value|
|
254
266
|
info.set_field_value(self, i, value)
|
255
267
|
end
|
@@ -413,8 +425,17 @@ module GObjectIntrospection
|
|
413
425
|
if options[:prefix]
|
414
426
|
name = name.gsub(/\A#{Regexp.escape(options[:prefix])}/, "")
|
415
427
|
end
|
428
|
+
if name == "initialize"
|
429
|
+
name += "_raw"
|
430
|
+
end
|
416
431
|
return_type = function_info.return_type
|
417
432
|
return_type_tag = return_type.tag
|
433
|
+
if return_type_tag == TypeTag::VOID
|
434
|
+
out_arg_tags = function_info.out_args.collect {|arg| arg.type.tag}
|
435
|
+
if out_arg_tags == [TypeTag::ARRAY, TypeTag::INT32]
|
436
|
+
return_type_tag = TypeTag::ARRAY
|
437
|
+
end
|
438
|
+
end
|
418
439
|
case return_type_tag
|
419
440
|
when TypeTag::BOOLEAN
|
420
441
|
case name
|
@@ -443,7 +464,7 @@ module GObjectIntrospection
|
|
443
464
|
else
|
444
465
|
name
|
445
466
|
end
|
446
|
-
when TypeTag::GLIST, TypeTag::GSLIST
|
467
|
+
when TypeTag::GLIST, TypeTag::GSLIST, TypeTag::ARRAY
|
447
468
|
case name
|
448
469
|
when /\A(?:list|get)_/
|
449
470
|
if function_info.n_in_args.zero?
|
@@ -472,6 +493,21 @@ module GObjectIntrospection
|
|
472
493
|
end
|
473
494
|
end
|
474
495
|
|
496
|
+
def rubyish_field_reader_name(field_info, name)
|
497
|
+
case field_info.type.tag
|
498
|
+
when TypeTag::BOOLEAN
|
499
|
+
name.gsub(/\Ais_/, "") + "?"
|
500
|
+
when TypeTag::UINT32
|
501
|
+
if /\Ais_/ =~ name
|
502
|
+
"#{$POSTMATCH}?"
|
503
|
+
else
|
504
|
+
name
|
505
|
+
end
|
506
|
+
else
|
507
|
+
name
|
508
|
+
end
|
509
|
+
end
|
510
|
+
|
475
511
|
def rubyish_class_name(info)
|
476
512
|
name = info.name
|
477
513
|
case info
|