gir_ffi 0.15.4 → 0.15.8

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: 1cd304c670b5b7b26e9bbaa939f2b5162ef3f92f7c0bd78d8e524b1586cbdb3b
4
- data.tar.gz: ccf4916ed552cf23752fb6270a61cfffdea53269b7d4bdb0bb408f3e3de7ae59
3
+ metadata.gz: b7c0566bc2fcd7e7b5ab1381448f4738fdebd617743c524ea18c343e1d3fbce5
4
+ data.tar.gz: 5008632e7cd2fa2190c12f056257f68a94b03fa4a8f225df54fae006b6127db1
5
5
  SHA512:
6
- metadata.gz: 59fa0cf7451808b87a1ff028c0b8309d7c46c2acbbc894c535db4e1b3f30be7d6ee9649472a6932dd1fea0747bda6f56ceb3c753c48370750966c06da509f5bf
7
- data.tar.gz: e2bd4de38d2db08b17e20c1bc42556530b4b14312400d5b9e15dc201eaf1494606bfe56c7fcdf78d632d164f6b553e897f488d533d70ab6d35042e069e5c5f61
6
+ metadata.gz: 7a0f1e2330171a92b26a1c476e0c5b7beaeb2e38e6e0e81d9bb47247b74b02ed7e0e5261c2e7adf33f93860b284e2eddf61a938c584c5cccaab69b2b85d5109c
7
+ data.tar.gz: ddb889010ccc55495ffb306e3996fa6ce37367bbc65ff78f0024df244b3663691879be7f78c53c9543f90b4360dfca35b47bf35a9acf7382271a685aea542cbe
data/Changelog.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.15.8 / 2021-11-20
4
+
5
+ * Drop support for Ruby 2.5
6
+ * Bump minimum supported version of gobject-introspection to 1.56.0
7
+ * Bump minimum supported version of glib to 2.56.0
8
+ * Handle functions that have swapped closure annotation
9
+ * Handle GPtrArray arguments in signal handlers
10
+
11
+ ## 0.15.7 / 2021-01-15
12
+
13
+ * Handle sized arrays with interface element types
14
+
15
+ ## 0.15.6 / 2021-01-10
16
+
17
+ * Officially support Ruby 3.0
18
+ * Rely on `GObject.boxed_free` to free GValue objects
19
+ * Require 'set' in `callback_base.rb`, which needs it (thanks, Jordan Webb!)
20
+ * Make SizedArray handle `:filename` elements
21
+
22
+ ## 0.15.5 / 2020-11-13
23
+
24
+ * Make building and finding metaclasses via `Builder.build_class` work again
25
+
3
26
  ## 0.15.4 / 2020-11-01
4
27
 
5
28
  * Support disguised object class structs
data/README.md CHANGED
@@ -9,10 +9,9 @@ Ruby bindings for GNOME using the GObject Introspection Repository.
9
9
  ## Status
10
10
 
