gir_ffi 0.15.9 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +42 -18
  3. data/README.md +20 -14
  4. data/lib/ffi-glib/array.rb +1 -1
  5. data/lib/ffi-glib/bytes.rb +0 -12
  6. data/lib/ffi-glib/main_loop.rb +3 -3
  7. data/lib/ffi-glib/ptr_array.rb +24 -15
  8. data/lib/ffi-glib/variant.rb +6 -8
  9. data/lib/ffi-gobject/object.rb +5 -15
  10. data/lib/ffi-gobject/object_class.rb +2 -10
  11. data/lib/ffi-gobject/value.rb +27 -27
  12. data/lib/ffi-gobject.rb +3 -17
  13. data/lib/ffi-gobject_introspection/i_constant_info.rb +10 -10
  14. data/lib/ffi-gobject_introspection/i_registered_type_info.rb +1 -1
  15. data/lib/ffi-gobject_introspection/lib.rb +11 -11
  16. data/lib/ffi-gobject_introspection.rb +19 -19
  17. data/lib/gir_ffi/builder.rb +1 -1
  18. data/lib/gir_ffi/builders/argument_builder_collection.rb +5 -5
  19. data/lib/gir_ffi/builders/base_argument_builder.rb +2 -2
  20. data/lib/gir_ffi/builders/base_method_builder.rb +23 -23
  21. data/lib/gir_ffi/builders/constructor_builder.rb +1 -1
  22. data/lib/gir_ffi/builders/function_builder.rb +1 -1
  23. data/lib/gir_ffi/builders/mapping_method_builder.rb +1 -1
  24. data/lib/gir_ffi/builders/marshalling_method_builder.rb +3 -3
  25. data/lib/gir_ffi/builders/method_template.rb +2 -2
  26. data/lib/gir_ffi/builders/object_builder.rb +10 -12
  27. data/lib/gir_ffi/builders/pointer_value_convertor.rb +1 -1
  28. data/lib/gir_ffi/builders/type_builder.rb +9 -9
  29. data/lib/gir_ffi/builders/user_defined_builder.rb +24 -26
  30. data/lib/gir_ffi/class_base.rb +1 -3
  31. data/lib/gir_ffi/core.rb +0 -5
  32. data/lib/gir_ffi/ffi_ext/pointer.rb +22 -12
  33. data/lib/gir_ffi/in_pointer.rb +6 -6
  34. data/lib/gir_ffi/info_ext/i_registered_type_info.rb +1 -1
  35. data/lib/gir_ffi/info_ext/i_signal_info.rb +8 -6
  36. data/lib/gir_ffi/info_ext/i_type_info.rb +18 -24
  37. data/lib/gir_ffi/instance_method_setup.rb +3 -1
  38. data/lib/gir_ffi/method_stubber.rb +1 -1
  39. data/lib/gir_ffi/object_base.rb +5 -5
  40. data/lib/gir_ffi/struct_like_base.rb +0 -1
  41. data/lib/gir_ffi/type_map.rb +30 -30
  42. data/lib/gir_ffi/unintrospectable_type_info.rb +2 -2
  43. data/lib/gir_ffi/user_defined_object_info.rb +0 -3
  44. data/lib/gir_ffi/user_defined_property_info.rb +33 -33
  45. data/lib/gir_ffi/version.rb +1 -1
  46. data/lib/gir_ffi/zero_terminated.rb +1 -1
  47. data/lib/gir_ffi-base/gobject.rb +1 -1
  48. metadata +30 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 240502b5086fedd9c4f52a114faf67c5021f03c4fedc10dd6fbfabd064a64aca
4
- data.tar.gz: b89d501796ee980af6d731758f144a9eba21472353bae02029548f6541787db4
3
+ metadata.gz: f895f96ce883cc8698a2b95c39e241313762a9235a5d6bb38f0ca6ce0cb72249
4
+ data.tar.gz: 31f7c7558d25116276e3857d7aca50272232753b49da125b208124d93f33c519
5
5
  SHA512:
