glib2 3.5.1 → 4.0.2

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.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/ext/glib2/extconf.rb +4 -3
  3. data/ext/glib2/glib2.def +6 -0
  4. data/ext/glib2/rbglib-bytes.c +1 -1
  5. data/ext/glib2/rbglib-gc.c +1 -1
  6. data/ext/glib2/rbglib-variant-type.c +1 -1
  7. data/ext/glib2/rbglib-variant.c +75 -2
  8. data/ext/glib2/rbglib.c +25 -59
  9. data/ext/glib2/rbglib.h +16 -3
  10. data/ext/glib2/rbglib_bookmarkfile.c +3 -2
  11. data/ext/glib2/rbglib_convert.c +2 -2
  12. data/ext/glib2/rbglib_datetime.c +14 -3
  13. data/ext/glib2/rbglib_error.c +2 -2
  14. data/ext/glib2/rbglib_fileutils.c +2 -2
  15. data/ext/glib2/rbglib_gettext.c +1 -1
  16. data/ext/glib2/rbglib_i18n.c +2 -2
  17. data/ext/glib2/rbglib_io_constants.c +1 -1
  18. data/ext/glib2/rbglib_iochannel.c +2 -2
  19. data/ext/glib2/rbglib_iochannel_win32_socket.c +2 -2
  20. data/ext/glib2/rbglib_iochannelerror.c +1 -1
  21. data/ext/glib2/rbglib_keyfile.c +2 -2
  22. data/ext/glib2/rbglib_maincontext.c +6 -6
  23. data/ext/glib2/rbglib_mainloop.c +1 -1
  24. data/ext/glib2/rbglib_matchinfo.c +1 -1
  25. data/ext/glib2/rbglib_messages.c +1 -1
  26. data/ext/glib2/rbglib_pollfd.c +1 -1
  27. data/ext/glib2/rbglib_regex.c +3 -3
  28. data/ext/glib2/rbglib_shell.c +1 -1
  29. data/ext/glib2/rbglib_shellerror.c +1 -1
  30. data/ext/glib2/rbglib_source.c +1 -1
  31. data/ext/glib2/rbglib_spawn.c +1 -1
  32. data/ext/glib2/rbglib_spawnerror.c +1 -1
  33. data/ext/glib2/rbglib_threads.c +1 -1
  34. data/ext/glib2/rbglib_timer.c +1 -1
  35. data/ext/glib2/rbglib_timezone.c +1 -1
  36. data/ext/glib2/rbglib_ucs4.c +1 -1
  37. data/ext/glib2/rbglib_unichar.c +1 -1
  38. data/ext/glib2/rbglib_unicode.c +3 -3
  39. data/ext/glib2/rbglib_utf16.c +1 -1
  40. data/ext/glib2/rbglib_utf8.c +1 -1
  41. data/ext/glib2/rbglib_utils.c +1 -1
  42. data/ext/glib2/rbglib_win32.c +3 -3
  43. data/ext/glib2/rbgobj_binding.c +1 -1
  44. data/ext/glib2/rbgobj_boxed.c +1 -1
  45. data/ext/glib2/rbgobj_closure.c +76 -85
  46. data/ext/glib2/rbgobj_enums.c +1 -1
  47. data/ext/glib2/rbgobj_flags.c +1 -1
  48. data/ext/glib2/rbgobj_object.c +32 -5
  49. data/ext/glib2/rbgobj_param.c +1 -1
  50. data/ext/glib2/rbgobj_signal.c +63 -19
  51. data/ext/glib2/rbgobj_type.c +2 -2
  52. data/ext/glib2/rbgobj_typeinstance.c +1 -1
  53. data/ext/glib2/rbgobj_typeinterface.c +4 -4
  54. data/ext/glib2/rbgobj_typemodule.c +1 -1
  55. data/ext/glib2/rbgobj_typeplugin.c +1 -1
  56. data/ext/glib2/rbgobj_value.c +1 -1
  57. data/ext/glib2/rbgobj_valuetypes.c +14 -4
  58. data/ext/glib2/rbgobject.c +7 -21
  59. data/ext/glib2/rbgobject.h +4 -1
  60. data/ext/glib2/rbgprivate.h +7 -4
  61. data/ext/glib2/rbgutil.c +20 -1
  62. data/ext/glib2/rbgutil.h +3 -0
  63. data/ext/glib2/rbgutil_callback.c +7 -7
  64. data/lib/glib2/date-time.rb +35 -0
  65. data/lib/glib2/variant.rb +25 -0
  66. data/lib/glib2.rb +6 -1
  67. data/lib/mkmf-gnome.rb +2 -2
  68. data/test/test-date-time.rb +14 -2
  69. data/test/test-glib2.rb +21 -9
  70. data/test/test-variant.rb +44 -1
  71. metadata +7 -7
  72. data/ext/glib2/glib-enum-types.c +0 -1233
  73. data/ext/glib2/glib-enum-types.h +0 -154
data/test/test-glib2.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # coding: ascii-8bit
2
2
  #
3
- # Copyright (C) 2015-2019 Ruby-GNOME2 Project Team
3
+ # Copyright (C) 2015-2022 Ruby-GNOME Project Team
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -130,17 +130,19 @@ class TestGLib < Test::Unit::TestCase
130
130
  end
131
131
 
