gobject-introspection 3.4.3 → 3.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49167989e84276d322d8ec6fc0e7a189924c62b5ff7daccfb76040284c75909d
4
- data.tar.gz: 045e683e7f9ffef5731b9763cada4c841243fda0ac14622cff3612454dc72ae3
3
+ metadata.gz: d072b72b786e12f881fea9bde17a9eff9a4c71bedd25f4ecdd2b18267b8ba051
4
+ data.tar.gz: c9e9e78f5c492cb8fea24a1b54e05c2cedad2ec6ce877030cdb3782863340673
5
5
  SHA512:
6
- metadata.gz: d8ca3007506eb8d0a91ba925678de9bbe3a1b3c2d295a968f47a1035efc031d6d8e254bb814c3638abfc415263cf991cbb9e60ff598585d2baa9b4ac02cb3ed8
7
- data.tar.gz: eaf8f55fb4cf71eba636f840e8bcfea3850f127736fd9ae650fb6d8d981d31d7618a6c78e22f887d22e436f1c5fd6a897cf260281ab054b89fe560eac761db00
6
+ metadata.gz: a24acd65c6f1ddfe47665819bbb37c6121e2c154183c23f64512e4e6ad3b9ba52cde4f035d06754f45071afed0a3db82024efe2ceac596b3d45eeb2027d182d2
7
+ data.tar.gz: 1cdf78cd475b3401ecbd261b182b4271989600a2aef1f572e14c460fa25a84350c0c515edd301c4af7e27ad79943d9c33e24f21fa01c2d5634e7cbd9aec51d38
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (C) 2012-2019 Ruby-GNOME Project Team
3
+ # Copyright (C) 2012-2021 Ruby-GNOME 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
@@ -62,9 +62,6 @@ end
62
62
  # TODO: Remove this when we dropped support for GObject Introspection < 1.60
63
63
  make_version_header("GI", package_id, ".")
64
64
 
65
- gi_headers = ["girepository.h"]
66
- have_func("g_interface_info_find_signal", gi_headers)
67
-
68
65
  enum_type_prefix = "gobject-introspection-enum-types"
69
66
  include_paths = PKGConfig.cflags_only_I(package_id)
70
67
  headers = include_paths.split.inject([]) do |result, path|
