gir_ffi 0.15.5 → 0.15.6

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: d1bab3fa290a2ef0cb49ee4bb2b24f29f6ef5ae0bf4bbdd83ed92bc28b9aa8e0
4
- data.tar.gz: c87ddb7f7f41a033319dafd849db129a72afb2cd6fba5e2ffc64715e1cc1e446
3
+ metadata.gz: 666da2b23f02fadc3172e473ea267f3d81280e6377943426c8f89e7258391ed4
4
+ data.tar.gz: f19dd857e24269b43109ea8ffa407de64d47531acf00f1104971db171c64bcf6
5
5
  SHA512:
6
- metadata.gz: 7ff032878aa00fea1c6096f8b09509e6cbee0c492f864c1c258e4c1b1932f0052e2efda13517e2e381f367f91713ed0e56f42bcc302abe2de04103607beac8dd
7
- data.tar.gz: 4f90c766aee3e8953a8f017e94284db5be4cc0cf93991795ee2e77aa66c700995ec9f3feeb336169f02b618468675a2744f5159a790819c5248422a85baa789f
6
+ metadata.gz: 4f711ebd41bfedb31e496268b125bf3079f373582b5ac0acbe25938701ceeb42ec98cdbe118a735119f6fafc43357b5d0ba2e52ed8e957e65090669d18d2f692
7
+ data.tar.gz: e415f33719d96705bfba9e6181123facec99131685613ee8cb753178c9ce3af655e6978e55e55b3435e71c12c744a94200468df9b606bb27f1feac67990cf3a0
@@ -1,8 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.15.6 / 2021-01-10
4
+
5
+ * Officially support Ruby 3.0
6
+ * Rely on `GObject.boxed_free` to free GValue objects
7
+ * Require 'set' in `callback_base.rb`, which needs it (thanks, Jordan Webb!)
8
+ * Make SizedArray handle `:filename` elements
9
+
3
10
  ## 0.15.5 / 2020-11-13
4
11
 
5
- * Make building and finding metaclasses via Builder.build_class work again
12
+ * Make building and finding metaclasses via `Builder.build_class` work again
6
13
 
7
14
  ## 0.15.4 / 2020-11-01
8
15
 
data/README.md CHANGED
@@ -52,7 +52,7 @@ examples can be found in `gir_ffi-gtk` and `gir_ffi-gst`.
52
52
 
53
53
  ## Requirements
54
54
 
55
- GirFFI is supported on CRuby 2.5, 2.6 and 2.7, and JRuby 9.2.
55
+ GirFFI is supported on CRuby 2.5, 2.6, 2.7 and 3.0, and JRuby 9.2.
56
56
 
57
57
  You will also need gobject-introspection installed with some
58
58
  introspection data.
@@ -63,7 +63,7 @@ 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
@@ -75,7 +75,13 @@ module GObject
75
75
  end
76
76
 
77
77
  def self.make_finalizer(ptr)
78
- proc do
78
+ proc { finalize ptr }
79
+ end
80
+
81
+ class << self
82
+ protected
83
+
84
+ def finalize(ptr)
79
85
  rc = GObject::Object::Struct.new(ptr)[:ref_count]
80
86
  if rc == 0
81
87
  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
@@ -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
@@ -14,7 +14,7 @@ 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
@@ -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(*)
@@ -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.
@@ -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.5"
5
+ VERSION = "0.15.6"
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.5
4
+ version: 0.15.6
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-13 00:00:00.000000000 Z
11
+ date: 2021-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.1.0
89
+ version: 0.2.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.1.0
96
+ version: 0.2.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rexml
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.3.0
131
+ version: 1.8.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 1.3.0
138
+ version: 1.8.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rubocop-minitest
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -170,28 +170,28 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 1.8.0
173
+ version: 1.9.0
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 1.8.0
180
+ version: 1.9.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: simplecov
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 0.19.0
187
+ version: 0.21.0
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: 0.19.0
194
+ version: 0.21.0
195
195
  description: |
196
196
  GirFFI creates bindings for GObject-based libraries at runtime based on introspection
197
197
  data provided by the GObject Introspection Repository (GIR) system. Bindings are created
@@ -396,7 +396,7 @@ metadata:
396
396
  homepage_uri: http://www.github.com/mvz/ruby-gir-ffi
397
397
  source_code_uri: https://github.com/mvz/gir_ffi
398
398
  changelog_uri: https://github.com/mvz/gir_ffi/blob/master/Changelog.md
399
- post_install_message:
399
+ post_install_message:
400
400
  rdoc_options:
401
401
  - "--main"
402
402
  - README.md
@@ -413,8 +413,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
413
413
  - !ruby/object:Gem::Version
414
414
  version: '0'
415
415
  requirements: []
416
- rubygems_version: 3.1.2
417
- signing_key:
416
+ rubygems_version: 3.2.3
417
+ signing_key:
418
418
  specification_version: 4
419
419
  summary: FFI-based GObject binding using the GObject Introspection Repository
420
420
  test_files: []