gir_ffi 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +7 -0
- data/lib/ffi-gobject/object.rb +3 -0
- data/lib/gir_ffi/builders/constructor_builder.rb +8 -1
- data/lib/gir_ffi/builders/object_builder.rb +11 -0
- data/lib/gir_ffi/builders/unintrospectable_builder.rb +0 -6
- data/lib/gir_ffi/unintrospectable_type_info.rb +4 -0
- data/lib/gir_ffi/version.rb +1 -1
- data/test/gir_ffi/builders/constructor_builder_test.rb +1 -0
- data/test/gir_ffi/builders/unintrospectable_builder_test.rb +5 -0
- data/test/gir_ffi/builders/user_defined_builder_test.rb +9 -0
- data/test/gir_ffi/unintrospectable_type_info_test.rb +8 -0
- data/test/integration/generated_gimarshallingtests_test.rb +9 -5
- data/test/integration/generated_regress_test.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fffb54bf2eca76e21e43bb5838e0f307063c2b6d
|
4
|
+
data.tar.gz: 4ab64e4d22d1deba88e930a3a7b046a19558b6aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 482f25f7934b20c3cb1768225f630081198b321e081c3ae74d70d6c7bd9f8ed45f10dc6c40bbca2d247d9637909e134e988b59811354f6f77f71cb392c45c60c
|
7
|
+
data.tar.gz: 8b0ed87c864d9af6f5b8c80f02bc457f0a0858a3c00f53d48b8b22e0cfe5fae768ae730b7b00c939efad503581cf126fd5c4e75f51a18d5957846e3c8c9795d0
|
data/Changelog.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.8.6 / 2015-12-09
|
4
|
+
|
5
|
+
* Change handling of initializers in subclasses
|
6
|
+
* Subclasses with their own GType revert to the default GObject constructor
|
7
|
+
* Subclasses cannot use their parent classes' non-default contructors
|
8
|
+
* Find signals in ancestor classes of unintrospectable types
|
9
|
+
|
3
10
|
## 0.8.5 / 2015-12-04
|
4
11
|
|
5
12
|
* Improve GObject::Value
|
data/lib/ffi-gobject/object.rb
CHANGED
@@ -11,6 +11,9 @@ module GObject
|
|
11
11
|
|
12
12
|
alias_method :initialize_without_automatic_gtype, :initialize
|
13
13
|
alias_method :initialize, :initialize_with_automatic_gtype
|
14
|
+
alias_method :base_initialize, :initialize
|
15
|
+
|
16
|
+
private :base_initialize
|
14
17
|
|
15
18
|
def store_pointer(ptr)
|
16
19
|
super
|
@@ -31,7 +31,14 @@ module GirFFI
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def preparation
|
34
|
-
|
34
|
+
if @info.safe_name == 'new'
|
35
|
+
['obj = allocate']
|
36
|
+
else
|
37
|
+
[
|
38
|
+
"raise NoMethodError unless self == #{@info.container.full_type_name}",
|
39
|
+
'obj = allocate'
|
40
|
+
]
|
41
|
+
end
|
35
42
|
end
|
36
43
|
|
37
44
|
def invocation
|
@@ -51,6 +51,7 @@ module GirFFI
|
|
51
51
|
end
|
52
52
|
setup_vfunc_invokers
|
53
53
|
setup_interfaces
|
54
|
+
provide_initializer
|
54
55
|
end
|
55
56
|
|
56
57
|
# FIXME: Private method only used in subclass
|
@@ -108,6 +109,16 @@ module GirFFI
|
|
108
109
|
"
|
109
110
|
end
|
110
111
|
|
112
|
+
def provide_initializer
|
113
|
+
return if info.find_method 'new'
|
114
|
+
|
115
|
+
klass.class_eval "
|
116
|
+
def initialize(properties = {})
|
117
|
+
base_initialize(properties)
|
118
|
+
end
|
119
|
+
"
|
120
|
+
end
|
121
|
+
|
111
122
|
def setup_interfaces
|
112
123
|
interfaces.each do |iface|
|
113
124
|
klass.send :include, iface
|
data/lib/gir_ffi/version.rb
CHANGED
@@ -23,6 +23,7 @@ describe GirFFI::Builders::ConstructorBuilder do
|
|
23
23
|
it 'builds a custom constructor' do
|
24
24
|
code.must_equal <<-CODE.reset_indentation
|
25
25
|
def self.new_from_file(*args)
|
26
|
+
raise NoMethodError unless self == Regress::TestObj
|
26
27
|
obj = allocate
|
27
28
|
obj.__send__ :initialize_from_file, *args
|
28
29
|
obj
|
@@ -111,5 +111,14 @@ describe GirFFI::Builders::UserDefinedBuilder do
|
|
111
111
|
other_klass = other_builder.build_class
|
112
112
|
other_klass.gtype.must_equal gtype
|
113
113
|
end
|
114
|
+
|
115
|
+
it 'creates a class with a new GType' do
|
116
|
+
klass.gtype.wont_equal GIMarshallingTests::Object.gtype
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'makes the registered class return objects with the correct GType' do
|
120
|
+
obj = klass.new
|
121
|
+
GObject.type_from_instance(obj).must_equal klass.gtype
|
122
|
+
end
|
114
123
|
end
|
115
124
|
end
|
@@ -108,4 +108,12 @@ describe GirFFI::UnintrospectableTypeInfo do
|
|
108
108
|
info.safe_name.must_equal 'GSomeType'
|
109
109
|
end
|
110
110
|
end
|
111
|
+
|
112
|
+
describe '#find_signal' do
|
113
|
+
it 'indicates that no signals can be found' do
|
114
|
+
info = GirFFI::UnintrospectableTypeInfo.new(:some_type)
|
115
|
+
result = info.find_signal 'any'
|
116
|
+
result.must_be_nil
|
117
|
+
end
|
118
|
+
end
|
111
119
|
end
|
@@ -1206,11 +1206,13 @@ describe GIMarshallingTests do
|
|
1206
1206
|
|
1207
1207
|
describe 'GIMarshallingTests::SubObject' do
|
1208
1208
|
it 'creates an instance using #new' do
|
1209
|
-
so = GIMarshallingTests::SubObject.new
|
1210
|
-
|
1209
|
+
so = GIMarshallingTests::SubObject.new
|
1210
|
+
so.must_be_instance_of GIMarshallingTests::SubObject
|
1211
|
+
GObject.type_name(GObject.type_from_instance so).
|
1212
|
+
must_equal 'GIMarshallingTestsSubObject'
|
1211
1213
|
end
|
1212
1214
|
|
1213
|
-
let(:instance) { GIMarshallingTests::SubObject.new
|
1215
|
+
let(:instance) { GIMarshallingTests::SubObject.new }
|
1214
1216
|
|
1215
1217
|
it 'has a working method #overwritten_method' do
|
1216
1218
|
instance.overwritten_method
|
@@ -1230,11 +1232,13 @@ describe GIMarshallingTests do
|
|
1230
1232
|
|
1231
1233
|
describe 'GIMarshallingTests::SubSubObject' do
|
1232
1234
|
it 'creates an instance using #new' do
|
1233
|
-
so = GIMarshallingTests::SubSubObject.new
|
1235
|
+
so = GIMarshallingTests::SubSubObject.new
|
1234
1236
|
assert_instance_of GIMarshallingTests::SubSubObject, so
|
1237
|
+
GObject.type_name(GObject.type_from_instance so).
|
1238
|
+
must_equal 'GIMarshallingTestsSubSubObject'
|
1235
1239
|
end
|
1236
1240
|
|
1237
|
-
let(:instance) { GIMarshallingTests::SubSubObject.new
|
1241
|
+
let(:instance) { GIMarshallingTests::SubSubObject.new }
|
1238
1242
|
|
1239
1243
|
it 'does not have field accessors' do
|
1240
1244
|
assert_raises(NoMethodError) { instance.parent_instance }
|
@@ -2230,6 +2230,10 @@ describe Regress do
|
|
2230
2230
|
assert_instance_of Regress::TestSubObj, tso
|
2231
2231
|
end
|
2232
2232
|
|
2233
|
+
it "does not create an instance using its parent object's custom constructors" do
|
2234
|
+
proc { Regress::TestSubObj.constructor }.must_raise NoMethodError
|
2235
|
+
end
|
2236
|
+
|
2233
2237
|
let(:instance) { Regress::TestSubObj.new }
|
2234
2238
|
|
2235
2239
|
it 'has a working method #instance_method' do
|
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.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matijs van Zuijlen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -387,7 +387,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
387
387
|
version: '0'
|
388
388
|
requirements: []
|
389
389
|
rubyforge_project:
|
390
|
-
rubygems_version: 2.
|
390
|
+
rubygems_version: 2.5.0
|
391
391
|
signing_key:
|
392
392
|
specification_version: 4
|
393
393
|
summary: FFI-based GObject binding using the GObject Introspection Repository
|