132
132
  def test_signal_handler_disconnect_and_gc
133
- obj = GLib::Object.new
133
+ object = GLib::Object.new
134
134
  klass = Class.new
135
- 1000.times {
136
- a = klass.new
137
- id = obj.signal_connect("notify") { p a }
138
- obj.signal_handler_disconnect(id)
135
+ n_tries = 100
136
+ n_tries.times {
137
+ garbage_collected_object = klass.new
138
+ id = object.signal_connect("notify") { p garbage_collected_object }
139
+ object.signal_handler_disconnect(id)
139
140
  }
140
141
  GC.start
141
- ary = []
142
- ObjectSpace.each_object(klass) { |a| ary.push(a) }
143
- assert_operator(ary.size, :<, 1000)
142
+ n_alive_objects = ObjectSpace.each_object(klass) {}
143
+ assert do
144
+ n_alive_objects < n_tries
145
+ end
144
146
  end
145
147
 
146
148
  def test_gtype
@@ -150,4 +152,14 @@ class TestGLib < Test::Unit::TestCase
150
152
  obj = GLib::Object.new
151
153
  assert_equal(obj.gtype, GLib::Object.gtype)
152
154
  end
155
+
156
+ def test_malloc
157
+ address = GLib.malloc(29)
158
+ GLib.free(address)
159
+ end
160
+
161
+ def test_malloc0
162
+ address = GLib.malloc0(29)
163
+ GLib.free(address)
164
+ end
153
165
  end
data/test/test-variant.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2018 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2018-2022 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,6 +17,31 @@
17
17
  class TestGLibVariant < Test::Unit::TestCase
18
18
  include GLibTestUtils
19
19
 
20
+ sub_test_case ".parse" do
21
+ test "no type" do
22
+ variant = GLib::Variant.parse("'hello'")
23
+ assert_equal([GLib::VariantType::STRING, "hello"],
24
+ [variant.type, variant.value])
25
+ end
26
+
27
+ test "type" do
28
+ variant = GLib::Variant.parse("29", "y")
29
+ assert_equal([GLib::VariantType::BYTE, 29],
30
+ [variant.type, variant.value])
31
+ end
32
+
33
+ test "garbage" do
34
+ message = <<-MESSAGE
35
+ expected end of input:
36
+ 29 hello
37
+ ^
38
+ MESSAGE
39
+ assert_raise(GLib::VariantParseError::InputNotAtEnd.new(message)) do
40
+ GLib::Variant.parse("29 hello", "y")
41
+ end
42
+ end
43
+ end
44
+
20
45
  sub_test_case "#initialize" do
21
46
  test "type: string" do
22
47
  variant = GLib::Variant.new("hello", "s")
@@ -24,4 +49,22 @@ class TestGLibVariant < Test::Unit::TestCase
24
49
  [variant.type, variant.value])
25
50
  end
26
51
  end
52
+
53
+ sub_test_case "#to_s" do
54
+ test "default" do
55
+ variant = GLib::Variant.new(29, "y")
56
+ assert_equal("0x1d", variant.to_s)
57
+ end
58
+
59
+ test "type_annotate:" do
60
+ variant = GLib::Variant.new(29, "y")
61
+ assert_equal("byte 0x1d", variant.to_s(type_annotate: true))
62
+ end
63
+ end
64
+
65
+ test "#inspect" do
66
+ variant = GLib::Variant.new(29, "y")
67
+ assert_equal("#<GLib::Variant:0x00 type=y value=29>",
68
+ variant.inspect.gsub(/0x\h+/, "0x00"))
69
+ end
27
70
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib2
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME Project Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-17 00:00:00.000000000 Z
11
+ date: 2022-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pkg-config
@@ -65,8 +65,6 @@ files:
65
65
  - Rakefile
66
66
  - ext/glib2/depend
67
67
  - ext/glib2/extconf.rb
68
- - ext/glib2/glib-enum-types.c
69
- - ext/glib2/glib-enum-types.h
70
68
  - ext/glib2/glib2.def
71
69
  - ext/glib2/rbgcompat.h
72
70
  - ext/glib2/rbglib-bytes.c
@@ -145,9 +143,11 @@ files:
145
143
  - glib2.gemspec
146
144
  - lib/glib-mkenums.rb
147
145
  - lib/glib2.rb
146
+ - lib/glib2/date-time.rb
148
147
  - lib/glib2/deprecatable.rb
149
148
  - lib/glib2/deprecated.rb
150
149
  - lib/glib2/regex.rb
150
+ - lib/glib2/variant.rb
151
151
  - lib/glib2/version.rb
152
152
  - lib/gnome2-raketask.rb
153
153
  - lib/gnome2/rake/external-package.rb
@@ -207,7 +207,7 @@ licenses:
207
207
  - LGPL-2.1+
208
208
  metadata:
209
209
  msys2_mingw_dependencies: glib2
210
- post_install_message:
210
+ post_install_message:
211
211
  rdoc_options: []
212
212
  require_paths:
213
213
  - lib
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
223
  version: '0'
224
224
  requirements: []
225
225
  rubygems_version: 3.4.0.dev
226
- signing_key:
226
+ signing_key:
227
227
  specification_version: 4
228
228
  summary: Ruby/GLib2 is a Ruby binding of GLib-2.x.
229
229
  test_files: []