@@ -682,7 +682,7 @@ rb_gi_arguments_in_init_arg_ruby_array_c_gtype(RBGIArguments *args,
682
682
  raw_array = ALLOC_N(GType, n_elements);
683
683
  for (i = 0; i < n_elements; i++) {
684
684
  VALUE rb_type = RARRAY_AREF(rb_array, i);
685
- raw_array[i] = rbgobj_gtype_get(rb_type);
685
+ raw_array[i] = rbgobj_gtype_from_ruby(rb_type);
686
686
  }
687
687
 
688
688
  rb_gi_arguments_in_init_arg_ruby_array_c_generic(args,
@@ -1262,15 +1262,6 @@ rb_gi_arguments_in_init_arg_ruby_interface(RBGIArguments *args,
1262
1262
  rb_gi_transfer_to_string(metadata->transfer));
1263
1263
  break;
1264
1264
  case GI_INFO_TYPE_STRUCT:
1265
- if (metadata->transfer != GI_TRANSFER_NOTHING) {
1266
- rb_raise(rb_eNotImpError,
1267
- "TODO: [%s] %s Ruby -> GIArgument(interface)[%s][%s][%s]",
1268
- metadata->name,
1269
- rb_gi_direction_to_string(metadata->direction),
1270
- g_info_type_to_string(metadata->type.interface_type),
1271
- g_type_name(metadata->type.interface_gtype),
1272
- rb_gi_transfer_to_string(metadata->transfer));
1273
- }
1274
1265
  metadata->free_func = rb_gi_arguments_in_free_interface_struct;
1275
1266
  if (metadata->type.interface_gtype == G_TYPE_VALUE) {
1276
1267
  GValue *gvalue;
@@ -105,10 +105,11 @@ rb_gi_arguments_out_free_array_c_interface(RBGIArguments *args,
105
105
  case GI_TRANSFER_EVERYTHING:
106
106
  default:
107
107
  rb_raise(rb_eNotImpError,
108
- "TODO: [%s] %s free GIArgument(%s)[%s]",
108
+ "TODO: [%s] %s free GIArgument(%s/%s)[%s]",
109
109
  metadata->name,
110
110
  rb_gi_direction_to_string(metadata->direction),
111
111
  g_type_tag_to_string(metadata->type.tag),
112
+ rb_gi_array_type_to_string(metadata->array_type),
112
113
  rb_gi_transfer_to_string(metadata->transfer));
113
114
  }
114
115
  xfree(target);
@@ -120,17 +121,34 @@ rb_gi_arguments_out_free_array_array_interface_struct(RBGIArguments *args,
120
121
  gpointer user_data)
121
122
  {
122
123
  GArray *target = metadata->out_arg->v_pointer;
124
+ GType gtype = metadata->element_type.interface_gtype;
123
125
  switch (metadata->transfer) {
124
126
  case GI_TRANSFER_NOTHING:
125
127
  break;
126
128
  case GI_TRANSFER_CONTAINER:
129
+ break;
127
130
  case GI_TRANSFER_EVERYTHING:
131
+ if (gtype == G_TYPE_NONE) {
132
+ /* If the target struct is raw (not GType-ed) struct, we
133
+ * can't know how to free fields in the target struct. We
134
+ * assume that the target struct doesn't allocate nothing
135
+ * for its fields.
136
+ *
137
+ * e.g.: The attributes out argument in
138
+ * vte_terminal_get_text_range():
139
+ * https://developer.gnome.org/vte/unstable/VteTerminal.html#vte-terminal-get-text-range
140
+ */
141
+ break;
142
+ }
128
143
  default:
129
144
  rb_raise(rb_eNotImpError,
130
- "TODO: [%s] %s free GIArgument(%s)[%s]",
145
+ "TODO: [%s] %s free GIArgument(%s/%s)[interface(%s)](%s)[%s]",
131
146
  metadata->name,
132
147
  rb_gi_direction_to_string(metadata->direction),
133
148
  g_type_tag_to_string(metadata->type.tag),
149
+ rb_gi_array_type_to_string(metadata->array_type),
150
+ g_info_type_to_string(metadata->element_type.interface_type),
151
+ g_type_name(metadata->element_type.interface_gtype),
134
152
  rb_gi_transfer_to_string(metadata->transfer));
135
153
  }
136
154
  g_array_free(target, TRUE);
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2019 Ruby-GNOME Project Team
3
+ * Copyright (C) 2012-2021 Ruby-GNOME 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
@@ -23,16 +23,7 @@
23
23
  static gboolean
24
24
  rb_gi_arg_info_may_be_null(GIArgInfo *arg_info)
25
25
  {
26
- #if GI_CHECK_VERSION(1, 42, 0)
27
26
  return g_arg_info_may_be_null(arg_info);
28
- #else
29
- /*
30
- GObject Introspection < 1.42 doesn't support "(nullable)" yet.
31
- So, we assume that all argument may be NULL. It's danger but
32
- convenient.
33
- */
34
- return TRUE;
35
- #endif
36
27
  }
37
28
 
38
29
  static gboolean
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2017 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2012-2021 Ruby-GNOME 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
@@ -125,15 +125,9 @@ rg_get_signal(VALUE self, VALUE rb_n_or_name)
125
125
  n = NUM2INT(rb_n_or_name);
126
126
  signal_info = g_interface_info_get_signal(info, n);
127
127
  } else {
128
- #ifdef HAVE_G_INTERFACE_INFO_FIND_SIGNAL
129
128
  const char *name;
130
129
  name = RVAL2CSTR(rb_n_or_name);
131
130
  signal_info = g_interface_info_find_signal(info, name);
132
- #else
133
- rb_raise(rb_eArgError,
134
- "g_interface_info_find_signal() is defined "
135
- "since GObjectIntrospection 1.34");
136
- #endif
137
131
  }
138
132
 
139
133
  return GI_BASE_INFO2RVAL_WITH_UNREF(signal_info);
@@ -39,7 +39,7 @@ rg_s_define_class(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass)
39
39
  "size", &rb_size,
40
40
  NULL);
41
41
 
42
- gtype = NUM2ULONG(rb_to_int(rb_gtype));
42
+ gtype = rbgobj_gtype_from_ruby(rb_gtype);
43
43
  rb_class = G_DEF_CLASS_WITH_PARENT(gtype, RVAL2CSTR(rb_name),
44
44
  rb_module, rb_parent);
45
45
  if (!NIL_P(rb_size)) {
@@ -54,7 +54,7 @@ rg_s_define_interface(G_GNUC_UNUSED VALUE klass,
54
54
  {
55
55
  GType gtype;
56
56
 
57
- gtype = rbgobj_gtype_get(rb_gtype);
57
+ gtype = rbgobj_gtype_from_ruby(rb_gtype);
58
58
  return G_DEF_INTERFACE(gtype, RVAL2CSTR(rb_name), rb_module);
59
59
  }
60
60
 
@@ -133,7 +133,7 @@ rg_s_define_error(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass)
133
133
  }
134
134
 
135
135
  if (!NIL_P(rb_gtype)) {
136
- gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
136
+ gtype = rbgobj_gtype_from_ruby(rb_gtype);
137
137
  }
138
138
 
139
139
  return G_DEF_ERROR(domain, name, rb_module, rb_parent, gtype);
@@ -173,12 +173,10 @@ rg_s_register_boxed_class_converter(VALUE klass, VALUE rb_gtype)
173
173
  {
174
174
  RGConvertTable table;
175
175
  BoxedInstance2RObjData *data;
176
- ID id_to_i;
177
176
  VALUE boxed_class_converters;
178
177
 
179
178
  memset(&table, 0, sizeof(RGConvertTable));
180
- CONST_ID(id_to_i, "to_i");
181
- table.type = NUM2ULONG(rb_funcall(rb_gtype, id_to_i, 0));
179
+ table.type = rbgobj_gtype_from_ruby(rb_gtype);
182
180
  table.klass = Qnil;
183
181
  table.instance2robj = boxed_instance2robj;
184
182
 
@@ -243,12 +241,10 @@ rg_s_register_object_class_converter(VALUE klass, VALUE rb_gtype)
243
241
  {
244
242
  RGConvertTable table;
245
243
  ObjectInstance2RObjData *data;
246
- ID id_to_i;
247
244
  VALUE object_class_converters;
248
245
 
249
246
  memset(&table, 0, sizeof(RGConvertTable));
250
- CONST_ID(id_to_i, "to_i");
251
- table.type = NUM2ULONG(rb_funcall(rb_gtype, id_to_i, 0));
247
+ table.type = rbgobj_gtype_from_ruby(rb_gtype);
252
248
  table.klass = Qnil;
253
249
  table.instance2robj = object_instance2robj;
254
250
 
@@ -228,7 +228,7 @@ rg_find(int argc, VALUE *argv, VALUE self)
228
228
  VALUE rb_gtype;
229
229
  GType gtype;
230
230
  rb_gtype = argv[0];
231
- gtype = NUM2UINT(rb_gtype);
231
+ gtype = rbgobj_gtype_from_ruby(rb_gtype);
232
232
  info = g_irepository_find_by_gtype(SELF(self), gtype);
233
233
  } else {
234
234
  VALUE rb_namespace, rb_name;
@@ -84,7 +84,7 @@ rb_gi_struct_get_raw(VALUE rb_struct, GType gtype)
84
84
  if (rb_respond_to(rb_struct_class, rb_intern("gtype"))) {
85
85
  VALUE rb_gtype;
86
86
  rb_gtype = rb_funcall(rb_struct_class, rb_intern("gtype"), 0);
87
- gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
87
+ gtype = rbgobj_gtype_from_ruby(rb_gtype);
88
88
  }
89
89
  }
90
90
  if (gtype == G_TYPE_NONE) {
@@ -146,7 +146,7 @@ rb_gi_struct_info_to_ruby(GIStructInfo *info,
146
146
  GType gtype;
147
147
 
148
148
  rb_gtype = rb_funcall(rb_class, rb_intern("gtype"), 0);
149
- gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
149
+ gtype = rbgobj_gtype_from_ruby(rb_gtype);
150
150
  return BOXED2RVAL(object, gtype);
151
151
  }
152
152
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2012-2021 Ruby-GNOME 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
@@ -14,7 +14,7 @@
14
14
  # License along with this library; if not, write to the Free Software
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
- require "test-unit"
17
+ require "gobject-introspection"
18
18
 
19
19
  module GObjectIntrospectionTestUtils
20
20
  def require_version(major, minor, micro)
data/test/run-test.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (C) 2012-2020 Ruby-GNOME Project Team
3
+ # Copyright (C) 2012-2021 Ruby-GNOME 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
@@ -16,31 +16,20 @@
16
16
  # License along with this library; if not, write to the Free Software
17
17
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 
19
- ruby_gnome_base = File.join(File.dirname(__FILE__), "..", "..")
20
- ruby_gnome_base = File.expand_path(ruby_gnome_base)
19
+ require_relative "../../glib2/test/run-test"
21
20
 
22
- glib_base = File.join(ruby_gnome_base, "glib2")
23
- gobject_introspection_base = File.join(ruby_gnome_base, "gobject-introspection")
21
+ run_test(__dir__,
22
+ [
23
+ "glib2",
24
+ "gobject-introspection",
25
+ ]) do |context|
26
+ require_relative "gobject-introspection-test-utils"
24
27
 
25
- modules = [
26
- [glib_base, "glib2"],
27
- [gobject_introspection_base, "gobject-introspection"]
28
- ]
29
- modules.each do |target, module_name|
30
- if File.exist?("#{target}/Makefile") and system("which make > /dev/null")
31
- `make -C #{target.dump} > /dev/null` or exit(false)
28
+ begin
29
+ repository = GObjectIntrospection::Repository.default
30
+ repository.require("Gio")
31
+ rescue GObjectIntrospection::RepositoryError
32
+ puts("Omit because typelib file doesn't exist: #{$!.message}")
33
+ exit(true)
32
34
  end
33
- $LOAD_PATH.unshift(File.join(target, "ext", module_name))
34
- $LOAD_PATH.unshift(File.join(target, "lib"))
35
35
  end
36
-
37
- $LOAD_PATH.unshift(File.join(glib_base, "test"))
38
- require "glib-test-init"
39
-
40
- $LOAD_PATH.unshift(File.join(gobject_introspection_base, "test"))
41
- require "gobject-introspection-test-utils"
42
-
43
- require "gobject-introspection"
44
-
45
- exit Test::Unit::AutoRunner.run(true,
46
- File.join(gobject_introspection_base, "test"))
@@ -32,7 +32,15 @@ class TestCallableInfo < Test::Unit::TestCase
32
32
  end
33
33
 
34
34
  def test_may_return_null?
35
- assert_false(@info.may_return_null?)
35
+ if GObjectIntrospection::Version.or_later?(1, 67, 0)
36
+ assert do
37
+ @info.may_return_null?
38
+ end
39
+ else
40
+ assert do
41
+ not @info.may_return_null?
42
+ end
43
+ end
36
44
  end
37
45
 
38
46
  def test_n_args
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gobject-introspection
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.3
4
+ version: 3.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-10 00:00:00.000000000 Z
11
+ date: 2021-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glib2
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.4.3
19
+ version: 3.4.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.4.3
26
+ version: 3.4.4
27
27
  description: Ruby/GObjectIntrospection provides bindings of GObject Introspection
28
28
  and a loader module that can generate dynamically Ruby bindings of any GObject C
29
29
  libraries
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  requirements: []
154
- rubygems_version: 3.2.0.pre1
154
+ rubygems_version: 3.3.0.dev
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Ruby/GObjectIntrospection is a Ruby binding of GObject Introspection.