gobject-introspection 3.1.1-x86-mingw32 → 3.1.2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -2
  3. data/ext/gobject-introspection/extconf.rb +2 -2
  4. data/ext/gobject-introspection/rb-gi-argument.c +65 -10
  5. data/ext/gobject-introspection/rb-gi-field-info.c +81 -14
  6. data/ext/gobject-introspection/rb-gi-loader.c +8 -3
  7. data/ext/gobject-introspection/rb-gi-repository.c +5 -1
  8. data/lib/2.2/gobject_introspection.so +0 -0
  9. data/lib/2.3/gobject_introspection.so +0 -0
  10. data/lib/2.4/gobject_introspection.so +0 -0
  11. data/lib/gobject-introspection/loader.rb +49 -13
  12. data/lib/gobject-introspection/repository.rb +7 -0
  13. data/test/test-union-info.rb +34 -2
  14. data/vendor/local/bin/g-ir-compiler.exe +0 -0
  15. data/vendor/local/bin/g-ir-generate.exe +0 -0
  16. data/vendor/local/bin/g-ir-inspect.exe +0 -0
  17. data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
  18. data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
  19. data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
  20. data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
  21. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
  22. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
  23. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
  24. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
  25. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
  26. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
  27. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
  28. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
  29. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
  30. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
  31. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.py +5 -4
  32. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
  33. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
  34. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
  35. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
  36. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
  37. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
  38. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyc +0 -0
  39. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
  40. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
  41. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
  42. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
  43. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
  44. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
  45. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
  46. data/vendor/local/lib/gobject-introspection/giscanner/dumper.py +8 -7
  47. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
  48. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
  49. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
  50. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
  51. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
  52. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
  53. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.py +1 -1
  54. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
  55. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
  56. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
  57. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
  58. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
  59. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
  60. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
  61. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
  62. data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
  63. data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
  64. data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyc +0 -0
  65. data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyo +0 -0
  66. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +3 -0
  67. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
  68. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
  69. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
  70. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
  71. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
  72. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
  73. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
  74. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
  75. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
  76. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
  77. data/vendor/local/lib/gobject-introspection/giscanner/transformer.py +1 -6
  78. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
  79. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
  80. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
  81. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
  82. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
  83. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
  84. data/vendor/local/lib/libgirepository-1.0.a +0 -0
  85. data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
  86. data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +1 -1
  87. data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +1 -1
  88. data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +18 -6
  89. data/vendor/local/share/gir-1.0/GLib-2.0.gir +186 -61
  90. data/vendor/local/share/gir-1.0/GObject-2.0.gir +565 -389
  91. data/vendor/local/share/gir-1.0/Gio-2.0.gir +921 -57
  92. data/vendor/local/share/gobject-introspection-1.0/Makefile.introspection +4 -0
  93. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +262 -0
  94. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.h +45 -1
  95. data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +37 -0
  96. data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +4 -0
  97. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4dde4e33a1134b3a3fe7791f9e7bb1d58860c63c
4
- data.tar.gz: f1a04c1efa74ae5ea3af1e6adc97d0e1178d8332
3
+ metadata.gz: 0bbff0dae70715f6ab5f75d208331c1d3a2864c5
4
+ data.tar.gz: 50c1e32b7223538244dbc38fca31ff70f5dcc3cb
5
5
  SHA512:
6
- metadata.gz: a8caa208a528b2680ad2dd7a8941f3e087f75f39db461ae92810a5a63f28f90fed216fc4eda51692dcf626fdb32c685fd13b0a0c33fdc406e7ce9f7190ae609b
7
- data.tar.gz: 40fe50407fe05aeaba84c09e45401253fc62608a86f801e0818f94802128b7144fb3ff0cd48cb713f53188804e11d1a5a6506dba72acb072bbfcc562cd17e2d7
6
+ metadata.gz: 4b2cddc7a9815f48579c569630a7414cbdad8dfb84683a1f119a5ec8ccc0baa1cfc3c053ce3c86d27236c7c09e34221a9d11ffbfaa792166a03e6ae61587b36d
7
+ data.tar.gz: 6e1087e584ffe15c5633f92adc440dda2e27753eae99732283c1cd68bb219a0e8907e8e0329ee736a6fed025501d8370d65a7705ef7ff89019095a14964c1f8a
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.50.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.0",
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
- :altlinux => "gobject-introspection-devel",
60
+ :alt_linux => "gobject-introspection-devel",
61
61
  :debian => "libgirepository1.0-dev",
62
62
  :redhat => "gobject-introspection-devel",
63
63
  :homebrew => "gobject-introspection",
64
- :arch => "gobject-introspection",
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-2016 Ruby-GNOME2 Project Team
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
- G_GNUC_UNUSED VALUE rb_argument)
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
- if (!g_field_info_get_field(info, memory, &argument)) {
86
- g_base_info_unref(type_info);
87
- rb_raise(rb_eArgError, "failed to get field value: %s[%s]",
88
- g_base_info_get_name(info),
89
- g_type_tag_to_string(type_tag));
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 (type_tag == GI_TYPE_TAG_UTF8) {
93
- int offset;
94
- offset = g_field_info_get_offset(info);
95
- argument.v_string = G_STRUCT_MEMBER(gchar *, memory, offset);
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
- if (type_tag == GI_TYPE_TAG_UTF8) {
121
- int offset;
122
- offset = g_field_info_get_offset(info);
123
- G_STRUCT_MEMBER(gchar *, memory, offset) = field_value.v_string;
124
- succeeded = TRUE;
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 = xmalloc(size);
70
- memset(instance, 0, size);
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
- G_DEF_CLASS(G_TYPE_I_REPOSITORY_ERROR, "RepositoryError", rb_mGI);
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-2015 Ruby-GNOME2 Project Team
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 => info.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 methods.empty?
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
- if flags.readable?
241
- if field_info.type.tag == TypeTag::BOOLEAN
242
- reader_method_name = "#{name}?"
243
- else
244
- reader_method_name = name
245
- end
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
- if flags.writable?
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