gobject-introspection 3.4.4 → 3.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgiversion.h -
5
+
6
+ This file was generated by mkmf-gnome2.rb.
7
+
8
+ ************************************************/
9
+
10
+ #ifndef __RBGI_VERSION_H__
11
+ #define __RBGI_VERSION_H__
12
+
13
+ #define GI_MAJOR_VERSION (1)
14
+ #define GI_MINOR_VERSION (46)
15
+ #define GI_MICRO_VERSION (0)
16
+
17
+ #define GI_CHECK_VERSION(major,minor,micro) \
18
+ (GI_MAJOR_VERSION > (major) || \
19
+ (GI_MAJOR_VERSION == (major) && GI_MINOR_VERSION > (minor)) || \
20
+ (GI_MAJOR_VERSION == (major) && GI_MINOR_VERSION == (minor) && \
21
+ GI_MICRO_VERSION >= (micro)))
22
+
23
+
24
+ #endif /* __RBGI_VERSION_H__ */
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2019 Ruby-GNOME 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
@@ -216,6 +216,7 @@ module GObjectIntrospection
216
216
  klass = self.class.define_class(info.gtype,
217
217
  rubyish_class_name(info),
218
218
  @base_module)
219
+ load_virtual_functions(info, klass)
219
220
  load_fields(info, klass)
220
221
  load_methods(info, klass)
221
222
  end
@@ -338,6 +339,20 @@ module GObjectIntrospection
338
339
  end
339
340
  end
340
341
 
342
+ def load_virtual_functions(info, klass)
343
+ klass.extend(VirtualFunctionImplementable)
344
+ gtype_prefix = rubyish_gtype_name(klass.gtype.name)
345
+ implementor = VirtualFunctionImplementor.new(self.class,
346
+ gtype_prefix,
347
+ info.vfuncs)
348
+ klass.__send__(:initialize_virtual_function_implementable,
349
+ implementor)
350
+ end
351
+
352
+ def rubyish_gtype_name(name)
353
+ name.scan(/[A-Z]+[a-z\d]+/).collect(&:downcase).join("_")
354
+ end
355
+
341
356
  def initialize_post(object)
342
357
  end
343
358
 
@@ -546,6 +561,7 @@ module GObjectIntrospection
546
561
  self.class.define_interface(info.gtype,
547
562
  rubyish_class_name(info),
548
563
  @base_module)
564
+ load_virtual_functions(info, interface_module)
549
565
  load_methods(info, interface_module)
550
566
  end
551
567
 
@@ -708,5 +724,53 @@ module GObjectIntrospection
708
724
  "#{@full_method_name}: wrong number of arguments (#{detail})"
709
725
  end
710
726
  end
727
+
728
+ class VirtualFunctionImplementor
729
+ def initialize(loader_class, gtype_prefix, infos)
730
+ @loader_class = loader_class
731
+ @gtype_prefix = gtype_prefix
732
+ @infos = {}
733
+ prefix = GLib::VIRTUAL_FUNCTION_IMPLEMENTATION_PREFIX
734
+ infos.each do |info|
735
+ name = info.name
736
+ @infos[:"#{prefix}#{name}"] = info
737
+ @infos[:"#{prefix}#{gtype_prefix}_#{name}"] = info
738
+ end
739
+ end
740
+
741
+ def implement(implementor_gtype, name)
742
+ info = @infos[name]
743
+ return false if info.nil?
744
+ container = info.container
745
+ vtable_gtype = container.gtype
746
+ if container.respond_to?(:class_struct)
747
+ struct = container.class_struct
748
+ else
749
+ return false unless implementor_gtype.type_is_a?(vtable_gtype)
750
+ struct = container.iface_struct
751
+ end
752
+ field = struct.find_field(info.name)
753
+ @loader_class.implement_virtual_function(field,
754
+ implementor_gtype,
755
+ vtable_gtype,
756
+ name.to_s)
757
+ true
758
+ end
759
+ end
760
+
761
+ module VirtualFunctionImplementable
762
+ def initialize_virtual_function_implementable(implementor)
763
+ @virtual_function_implementor = implementor
764
+ end
765
+
766
+ def implement_virtual_function(implementor_class, name)
767
+ unless instance_variable_defined?(:@virtual_function_implementor)
768
+ return false
769
+ end
770
+ @virtual_function_implementor.implement(implementor_class.gtype,
771
+ name)
772
+ true
773
+ end
774
+ end
711
775
  end
712
776
  end