6
- metadata.gz: a6f7df11953d3b1a88c3fa515207d3f15883e79de7114fb6ad55bf1545e1e023a6b1b7b83199fd3ef0a45ab762d240a9b59eec8c4aac660b1d8d83363de51c0a
7
- data.tar.gz: 18ca30c7f7f54daeff80c3045d24e1231d0a927e68f0ae8877a548b95cdc8602298b602925e3ad20e6b26049b62a7541b85d7f2d56b328594d22ca39b960146c
6
+ metadata.gz: 72e1eddb0fb987e2c2ad6805e6c2b3c1c6588997d30f3efaaac3de408585fda9fa50aca66b74ec9aa76ee253a2701bf747187556086f772f9d20c67f985a6ae9
7
+ data.tar.gz: 264a6574d5cde0c8d981553433b895ccd11e3ae61c1aeb315ca75c74ee563efe2d4944f1b344fee50844b1caef5e8a547da0d50c4571461d67bdabd016cda323
data/Changelog.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.16.1 / 2023-10-07
4
+
5
+ * Support Ruby 3.2 ([#331] by [mvz])
6
+ * Require at least ffi 1.16.3 to avoid 'Can't modify frozen Hash' error ([#350]
7
+ by [mvz])
8
+
9
+ [mvz]: https://github.com/mvz
10
+
11
+ [#331]: https://github.com/mvz/gir_ffi/pull/331
12
+ [#350]: https://github.com/mvz/gir_ffi/pull/350
13
+
14
+ ## 0.16.0 / 2022-05-21
15
+
16
+ * Support Ruby 3.1
17
+ * Rename `#object_class` to `#class_struct`
18
+ * Remove `GObject.object_class_from_instance`
19
+ * Limit public interface of `BaseMethodBuilder`
20
+ * Remove deprecated methods from `GObject::Object`
21
+ * Stop accepting blocks when defining a type
22
+ * Check parameter direction in signal argument conversion
23
+ * Drop support for JRuby
24
+ * Drop support for Ruby 2.6
25
+
3
26
  ## 0.15.9 / 2021-12-05
4
27
 
5
28
  * Skip setting destroy notifier state if types don't make sense
@@ -144,8 +167,8 @@
144
167
  changed.
145
168
  * Make `Strv#each` thread-safe.
146
169
  * Drop support for CRuby 2.0.
147
- * Move `::type_init` and base `Strv` implementation into `GObjectIntrospection`, making
148
- it stand-alone.
170
+ * Move `::type_init` and base `Strv` implementation into `GObjectIntrospection`,
171
+ making it stand-alone.
149
172
  * Move `GLib::Boolean` to `GirFFI::Boolean`.
150
173
  * Guard against instantiating abstract classes using the default constructor.
151
174
  * Handle user-defined properties containing dashes
@@ -166,7 +189,7 @@
166
189
  actual effect even on CRuby.
167
190
  - Immediately free string pointers whose ownership is transfered. Again, the
168
191
  #autorelease technique doesn't work on JRuby.
169
- - Fix handling of callee-allocated out parameters in vfuncs. The put_pointer
192
+ - Fix handling of callee-allocated out parameters in vfuncs. The `put_pointer`
170
193
  method was wrongly called, and JRuby is more picky about what types that
171
194
  method expects, exposing the bug.
172
195
 
@@ -185,7 +208,8 @@
185
208
 
186
209
  ## 0.9.5 / 2016-03-05
187
210
 
188
- * Abort if modules were defined earlier, e.g., through the gems from the ruby-gnome family.
211
+ * Abort if modules were defined earlier, e.g., through the gems from the
212
+ ruby-gnome family.
189
213
  * Extend integration testing with GObjectIntrospection's test libraries.
190
214
  * Find signals on user-defined types.
191
215
  * Allow getting and setting of properties with a callback value.
@@ -500,7 +524,7 @@
500
524
  ## 0.4.2 / 2012-09-22
501
525
 
502
526
  * Make objects and interfaces wrap poiners in the class that matches
503
- their GType.
527
+ their GType.
504
528
 
505
529
  ## 0.4.1 / 2012-09-18
506
530
 
@@ -516,7 +540,7 @@ their GType.
516
540
  ## 0.3.2 / 2012-08-24
517
541
 
518
542
  * Correctly set FFI return type when callbacks that return GObjects have
519
- incomplete type specification.
543
+ incomplete type specification.
520
544
 
521
545
  ## 0.3.1 / 2012-05-13
522
546
 
@@ -544,15 +568,15 @@ incomplete type specification.
544
568
 
545
569
  ## 0.2.2 / 2011-12-07
546
570
 
547
- * Fix issue #19: Check if a GLib::PtrArray.add method was generated
548
- before attempting to remove it.
571
+ * Fix issue #19: Check if a GLib::PtrArray.add method was generated before
572
+ attempting to remove it.
549
573
  * Fix two issues with pretty printing that made output for GLib have syntax
550
- errors.
574
+ errors.
551
575
 
552
576
  ## 0.2.1 / 2011-11-20
553
577
 
554
- * Fix handling of output parameters that are arrays of pointers to
555
- structures (i.e., of type `Foo***`).
578
+ * Fix handling of output parameters that are arrays of pointers to structures
579
+ (i.e., of type `Foo***`).
556
580
 
557
581
  ## 0.2.0 / 2011-11-19
558
582
 
@@ -562,9 +586,9 @@ structures (i.e., of type `Foo***`).
562
586
  - Get rid of `#[]` and `#[]=`.
563
587
  * Explicitely load `libgirepository` with ABI version 1.
564
588
  * Improve implementation of GLib container classes (GList etc.):
565
- - Real constructors.
566
- - `#append` and friends are instance methods now.
567
- - Conversion methods to cast Ruby containers to GLib containers.
589
+ - Real constructors.
590
+ - `#append` and friends are instance methods now.
591
+ - Conversion methods to cast Ruby containers to GLib containers.
568
592
  * Start implementing pretty printing.
569
593
  * Various refactorings.
570
594
 
@@ -577,10 +601,10 @@ structures (i.e., of type `Foo***`).
577
601
  ## 0.0.14 / 2011-10-28
578
602
 
579
603
  * Support GObject Introspection version 1.30:
580
- - Add support for layouts with fixed-length arrays.
581
- - Handle type names starting with underscores.
582
- - Call `g_signal_emitv` directly to avoid conflict in introspection info
583
- with earlier versions of GObject Introspection.
604
+ - Add support for layouts with fixed-length arrays.
605
+ - Handle type names starting with underscores.
606
+ - Call `g_signal_emitv` directly to avoid conflict in introspection info
607
+ with earlier versions of GObject Introspection.
584
608
 
585
609
  ## 0.0.13 / 2011-09-09
586
610
 
data/README.md CHANGED
@@ -23,35 +23,41 @@ Ruby bindings for GNOME using the GObject Introspection Repository.
23
23
 
24
24
  ## Usage
25
25
 
26
- require 'gir_ffi'
26
+ ```ruby
27
+ require 'gir_ffi'
27
28
 
28
- # Set up the namespace you wish to use
29
- GirFFI.setup :Gio
29
+ # Set up the namespace you wish to use
30
+ GirFFI.setup :Gio
30
31
 
31
- # Create an object
32
- inet_address = Gio::InetAddress.new_from_string "127.0.0.1"
32
+ # Create an object
33
+ inet_address = Gio::InetAddress.new_from_string "127.0.0.1"
33
34
 
34
- # Call some methods on the object
35
- inet_address.is_loopback # => true
36
- inet_address.is_multicast # => false
35
+ # Call some methods on the object
36
+ inet_address.is_loopback # => true
37
+ inet_address.is_multicast # => false
37
38
 
38
- # Call a function in the namespace
39
- Gio.dbus_is_name "foo" # => false
39
+ # Call a function in the namespace
40
+ Gio.dbus_is_name "foo" # => false
41
+ ```
40
42
 
41
43
  See the [documentation](docs/Documentation.md) for more usage information.
42
44
 
43
45
  ## Examples
44
46
 
45
47
  Have a look in the `examples/` directory for some simple examples. More
46
- examples can be found in `gir_ffi-gtk` and `gir_ffi-gst`.
48
+ examples can be found in the repositories for
49
+ [`gir_ffi-gtk`](https://github.com/mvz/gir_ffi-gtk) and
50
+ [`gir_ffi-gst`](https://github.com/mvz/gir_ffi-gst/).
47
51
 
48
52
  ## Install
49
53
 
50
- gem install gir_ffi
54
+ ```bash
55
+ gem install gir_ffi
56
+ ```
51
57
 
52
58
  ## Requirements
53
59
 
54
- GirFFI is supported on CRuby 2.6, 2.7 and 3.0, and JRuby 9.3.
60
+ GirFFI is supported on CRuby 2.7, 3.0 and 3.1.
55
61
 
56
62
  You will also need gobject-introspection installed with some
57
63
  introspection data.
@@ -104,7 +110,7 @@ The following people have contributed to GirFFI over the years:
104
110
 
105
111
  ## License
106
112
 
107
- Copyright © 2009–2021 [Matijs van Zuijlen](http://www.matijs.net)
113
+ Copyright © 2009–2022 [Matijs van Zuijlen](http://www.matijs.net)
108
114
 
109
115
  GirFFI is free software, distributed under the terms of the GNU Lesser
110
116
  General Public License, version 2.1 or later. See the file COPYING.LIB for
@@ -52,7 +52,7 @@ module GLib
52
52
  Lib.g_array_get_element_size self
53
53
  end
54
54
 
55
- alias element_size get_element_size
55
+ alias_method :element_size, :get_element_size
56
56
 
57
57
  def ==(other)
58
58
  to_a == other.to_a
@@ -7,18 +7,6 @@ module GLib
7
7
  class Bytes
8
8
  include Enumerable
9
9
 
10
- remove_method :get_data if method_defined? :get_data
11
-
12
- # @override
13
- # NOTE: Needed due to mis-identification of the element-type of the
14
- # resulting sized array for the default binding.
15
- def get_data
16
- length_ptr = FFI::MemoryPointer.new :size_t
17
- data_ptr = Lib.g_bytes_get_data self, length_ptr
18
- length = length_ptr.get_size_t(0)
19
- GirFFI::SizedArray.wrap(:guint8, length, data_ptr)
20
- end
21
-
22
10
  def each(&block)
23
11
  data.each(&block)
24
12
  end
@@ -40,7 +40,7 @@ module GLib
40
40
  setup_instance_method! :run
41
41
 
42
42
  def run_with_thread_enabler
43
- ThreadEnabler.instance.setup_idle_handler if RUBY_ENGINE == "ruby"
43
+ ThreadEnabler.instance.setup_idle_handler
44
44
  RUNNING_LOOPS << self
45
45
  result = run_without_thread_enabler
46
46
  exception = EXCEPTIONS.shift
@@ -58,8 +58,8 @@ module GLib
58
58
  current_loop.quit
59
59
  end
60
60
 
61
- alias run_without_thread_enabler run
62
- alias run run_with_thread_enabler
61
+ alias_method :run_without_thread_enabler, :run
62
+ alias_method :run, :run_with_thread_enabler
63
63
  end
64
64
  end
65
65
 
@@ -50,21 +50,7 @@ module GLib
50
50
 
51
51
  # Re-implementation of the g_ptrarray_index macro
52
52
  def index(idx)
53
- unless (0...length).cover? idx
54
- raise IndexError, "Index #{idx} outside of bounds 0..#{length - 1}"
55
- end
56
-
57
- item_ptr = data_ptr + idx * element_size
58
-
59
- convert_element_type = case element_type
60
- when :utf8
61
- :utf8
62
- when GirFFI::ObjectBase
63
- element_type
64
- else
65
- [:pointer, element_type]
66
- end
67
-
53
+ item_ptr = item_pointer(idx)
68
54
  convertor = GirFFI::ArrayElementConvertor.new convert_element_type, item_ptr
69
55
  convertor.to_ruby_value
70
56
  end
@@ -85,6 +71,29 @@ module GLib
85
71
 
86
72
  private
87
73
 
74
+ def item_pointer(idx)
75
+ check_bounds(idx)
76
+
77
+ data_ptr + idx * element_size
78
+ end
79
+
80
+ def check_bounds(idx)
81
+ unless (0...length).cover? idx
82
+ raise IndexError, "Index #{idx} outside of bounds 0..#{length - 1}"
83
+ end
84
+ end
85
+
86
+ def convert_element_type
87
+ case element_type
88
+ when :utf8
89
+ :utf8
90
+ when GirFFI::ObjectBase
91
+ element_type
92
+ else
93
+ [:pointer, element_type]
94
+ end
95
+ end
96
+
88
97
  def element_size
89
98
  POINTER_SIZE
90
99
  end
@@ -11,16 +11,14 @@ module GLib
11
11
  get_string_without_override.first
12
12
  end
13
13
 
14
- alias get_string_without_override get_string
15
- alias get_string get_string_with_override
14
+ alias_method :get_string_without_override, :get_string
15
+ alias_method :get_string, :get_string_with_override
16
16
 
17
- # Initializing method used in constructors. For Variant, this needs to sink
18
- # the variant's floating reference.
19
- #
20
- # NOTE: This is very hard to test since it is not possible to get the
21
- # variant's ref count directely. However, there is an error when running
22
- # the tests on 32-bit systems.
17
+ # Initializing method used in constructors. For Variant the constructing
18
+ # functions all return floating references, so this is need to take full
19
+ # ownership.
23
20
  #
21
+ # Also see the documentation for g_variant_ref_sink.
24
22
  def store_pointer(ptr)
25
23
  Lib.g_variant_ref_sink ptr
26
24
  super
@@ -33,8 +33,8 @@ module GObject
33
33
  store_pointer ptr
34
34
  end
35
35
 
36
- alias old_initialze initialize
37
- alias initialize initialize_with_properties
36
+ alias_method :old_initialze, :initialize
37
+ alias_method :initialize, :initialize_with_properties
38
38
  remove_method :old_initialze
39
39
 
40
40
  def self.new(*args, &block)
@@ -43,7 +43,7 @@ module GObject
43
43
  obj
44
44
  end
45
45
 
46
- alias base_initialize initialize
46
+ alias_method :base_initialize, :initialize
47
47
 
48
48
  private :base_initialize
49
49
 
@@ -82,7 +82,7 @@ module GObject
82
82
  setup_instance_method! "get_property"
83
83
  setup_instance_method! "set_property"
84
84
  setup_instance_method! "is_floating"
85
- alias floating? is_floating
85
+ alias_method :floating?, :is_floating
86
86
 
87
87
  private
88
88
 
@@ -117,17 +117,12 @@ module GObject
117
117
  end
118
118
 
119
119
  def property_param_spec(property_name)
120
- object_class.find_property property_name or
120
+ class_struct.find_property property_name or
121
121
  raise GirFFI::PropertyNotFoundError.new(property_name, self.class)
122
122
  end
123
123
 
124
124
  # Overrides for GObject, GObject's generic base class.
125
125
  module Overrides
126
- # @deprecated
127
- def get_property_extended(property_name)
128
- get_property(property_name)
129
- end
130
-
131
126
  def get_property(property_name)
132
127
  gvalue = gvalue_for_property property_name
133
128
  super property_name, gvalue
@@ -139,11 +134,6 @@ module GObject
139
134
  value
140
135
  end
141
136
 
142
- # @deprecated
143
- def set_property_extended(property_name, value)
144
- set_property property_name, value
145
- end
146
-
147
137
  def set_property(property_name, value)
148
138
  type_info = get_property_type property_name
149
139
  value = property_value_pre_conversion(value, type_info) if type_info
@@ -1,18 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- GObject::Object.object_class
3
+ GObject::Object.class_struct
4
4
 
5
5
  module GObject
6
- # Overrides for GObjectClass, a struct containing GObject's class data
6
+ # Overrides for GObjectClass, the class struct for GObject::Object
7
7
  class ObjectClass
8
- def set_property=(callback)
9
- struct[:set_property] = GObject::ObjectSetPropertyFunc.from callback
10
- end
11
-
12
- def get_property=(callback)
13
- struct[:get_property] = GObject::ObjectGetPropertyFunc.from callback
14
- end
15
-
16
8
  def gtype
17
9
  to_ptr.get_gtype 0
18
10
  end
@@ -8,29 +8,29 @@ module GObject
8
8
  setup_instance_method! :init
9
9
 
10
10
  METHOD_MAP = {
11
- TYPE_INVALID => [:get_none, :set_none],
11
+ TYPE_INVALID => [:get_none, :set_none],
12
12
  # TYPE_NONE is skipped
13
- TYPE_INTERFACE => [:get_object, :set_instance_enhanced],
14
- TYPE_CHAR => [:get_schar, :set_schar],
15
- TYPE_UCHAR => [:get_uchar, :set_uchar],
16
- TYPE_BOOLEAN => [:get_boolean, :set_boolean],
17
- TYPE_INT => [:get_int, :set_int],
18
- TYPE_UINT => [:get_uint, :set_uint],
19
- TYPE_LONG => [:get_long, :set_long],
20
- TYPE_ULONG => [:get_ulong, :set_ulong],
21
- TYPE_INT64 => [:get_int64, :set_int64],
22
- TYPE_UINT64 => [:get_uint64, :set_uint64],
23
- TYPE_ENUM => [:get_enum_enhanced, :set_enum_enhanced],
24
- TYPE_FLAGS => [:get_flags_enhanced, :set_flags_enhanced],
25
- TYPE_FLOAT => [:get_float, :set_float],
26
- TYPE_DOUBLE => [:get_double, :set_double],
27
- TYPE_STRING => [:get_string, :set_string],
28
- TYPE_POINTER => [:get_pointer, :set_pointer],
29
- TYPE_BOXED => [:get_boxed, :set_boxed],
30
- TYPE_PARAM => [:get_param, :set_param],
31
- TYPE_OBJECT => [:get_object, :set_instance_enhanced],
32
- TYPE_GTYPE => [:get_gtype, :set_gtype],
33
- TYPE_VARIANT => [:get_variant, :set_variant]
13
+ TYPE_INTERFACE => [:get_object, :set_instance_enhanced],
14
+ TYPE_CHAR => [:get_schar, :set_schar],
15
+ TYPE_UCHAR => [:get_uchar, :set_uchar],
16
+ TYPE_BOOLEAN => [:get_boolean, :set_boolean],
17
+ TYPE_INT => [:get_int, :set_int],
18
+ TYPE_UINT => [:get_uint, :set_uint],
19
+ TYPE_LONG => [:get_long, :set_long],
20
+ TYPE_ULONG => [:get_ulong, :set_ulong],
21
+ TYPE_INT64 => [:get_int64, :set_int64],
22
+ TYPE_UINT64 => [:get_uint64, :set_uint64],
23
+ TYPE_ENUM => [:get_enum_enhanced, :set_enum_enhanced],
24
+ TYPE_FLAGS => [:get_flags_enhanced, :set_flags_enhanced],
25
+ TYPE_FLOAT => [:get_float, :set_float],
26
+ TYPE_DOUBLE => [:get_double, :set_double],
27
+ TYPE_STRING => [:get_string, :set_string],
28
+ TYPE_POINTER => [:get_pointer, :set_pointer],
29
+ TYPE_BOXED => [:get_boxed, :set_boxed],
30
+ TYPE_PARAM => [:get_param, :set_param],
31
+ TYPE_OBJECT => [:get_object, :set_instance_enhanced],
32
+ TYPE_GTYPE => [:get_gtype, :set_gtype],
33
+ TYPE_VARIANT => [:get_variant, :set_variant]
34
34
  }.freeze
35
35
 
36
36
  # TODO: Give more generic name
@@ -68,11 +68,11 @@ module GObject
68
68
  end
69
69
 
70
70
  CLASS_TO_GTYPE_MAP = {
71
- NilClass => TYPE_INVALID,
72
- TrueClass => TYPE_BOOLEAN,
71
+ NilClass => TYPE_INVALID,
72
+ TrueClass => TYPE_BOOLEAN,
73
73
  FalseClass => TYPE_BOOLEAN,
74
- Integer => TYPE_INT,
75
- String => TYPE_STRING
74
+ Integer => TYPE_INT,
75
+ String => TYPE_STRING
76
76
  }.freeze
77
77
 
78
78
  # Overrides for existing Value methods
@@ -81,7 +81,7 @@ module GObject
81
81
  send set_method, val
82
82
  end
83
83
 
84
- alias value= set_value
84
+ alias_method :value=, :set_value
85
85
 
86
86
  def current_gtype
87
87
  struct[:g_type]
data/lib/ffi-gobject.rb CHANGED
@@ -31,17 +31,6 @@ module GObject
31
31
  type_name type_from_instance instance
32
32
  end
33
33
 
34
- def self.object_class_from_instance(instance)
35
- object_class_from_instance_pointer instance.to_ptr
36
- end
37
-
38
- def self.object_class_from_instance_pointer(inst_ptr)
39
- return nil if inst_ptr.null?
40
-
41
- klsptr = inst_ptr.get_pointer 0
42
- ObjectClass.wrap klsptr
43
- end
44
-
45
34
  def self.signal_lookup_from_instance(signal, object)
46
35
  signal_lookup signal, type_from_instance(object)
47
36
  end
@@ -55,11 +44,7 @@ module GObject
55
44
  argument_gvalues = sig_info.arguments_to_gvalues object, args
56
45
  return_gvalue = sig_info.gvalue_for_return_value
57
46
 
58
- result = signal_emitv argument_gvalues, signal_id, detail_quark, return_gvalue
59
- # NOTE: Depending on the version of GObjectIntrospection, the result will
60
- # be stored in result or return_gvalue. This was changed between versions
61
- # 1.44 and 1.46.
62
- result || return_gvalue.get_value
47
+ signal_emitv argument_gvalues, signal_id, detail_quark, return_gvalue
63
48
  end
64
49
 
65
50
  def self.signal_connect(object, detailed_signal, data = nil, after = false, &block)
@@ -85,7 +70,8 @@ module GObject
85
70
  load_class :ClosureMarshal
86
71
  load_class :ParamFlags
87
72
 
88
- # NOTE: This Lib module is set up in `gir_ffi-base/gobject/lib.rb`.
73
+ # Attach some needed functions to the GObject Lib, which was set up in
74
+ # `gir_ffi-base/gobject/lib.rb`.
89
75
  Lib.class_eval do
90
76
  attach_function :g_object_ref_sink, [:pointer], :pointer
91
77
  attach_function :g_object_ref, [:pointer], :pointer
@@ -5,16 +5,16 @@ module GObjectIntrospection
5
5
  class IConstantInfo < IBaseInfo
6
6
  TYPE_TAG_TO_UNION_MEMBER = {
7
7
  gboolean: :v_boolean,
8
- gint8: :v_int8,
9
- gint16: :v_int16,
10
- gint32: :v_int32,
11
- gint64: :v_int64,
12
- guint8: :v_uint8,
13
- guint16: :v_uint16,
14
- guint32: :v_uint32,
15
- guint64: :v_uint64,
16
- gdouble: :v_double,
17
- utf8: :v_string
8
+ gint8: :v_int8,
9
+ gint16: :v_int16,
10
+ gint32: :v_int32,
11
+ gint64: :v_int64,
12
+ guint8: :v_uint8,
13
+ guint16: :v_uint16,
14
+ guint32: :v_uint32,
15
+ guint64: :v_uint64,
16
+ gdouble: :v_double,
17
+ utf8: :v_string
18
18
  }.freeze
19
19
 
20
20
  def value
@@ -16,6 +16,6 @@ module GObjectIntrospection
16
16
  Lib.g_registered_type_info_get_g_type self
17
17
  end
18
18
 
19
- alias gtype g_type
19
+ alias_method :gtype, :g_type
20
20
  end
21
21
  end
@@ -63,12 +63,12 @@ module GObjectIntrospection
63
63
 
64
64
  # IFunctionInfo
65
65
  bit_mask :IFunctionInfoFlags,
66
- is_method: (1 << 0),
66
+ is_method: (1 << 0),
67
67
  is_constructor: (1 << 1),
68
- is_getter: (1 << 2),
69
- is_setter: (1 << 3),
70
- wraps_vfunc: (1 << 4),
71
- throws: (1 << 5)
68
+ is_getter: (1 << 2),
69
+ is_setter: (1 << 3),
70
+ wraps_vfunc: (1 << 4),
71
+ throws: (1 << 5)
72
72
 
73
73
  attach_function :g_function_info_get_symbol, [:pointer], :string
74
74
  attach_function :g_function_info_get_flags, [:pointer], :IFunctionInfoFlags
@@ -231,10 +231,10 @@ module GObjectIntrospection
231
231
 
232
232
  # IVFuncInfo
233
233
  bit_mask :IVFuncInfoFlags,
234
- must_chain_up: (1 << 0),
235
- must_override: (1 << 1),
234
+ must_chain_up: (1 << 0),
235
+ must_override: (1 << 1),
236
236
  must_not_override: (1 << 2),
237
- throws: (1 << 3)
237
+ throws: (1 << 3)
238
238
 
239
239
  attach_function :g_vfunc_info_get_flags, [:pointer], :IVFuncInfoFlags
240
240
  attach_function :g_vfunc_info_get_invoker, [:pointer], :pointer
@@ -294,9 +294,9 @@ module GObjectIntrospection
294
294
 
295
295
  # NOTE: This type has more values, but these are the ones used
296
296
  bit_mask :ParamFlags,
297
- readable: (1 << 0),
298
- writable: (1 << 1),
299
- construct: (1 << 2),
297
+ readable: (1 << 0),
298
+ writable: (1 << 1),
299
+ construct: (1 << 2),
300
300
  construct_only: (1 << 3)
301
301
 
302
302
  attach_function :g_property_info_get_flags, [:pointer], :ParamFlags
@@ -25,27 +25,27 @@ require "ffi-gobject_introspection/i_unresolved_info"
25
25
  module GObjectIntrospection
26
26
  # Map info type to class. Default is IBaseInfo.
27
27
  TYPEMAP = {
28
- invalid: IBaseInfo,
29
- function: IFunctionInfo,
30
- callback: ICallbackInfo,
31
- struct: IStructInfo,
28
+ invalid: IBaseInfo,
29
+ function: IFunctionInfo,
30
+ callback: ICallbackInfo,
31
+ struct: IStructInfo,
32
32
  # TODO: There's no GIBoxedInfo, so what does :boxed mean?
33
- boxed: IBaseInfo,
34
- enum: IEnumInfo,
35
- flags: IFlagsInfo,
36
- object: IObjectInfo,
37
- interface: IInterfaceInfo,
38
- constant: IConstantInfo,
33
+ boxed: IBaseInfo,
34
+ enum: IEnumInfo,
35
+ flags: IFlagsInfo,
36
+ object: IObjectInfo,
37
+ interface: IInterfaceInfo,
38
+ constant: IConstantInfo,
39
39
  invalid_was_error_domain: IBaseInfo,
40
- union: IUnionInfo,
41
- value: IValueInfo,
42
- signal: ISignalInfo,
43
- vfunc: IVFuncInfo,
44
- property: IPropertyInfo,
45
- field: IFieldInfo,
46
- arg: IArgInfo,
47
- type: ITypeInfo,
48
- unresolved: IUnresolvedInfo
40
+ union: IUnionInfo,
41
+ value: IValueInfo,
42
+ signal: ISignalInfo,
43
+ vfunc: IVFuncInfo,
44
+ property: IPropertyInfo,
45
+ field: IFieldInfo,
46
+ arg: IArgInfo,
47
+ type: ITypeInfo,
48
+ unresolved: IUnresolvedInfo
49
49
  }.freeze
50
50
  end
51
51
 
@@ -46,7 +46,7 @@ module GirFFI
46
46
  end
47
47
  Builders::ModuleBuilder.new(module_name,
48
48
  namespace: namespace,
49
- version: version).generate
49
+ version: version).generate
50
50
  end
51
51
 
52
52
  # TODO: Move elsewhere, perhaps to FunctionBuilder.