11
11
  [![Gem Version](https://badge.fury.io/rb/gir_ffi.svg)](http://badge.fury.io/rb/gir_ffi)
12
- [![Depfu](https://badges.depfu.com/badges/d5a8e9bffd2462a7ab4921d2f7e6fc48/overview.svg)](https://depfu.com/github/mvz/gir_ffi)
13
- [![Build Status](https://travis-ci.org/mvz/gir_ffi.svg?branch=master)](https://travis-ci.org/mvz/gir_ffi)
12
+ [![Build Status](https://github.com/mvz/gir_ffi/actions/workflows/ruby.yml/badge.svg)](https://github.com/mvz/gir_ffi/actions/workflows/ruby.yml)
14
13
  [![Code Climate](https://codeclimate.com/github/mvz/gir_ffi/badges/gpa.svg)](https://codeclimate.com/github/mvz/gir_ffi)
15
- [![Documentation Status](https://inch-ci.org/github/mvz/gir_ffi.svg?branch=master)](https://inch-ci.org/github/mvz/gir_ffi/branch/master)
14
+ [![Documentation Status](https://inch-ci.org/github/mvz/gir_ffi.svg?branch=master)](https://inch-ci.org/github/mvz/gir_ffi)
16
15
 
17
16
  ## Features
18
17
 
@@ -52,7 +51,7 @@ examples can be found in `gir_ffi-gtk` and `gir_ffi-gst`.
52
51
 
53
52
  ## Requirements
54
53
 
55
- GirFFI is supported on CRuby 2.5, 2.6 and 2.7, and JRuby 9.2.
54
+ GirFFI is supported on CRuby 2.6, 2.7 and 3.0, and JRuby 9.3.
56
55
 
57
56
  You will also need gobject-introspection installed with some
58
57
  introspection data.
@@ -62,7 +61,8 @@ available under the name ending in plain `.so`. If GirFFI complains that it
62
61
  cannot find the library, try installing development packages for those
63
62
  libraries.
64
63
 
65
- GirFFI should work with gobject-introspection 1.46.0 and up.
64
+ GirFFI should work with gobject-introspection 1.56.0 and up, and glib 2.56.0
65
+ and up.
66
66
 
67
67
  On Debian and Ubuntu, installing `libgirepository-1.0-1` and `gir1.2-glib-2.0`
68
68
  should be enough to use GirFFI in your application.
@@ -89,24 +89,9 @@ already exist:
89
89
  * `gir_ffi-tracker`: overrides for Tracker
90
90
  * `gir_ffi-gst`: overrides for GStreamer
91
91
 
92
- ## Hacking and contributing
92
+ ## Contributing
93
93
 
94
- Please feel free to file bugs or send pull requests!
95
-
96
- If you just want to help out but don't know where to start, have a look at
97
- TODO.md, and check the notes in the code (e.g., using `dnote`).
98
-
99
- If you want to send pull requests or patches, try to follow the instructions
100
- below. **If you get stuck, please make a pull request anyway and I'll try to
101
- help out.**
102
-
103
- * Make sure `rake test` runs without reporting any failures.
104
- * Add tests for your feature. Otherwise, I can't see if it works or if I
105
- break it later.
106
- * Make sure latest master merges cleanly with your branch. Things might
107
- have moved around since you forked.
108
- * Try not to include changes that are irrelevant to your feature in the
109
- same commit.
94
+ Please see [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines.
110
95
 
111
96
  ## Contributors
112
97
 
@@ -119,7 +104,7 @@ The following people have contributed to GirFFI over the years:
119
104
 
120
105
  ## License
121
106
 
122
- Copyright © 2009–2020 [Matijs van Zuijlen](http://www.matijs.net)
107
+ Copyright © 2009–2021 [Matijs van Zuijlen](http://www.matijs.net)
123
108
 
124
109
  GirFFI is free software, distributed under the terms of the GNU Lesser
125
110
  General Public License, version 2.1 or later. See the file COPYING.LIB for
@@ -11,9 +11,7 @@ module GLib
11
11
  nil
12
12
  when FFI::Pointer
13
13
  ptr
14
- when self
15
- ptr.to_ptr
16
- when GirFFI::BoxedBase
14
+ when self, GirFFI::BoxedBase
17
15
  ptr.to_ptr
18
16
  end
19
17
 
@@ -39,7 +39,7 @@ module GLib
39
39
  end
40
40
 
41
41
  def to_hash
42
- Hash[to_a]
42
+ to_a.to_h
43
43
  end
44
44
 
45
45
  # @override
@@ -7,60 +7,40 @@ GObject.load_class :Object
7
7
  module GObject
8
8
  # Overrides for GObject, GObject's generic base class.
9
9
  class Object
10
- if !GLib.check_version(2, 54, 0)
11
- GObject::Lib.attach_function(:g_object_new_with_properties,
12
- [:size_t, :uint32, :pointer, :pointer],
13
- :pointer)
14
-
15
- def self.new_with_properties(*args, &block)
16
- obj = allocate
17
- obj.__send__ :initialize_with_properties, *args, &block
18
- obj
19
- end
10
+ GObject::Lib.attach_function(:g_object_new_with_properties,
11
+ [:size_t, :uint32, :pointer, :pointer],
12
+ :pointer)
13
+
14
+ def self.new_with_properties(*args, &block)
15
+ obj = allocate
16
+ obj.__send__ :initialize_with_properties, *args, &block
17
+ obj
18
+ end
20
19
 
21
- # Starting with GLib 2.54.0, use g_object_new_with_properties, which
22
- # takes an array of names and an array of values.
23
- def initialize_with_properties(properties = {})
24
- names, gvalues = names_and_gvalues_for_properties(properties)
20
+ # Starting with GLib 2.54.0, use g_object_new_with_properties, which
21
+ # takes an array of names and an array of values.
22
+ def initialize_with_properties(properties = {})
23
+ names, gvalues = names_and_gvalues_for_properties(properties)
25
24
 
26
- n_properties = names.length
27
- names_arr = GirFFI::SizedArray.from(:utf8, -1, names)
28
- gvalues_arr = GirFFI::SizedArray.from(GObject::Value, -1, gvalues)
25
+ n_properties = names.length
26
+ names_arr = GirFFI::SizedArray.from(:utf8, -1, names)
27
+ gvalues_arr = GirFFI::SizedArray.from(GObject::Value, -1, gvalues)
29
28
 
30
- ptr = GObject::Lib.g_object_new_with_properties(self.class.gtype,
31
- n_properties,
32
- names_arr,
33
- gvalues_arr)
34
- store_pointer ptr
35
- end
29
+ ptr = GObject::Lib.g_object_new_with_properties(self.class.gtype,
30
+ n_properties,
31
+ names_arr,
32
+ gvalues_arr)
33
+ store_pointer ptr
34
+ end
36
35
 
37
- alias old_initialze initialize
38
- alias initialize initialize_with_properties
39
- remove_method :old_initialze
36
+ alias old_initialze initialize
37
+ alias initialize initialize_with_properties
38
+ remove_method :old_initialze
40
39
 
41
- def self.new(*args, &block)
42
- obj = allocate
43
- obj.__send__ :initialize, *args, &block
44
- obj
45
- end
46
- else
47
- setup_method! "new"
48
-
49
- # Before GLib 2.54.0, use g_object_newv, which takes an array of GParameter.
50
- def initialize_with_automatic_gtype(properties = {})
51
- gparameters = properties.map do |name, value|
52
- name = name.to_s
53
- property_param_spec(name)
54
- GObject::Parameter.new.tap do |gparam|
55
- gparam.name = name
56
- gparam.value = value
57
- end
58
- end
59
- initialize_without_automatic_gtype(self.class.gtype, gparameters)
60
- end
61
-
62
- alias initialize_without_automatic_gtype initialize
63
- alias initialize initialize_with_automatic_gtype
40
+ def self.new(*args, &block)
41
+ obj = allocate
42
+ obj.__send__ :initialize, *args, &block
43
+ obj
64
44
  end
65
45
 
66
46
  alias base_initialize initialize
@@ -75,7 +55,13 @@ module GObject
75
55
  end
76
56
 
77
57
  def self.make_finalizer(ptr)
78
- proc do
58
+ proc { finalize ptr }
59
+ end
60
+
61
+ class << self
62
+ protected
63
+
64
+ def finalize(ptr)
79
65
  rc = GObject::Object::Struct.new(ptr)[:ref_count]
80
66
  if rc == 0
81
67
  warn "not unreffing #{name}:#{ptr} (#{rc})"
@@ -18,7 +18,7 @@ module GObject
18
18
  end
19
19
 
20
20
  def initialize(&block)
21
- raise ArgumentError unless block_given?
21
+ block or raise ArgumentError, "Block needed"
22
22
 
23
23
  initialize_simple(self.class::Struct.size, nil)
24
24
  self.block = block
@@ -7,16 +7,6 @@ module GObject
7
7
  class Value
8
8
  setup_instance_method! :init
9
9
 
10
- def self.make_finalizer(struct)
11
- proc do
12
- if struct.owned?
13
- ptr = struct.to_ptr
14
- Lib.g_value_unset ptr unless struct[:g_type] == TYPE_INVALID
15
- GObject.boxed_free gtype, ptr
16
- end
17
- end
18
- end
19
-
20
10
  METHOD_MAP = {
21
11
  TYPE_INVALID => [:get_none, :set_none],
22
12
  # TYPE_NONE is skipped
data/lib/ffi-gobject.rb CHANGED
@@ -63,13 +63,13 @@ module GObject
63
63
  end
64
64
 
65
65
  def self.signal_connect(object, detailed_signal, data = nil, after = false, &block)
66
- raise ArgumentError, "Block needed" unless block_given?
66
+ block or raise ArgumentError, "Block needed"
67
67
 
68
68
  signal_name, = detailed_signal.split("::")
69
69
  sig_info = object.class.find_signal signal_name
70
70
 
71
71
  closure = sig_info.wrap_in_closure do |*args|
72
- block.call(*args << data)
72
+ yield(*args << data)
73
73
  end
74
74
 
75
75
  signal_connect_closure object, detailed_signal, closure, after
@@ -86,7 +86,7 @@ module GObject
86
86
  load_class :ParamFlags
87
87
 
88
88
  # NOTE: This Lib module is set up in `gir_ffi-base/gobject/lib.rb`.
89
- module Lib
89
+ Lib.class_eval do
90
90
  attach_function :g_object_ref_sink, [:pointer], :pointer
91
91
  attach_function :g_object_ref, [:pointer], :pointer
92
92
  attach_function :g_object_unref, [:pointer], :pointer
@@ -4,19 +4,26 @@ module GObjectIntrospection
4
4
  # Wraps GIBaseInfo struct, the base \type for all info types.
5
5
  # Decendant types will be implemented as needed.
6
6
  class IBaseInfo
7
- def initialize(ptr, lib = Lib)
7
+ def initialize(ptr)
8
8
  raise ArgumentError, "ptr must not be null" if ptr.null?
9
9
 
10
- ObjectSpace.define_finalizer self, self.class.make_finalizer(lib, ptr)
10
+ ObjectSpace.define_finalizer self, self.class.make_finalizer(ptr)
11
11
 
12
12
  @pointer = ptr
13
- @lib = lib
14
13
  end
15
14
 
16
15
  attr_reader :pointer
17
16
 
18
- def self.make_finalizer(lib, ptr)
19
- proc { lib.g_base_info_unref ptr }
17
+ def self.make_finalizer(ptr)
18
+ proc { finalize ptr }
19
+ end
20
+
21
+ class << self
22
+ protected
23
+
24
+ def finalize(ptr)
25
+ Lib.g_base_info_unref ptr
26
+ end
20
27
  end
21
28
 
22
29
  def to_ptr
@@ -42,7 +49,7 @@ module GObjectIntrospection
42
49
  method = method.to_s
43
50
  cache_ivar = "@#{method}_cache"
44
51
  single ||= method[0..-2]
45
- count = method.sub(/^(get_)?/, '\\1n_')
52
+ count = method.sub(/^(get_)?/, "\\1n_")
46
53
  class_eval <<-CODE, __FILE__, __LINE__ + 1
47
54
  def #{method} # def fields
48
55
  #{cache_ivar} ||= # @fields_cache ||=
@@ -110,10 +117,10 @@ module GObjectIntrospection
110
117
  def container
111
118
  @container ||= begin
112
119
  ptr = Lib.g_base_info_get_container self
113
- return if ptr.null?
114
-
115
- Lib.g_base_info_ref ptr
116
- IRepository.wrap_ibaseinfo_pointer ptr
120
+ unless ptr.null?
121
+ Lib.g_base_info_ref ptr
122
+ IRepository.wrap_ibaseinfo_pointer ptr
123
+ end
117
124
  end
118
125
  end
119
126
 
@@ -14,11 +14,11 @@ module GirFFI
14
14
  def to_ruby_value
15
15
  bare_value = to_value
16
16
  case value_type
17
- when :utf8
17
+ when :utf8, :filename
18
18
  bare_value.to_utf8
19
19
  when Array
20
20
  value_type[1].wrap bare_value
21
- when Class
21
+ when Module
22
22
  value_type.wrap bare_value
23
23
  else
24
24
  bare_value
@@ -6,12 +6,7 @@ module GirFFI
6
6
  # Base class for generated classes representing boxed types.
7
7
  class BoxedBase < StructLikeBase
8
8
  def self.make_finalizer(struct)
9
- proc do
10
- if struct.owned?
11
- struct.owned = nil
12
- GObject.boxed_free gtype, struct.to_ptr
13
- end
14
- end
9
+ proc { finalize(struct) }
15
10
  end
16
11
 
17
12
  def self.copy(val)
@@ -19,6 +14,17 @@ module GirFFI
19
14
  wrap(ptr)
20
15
  end
21
16
 
17
+ class << self
18
+ protected
19
+
20
+ def finalize(struct)
21
+ struct.owned? or return
22
+
23
+ struct.owned = nil
24
+ GObject.boxed_free gtype, struct.to_ptr
25
+ end
26
+ end
27
+
22
28
  private
23
29
 
24
30
  def store_pointer(*)
@@ -23,9 +23,8 @@ module GirFFI
23
23
  fund = GObject.type_fundamental gtype
24
24
  if fund == GObject::TYPE_BOXED
25
25
  UnintrospectableBoxedInfo.new gtype
26
- elsif fund == GObject::TYPE_OBJECT
27
- UnintrospectableTypeInfo.new gtype
28
- elsif fund >= GObject::TYPE_RESERVED_USER_FIRST
26
+ elsif fund == GObject::TYPE_OBJECT ||
27
+ fund >= GObject::TYPE_RESERVED_USER_FIRST
29
28
  UnintrospectableTypeInfo.new gtype
30
29
  else
31
30
  raise "Unable to handle type #{GObject.type_name gtype}"
@@ -75,7 +75,11 @@ module GirFFI
75
75
  def set_up_user_data_relations
76
76
  @base_argument_builders.each do |bldr|
77
77
  if (idx = bldr.closure_idx) >= 0
78
- @base_argument_builders[idx].mark_as_user_data bldr
78
+ target_bldr = @base_argument_builders[idx]
79
+ unless target_bldr.specialized_type_tag == :void
80
+ target_bldr, bldr = bldr, target_bldr
81
+ end
82
+ target_bldr.mark_as_user_data bldr
79
83
  end
80
84
  end
81
85
  end
@@ -39,7 +39,7 @@ module GirFFI
39
39
  def receiver_call_argument
40
40
  container_type_info = ReceiverTypeInfo.new(container_info)
41
41
  if @info.instance_ownership_transfer == :everything &&
42
- container_type_info.flattened_tag == :object
42
+ container_type_info.flattened_tag == :object
43
43
  "self.ref"
44
44
  else
45
45
  "self"
@@ -9,8 +9,8 @@ module GirFFI
9
9
  class InterfaceBuilder < RegisteredTypeBuilder
10
10
  def interface_struct
11
11
  @interface_struct ||=
12
- ClassStructBuilder.new(iface_struct_info,
13
- GObject::TypeInterface).build_class
12
+ StructBuilder.new(iface_struct_info,
13
+ superclass: GObject::TypeInterface).build_class
14
14
  end
15
15
 
16
16
  private
@@ -43,7 +43,7 @@ module GirFFI
43
43
  def find_namespaced_class_info(classname)
44
44
  name = classname.to_s
45
45
  info = gir.find_by_name(@namespace, name) ||
46
- gir.find_by_name(@namespace, name.sub(/^./, &:downcase))
46
+ gir.find_by_name(@namespace, name.sub(/^./, &:downcase))
47
47
  unless info
48
48
  raise NameError,
49
49
  "Class #{classname} not found in namespace #{@namespace}"
@@ -89,7 +89,7 @@ module GirFFI
89
89
  lib.extend FFI::BitMasks
90
90
  lib.ffi_lib_flags :global, :lazy
91
91
  if shared_library_specification
92
- lib.ffi_lib(*shared_library_specification.split(/,/))
92
+ lib.ffi_lib(*shared_library_specification.split(","))
93
93
  end
94
94
  end
95
95
 
@@ -3,7 +3,6 @@
3
3
  require "gir_ffi/builders/registered_type_builder"
4
4
  require "gir_ffi/builders/with_layout"
5
5
  require "gir_ffi/builders/property_builder"
6
- require "gir_ffi/builders/class_struct_builder"
7
6
  require "gir_ffi/object_base"
8
7
  require "gir_ffi/struct"
9
8
 
@@ -38,11 +37,14 @@ module GirFFI
38
37
 
39
38
  def object_class_struct
40
39
  @object_class_struct ||=
41
- if object_class_struct_info
42
- ClassStructBuilder.new(object_class_struct_info,
43
- parent_builder.object_class_struct).build_class
44
- else
45
- parent_builder.object_class_struct
40
+ begin
41
+ parent_struct = parent_builder.object_class_struct
42
+ if object_class_struct_info
43
+ StructBuilder.new(object_class_struct_info,
44
+ superclass: parent_struct).build_class
45
+ else
46
+ parent_struct
47
+ end
46
48
  end
47
49
  end
48
50
 
@@ -10,23 +10,48 @@ module GirFFI
10
10
  class StructBuilder < RegisteredTypeBuilder
11
11
  include StructLike
12
12
 
13
- def layout_superclass
14
- GirFFI::Struct
13
+ def initialize(info, superclass: nil)
14
+ @superclass = superclass
15
+ super info
15
16
  end
16
17
 
17
18
  def superclass
18
- raise "Use ClassStructBuilder to build #{info.full_type_name}" if info.gtype_struct?
19
- return BoxedBase if GObject.type_fundamental(info.gtype) == GObject::TYPE_BOXED
19
+ @superclass ||= if info.gtype_struct?
20
+ gtype_struct_parent
21
+ elsif GObject.type_fundamental(info.gtype) == GObject::TYPE_BOXED
22
+ BoxedBase
23
+ else
24
+ StructBase
25
+ end
26
+ end
20
27
 
21
- StructBase
28
+ private
29
+
30
+ def layout_superclass
31
+ GirFFI::Struct
22
32
  end
23
33
 
24
34
  def klass
25
35
  @klass ||= get_or_define_class(namespace_module, @classname) { superclass }
26
36
  end
27
37
 
38
+ def parent_info
39
+ @parent_info ||= parent_field_type&.interface
40
+ end
41
+
28
42
  def parent_field_type
29
- fields.first.field_type
43
+ fields.first&.field_type
44
+ end
45
+
46
+ def gtype_struct_parent
47
+ full_name = info.full_type_name
48
+ if full_name == "GObject::InitiallyUnownedClass"
49
+ GObject::ObjectClass
50
+ else
51
+ raise "Unable to calculate parent class for #{full_name}" unless parent_info
52
+
53
+ Builder.build_class parent_info
54
+ end
30
55
  end
31
56
  end
32
57
  end
@@ -105,7 +105,7 @@ module GirFFI
105
105
  end
106
106
 
107
107
  def class_size
108
- parent_gtype.class_size + interface_gtypes.map(&:class_size).sum
108
+ parent_gtype.class_size + interface_gtypes.sum(&:class_size)
109
109
  end
110
110
 
111
111
  def setup_properties(object_class_ptr)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "gir_ffi/type_base"
4
+ require "set"
4
5
 
5
6
  module GirFFI
6
7
  # Base module for callbacks and vfuncs.
data/lib/gir_ffi/core.rb CHANGED
@@ -42,7 +42,7 @@ module GirFFI
42
42
 
43
43
  if block_given?
44
44
  warn "Using define_type with a block is deprecated." \
45
- " Call the relevant functions inside the class definition instead."
45
+ " Call the relevant functions inside the class definition instead."
46
46
  yield info
47
47
  end
48
48
  Builders::UserDefinedBuilder.new(info).build_class
@@ -77,9 +77,10 @@ module GirFFI
77
77
  def from_module_type_array(type, ary)
78
78
  if type == GObject::Value
79
79
  from_gvalue_array type, ary
80
- elsif type < GirFFI::ClassBase
80
+ elsif type < GirFFI::ClassBase ||
81
+ type.singleton_class < GirFFI::InterfaceBase
81
82
  from_struct_array type, ary
82
- elsif type.singleton_class.include? GirFFI::EnumBase
83
+ elsif type.singleton_class < GirFFI::EnumBase
83
84
  from_enum_array type, ary
84
85
  else
85
86
  raise NotImplementedError, type
@@ -166,7 +166,8 @@ module GirFFI
166
166
  end
167
167
 
168
168
  def needs_c_to_ruby_conversion_for_closures?
169
- [:array, :c, :error, :ghash, :glist, :struct, :strv].include?(flattened_tag)
169
+ [:array, :c, :error, :ghash, :glist, :ptr_array, :struct, :strv]
170
+ .include?(flattened_tag)
170
171
  end
171
172
 
172
173
  def needs_ruby_to_c_conversion_for_closures?
@@ -18,6 +18,11 @@ module GirFFI
18
18
  send method_name, *arguments, &block
19
19
  end
20
20
 
21
+ # TODO: Unify with implementation in ObjectBase
22
+ def copy_value_to_pointer(value, pointer, offset = 0)
23
+ pointer.put_pointer offset, value.to_ptr
24
+ end
25
+
21
26
  def wrap(ptr)
22
27
  ptr.to_object
23
28
  end
@@ -22,6 +22,7 @@ module GirFFI
22
22
  array: :pointer,
23
23
  c: GirFFI::SizedArray,
24
24
  utf8: :pointer,
25
+ filename: :pointer,
25
26
  GType: gsize_type,
26
27
  gboolean: GirFFI::Boolean,
27
28
  gunichar: :uint32,
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Current GirFFI version
4
4
  module GirFFI
5
- VERSION = "0.15.4"
5
+ VERSION = "0.15.8"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gir_ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.4
4
+ version: 0.15.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-01 00:00:00.000000000 Z
11
+ date: 2021-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.0
47
+ version: 2.0.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.0
54
+ version: 2.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '5.12'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest-focus
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.3.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.3.1
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rake
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +100,14 @@ dependencies:
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: 0.1.0
103
+ version: 0.2.0
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: 0.1.0
110
+ version: 0.2.0
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rexml
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -128,28 +142,28 @@ dependencies:
128
142
  requirements:
129
143
  - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: 1.1.0
145
+ version: 1.23.0
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: 1.1.0
152
+ version: 1.23.0
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: rubocop-minitest
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
157
  - - "~>"
144
158
  - !ruby/object:Gem::Version
145
- version: 0.10.1
159
+ version: 0.16.0
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
164
  - - "~>"
151
165
  - !ruby/object:Gem::Version
152
- version: 0.10.1
166
+ version: 0.16.0
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: rubocop-packaging
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -170,28 +184,28 @@ dependencies:
170
184
  requirements:
171
185
  - - "~>"
172
186
  - !ruby/object:Gem::Version
173
- version: 1.8.0
187
+ version: 1.12.0
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
192
  - - "~>"
179
193
  - !ruby/object:Gem::Version
180
- version: 1.8.0
194
+ version: 1.12.0
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: simplecov
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
199
  - - "~>"
186
200
  - !ruby/object:Gem::Version
187
- version: 0.19.0
201
+ version: 0.21.0
188
202
  type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
206
  - - "~>"
193
207
  - !ruby/object:Gem::Version
194
- version: 0.19.0
208
+ version: 0.21.0
195
209
  description: |
196
210
  GirFFI creates bindings for GObject-based libraries at runtime based on introspection
197
211
  data provided by the GObject Introspection Repository (GIR) system. Bindings are created
@@ -286,7 +300,6 @@ files:
286
300
  - lib/gir_ffi/builders/callback_argument_builder.rb
287
301
  - lib/gir_ffi/builders/callback_builder.rb
288
302
  - lib/gir_ffi/builders/callback_return_value_builder.rb
289
- - lib/gir_ffi/builders/class_struct_builder.rb
290
303
  - lib/gir_ffi/builders/closure_argument_builder.rb
291
304
  - lib/gir_ffi/builders/closure_convertor.rb
292
305
  - lib/gir_ffi/builders/closure_return_value_builder.rb
@@ -397,7 +410,8 @@ metadata:
397
410
  homepage_uri: http://www.github.com/mvz/ruby-gir-ffi
398
411
  source_code_uri: https://github.com/mvz/gir_ffi
399
412
  changelog_uri: https://github.com/mvz/gir_ffi/blob/master/Changelog.md
400
- post_install_message:
413
+ rubygems_mfa_required: 'true'
414
+ post_install_message:
401
415
  rdoc_options:
402
416
  - "--main"
403
417
  - README.md
@@ -407,15 +421,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
407
421
  requirements:
408
422
  - - ">="
409
423
  - !ruby/object:Gem::Version
410
- version: 2.5.0
424
+ version: 2.6.0
411
425
  required_rubygems_version: !ruby/object:Gem::Requirement
412
426
  requirements:
413
427
  - - ">="
414
428
  - !ruby/object:Gem::Version
415
429
  version: '0'
416
430
  requirements: []
417
- rubygems_version: 3.1.2
418
- signing_key:
431
+ rubygems_version: 3.2.22
432
+ signing_key:
419
433
  specification_version: 4
420
434
  summary: FFI-based GObject binding using the GObject Introspection Repository
421
435
  test_files: []
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "gir_ffi/builders/struct_builder"
4
-
5
- module GirFFI
6
- module Builders
7
- # Implements the creation of a class representing a Struct.
8
- class ClassStructBuilder < RegisteredTypeBuilder
9
- include StructLike
10
-
11
- attr_reader :superclass
12
-
13
- def initialize(info, super_class_struct)
14
- @superclass = super_class_struct
15
- super info
16
- raise "Info does not represent gtype_struct" unless info.gtype_struct?
17
- end
18
-
19
- def layout_superclass
20
- GirFFI::Struct
21
- end
22
- end
23
- end
24
- end