data/test/run-test.rb CHANGED
@@ -32,4 +32,8 @@ run_test(__dir__,
32
32
  puts("Omit because typelib file doesn't exist: #{$!.message}")
33
33
  exit(true)
34
34
  end
35
+
36
+ module Gio
37
+ GObjectIntrospection::Loader.load("Gio", self)
38
+ end
35
39
  end
@@ -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
@@ -28,4 +28,8 @@ class TestBaseInfo < Test::Unit::TestCase
28
28
  def test_namespace
29
29
  assert_equal("GObject", @info.namespace)
30
30
  end
31
+
32
+ def test_container
33
+ assert_equal("Object", @info.vfuncs.first.container.name)
34
+ end
31
35
  end
@@ -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
@@ -21,6 +21,12 @@ class TestCallableInfo < Test::Unit::TestCase
21
21
  @info = @repository.find("GObject", "signal_name")
22
22
  end
23
23
 
24
+ def test_can_throw_gerror
25
+ assert do
26
+ not @info.can_throw_gerror?
27
+ end
28
+ end
29
+
24
30
  def test_return_type
25
31
  assert_kind_of(GObjectIntrospection::TypeInfo,
26
32
  @info.return_type)
data/test/test-loader.rb CHANGED
@@ -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
@@ -17,14 +17,60 @@
17
17
  class TestLoaderInfo < Test::Unit::TestCase
18
18
  def setup
19
19
  @repository = GObjectIntrospection::Repository.default
20
- @repository.require("Gio")
21
- @info = @repository.find("Gio", "Application")
22
- @sandbox = Module.new
23
20
  end
24
21
 
25
22
  def test_define_class
26
- gtype = @info.gtype
27
- GObjectIntrospection::Loader.define_class(gtype, "Application", @sandbox)
28
- assert_equal(gtype, @sandbox::Application.gtype)
23
+ info = @repository.find("Gio", "Application")
24
+ gtype = info.gtype
25
+ assert_equal(gtype, Gio::Application.gtype)
26
+ end
27
+
28
+ sub_test_case("virtual function") do
29
+ def test_without_prefix
30
+ active_vfs_class = Class.new(Gio::Vfs) do
31
+ type_register("ActiveVfsWithoutPrefix")
32
+
33
+ def virtual_do_is_active
34
+ true
35
+ end
36
+ end
37
+ active_vfs = active_vfs_class.new
38
+ assert do
39
+ active_vfs.active?
40
+ end
41
+ end
42
+
43
+ def test_with_prefix
44
+ active_vfs_class = Class.new(Gio::Vfs) do
45
+ type_register("ActiveVfsWithPrefix")
46
+
47
+ def virtual_do_gvfs_is_active
48
+ true
49
+ end
50
+ end
51
+ active_vfs = active_vfs_class.new
52
+ assert do
53
+ active_vfs.active?
54
+ end
55
+ end
56
+
57
+ def test_interface
58
+ resettable_converter_class = Class.new(GLib::Object) do
59
+ type_register("ResettableConverter")
60
+
61
+ include Gio::Converter
62
+
63
+ attr_reader :resetted
64
+
65
+ def virtual_do_reset
66
+ @resetted = true
67
+ end
68
+ end
69
+ resettable_converter = resettable_converter_class.new
70
+ resettable_converter.reset
71
+ assert do
72
+ resettable_converter.resetted
73
+ end
74
+ end
29
75
  end
30
76
  end
@@ -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
@@ -113,6 +113,10 @@ class TestObjectInfo < Test::Unit::TestCase
113
113
  assert_equal(0, @info.n_constants)
114
114
  end
115
115
 
116
+ def test_class_struct
117
+ assert_equal("FileOutputStreamClass", @info.class_struct.name)
118
+ end
119
+
116
120
  def test_unref_function
117
121
  assert_nil(@info.unref_function)
118
122
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2014 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
@@ -30,6 +30,11 @@ class TestStructInfo < Test::Unit::TestCase
30
30
  @info.get_field(0))
31
31
  end
32
32
 
33
+ def test_find_field
34
+ assert_equal("g_type",
35
+ @info.find_field("g_type").name)
36
+ end
37
+
33
38
  def test_n_methods
34
39
  assert_operator(@info.n_methods, :>=, 62)
35
40
  end
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.4
4
+ version: 3.4.8
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: 2021-04-22 00:00:00.000000000 Z
11
+ date: 2021-08-09 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.4
19
+ version: 3.4.8
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.4
26
+ version: 3.4.8
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
@@ -38,6 +38,8 @@ files:
38
38
  - Rakefile
39
39
  - ext/gobject-introspection/depend
40
40
  - ext/gobject-introspection/extconf.rb
41
+ - ext/gobject-introspection/gobject-introspection-enum-types.c
42
+ - ext/gobject-introspection/gobject-introspection-enum-types.h
41
43
  - ext/gobject-introspection/gobject_introspection.def
42
44
  - ext/gobject-introspection/rb-gi-arg-info.c
43
45
  - ext/gobject-introspection/rb-gi-argument.c
@@ -86,6 +88,7 @@ files:
86
88
  - ext/gobject-introspection/rb-gi-vfunc-info.c
87
89
  - ext/gobject-introspection/rb-gobject-introspection.c
88
90
  - ext/gobject-introspection/rb-gobject-introspection.h
91
+ - ext/gobject-introspection/rbgiversion.h
89
92
  - extconf.rb
90
93
  - gobject-introspection.gemspec
91
94
  - lib/gi.rb