glib2 3.4.3 → 3.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/ext/glib2/extconf.rb +1 -5
- data/ext/glib2/glib-enum-types.c +1233 -0
- data/ext/glib2/glib-enum-types.h +154 -0
- data/ext/glib2/glib2.def +2 -0
- data/ext/glib2/rbglib-bytes.c +1 -5
- data/ext/glib2/rbglib-gc.c +98 -52
- data/ext/glib2/rbglib-variant-type.c +1 -5
- data/ext/glib2/rbglib-variant.c +6 -7
- data/ext/glib2/rbglib.c +68 -1
- data/ext/glib2/rbglib.h +13 -3
- data/ext/glib2/rbglib_bookmarkfile.c +1 -1
- data/ext/glib2/rbglib_datetime.c +1 -5
- data/ext/glib2/rbglib_error.c +39 -12
- data/ext/glib2/rbglib_fileutils.c +1 -17
- data/ext/glib2/rbglib_iochannel.c +4 -4
- data/ext/glib2/rbglib_keyfile.c +1 -35
- data/ext/glib2/rbglib_maincontext.c +6 -32
- data/ext/glib2/rbglib_mainloop.c +2 -17
- data/ext/glib2/rbglib_matchinfo.c +1 -5
- data/ext/glib2/rbglib_messages.c +4 -5
- data/ext/glib2/rbglib_pollfd.c +1 -25
- data/ext/glib2/rbglib_regex.c +1 -13
- data/ext/glib2/rbglib_source.c +1 -39
- data/ext/glib2/rbglib_spawn.c +5 -10
- data/ext/glib2/rbglib_spawnerror.c +2 -2
- data/ext/glib2/rbglib_threads.c +2 -15
- data/ext/glib2/rbglib_timezone.c +1 -5
- data/ext/glib2/rbglib_unichar.c +46 -5
- data/ext/glib2/rbglib_unicode.c +1 -18
- data/ext/glib2/rbglib_utils.c +1 -14
- data/ext/glib2/rbglib_win32.c +3 -7
- data/ext/glib2/rbgobj_binding.c +1 -7
- data/ext/glib2/rbgobj_boxed.c +1 -1
- data/ext/glib2/rbgobj_closure.c +22 -9
- data/ext/glib2/rbgobj_enums.c +3 -2
- data/ext/glib2/rbgobj_flags.c +1 -1
- data/ext/glib2/rbgobj_object.c +117 -106
- data/ext/glib2/rbgobj_param.c +3 -9
- data/ext/glib2/rbgobj_paramspecs.c +6 -24
- data/ext/glib2/rbgobj_signal.c +105 -93
- data/ext/glib2/rbgobj_strv.c +2 -2
- data/ext/glib2/rbgobj_type.c +58 -67
- data/ext/glib2/rbgobj_typeinterface.c +38 -2
- data/ext/glib2/rbgobj_value.c +23 -8
- data/ext/glib2/rbgobj_valuetypes.c +14 -62
- data/ext/glib2/rbgobject.c +4 -6
- data/ext/glib2/rbgobject.h +2 -27
- data/ext/glib2/rbgprivate.h +10 -6
- data/ext/glib2/rbgutil.h +3 -2
- data/ext/glib2/rbgutil_callback.c +30 -27
- data/lib/glib2/deprecated.rb +22 -1
- data/lib/glib2.rb +54 -3
- data/lib/mkmf-gnome.rb +7 -6
- data/test/glib-test-utils.rb +22 -3
- data/test/run-test.rb +49 -15
- data/test/test-binding.rb +1 -11
- data/test/test-bytes.rb +1 -5
- data/test/test-date-time.rb +1 -3
- data/test/{glib-test-init.rb → test-error.rb} +25 -3
- data/test/test-file-utils.rb +1 -32
- data/test/test-iochannel.rb +3 -5
- data/test/test-key-file.rb +5 -6
- data/test/test-match-info.rb +1 -5
- data/test/test-regex.rb +1 -5
- data/test/test-source.rb +1 -14
- data/test/test-spawn.rb +4 -1
- data/test/test-time-zone.rb +1 -5
- data/test/test-timeout.rb +2 -3
- data/test/test-unicode.rb +16 -12
- data/test/test-utils.rb +2 -8
- data/test/test-variant-type.rb +1 -3
- data/test/test-win32.rb +6 -6
- metadata +6 -5
- data/ext/glib2/rbgobj_valuearray.c +0 -100
data/test/test-file-utils.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-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,38 +21,7 @@ class TestGLibFileUtils < Test::Unit::TestCase
|
|
21
21
|
string.gsub("\u{00A0}", " ")
|
22
22
|
end
|
23
23
|
|
24
|
-
sub_test_case "#format_size_for_display" do
|
25
|
-
def setup
|
26
|
-
only_glib_version(2, 16, 0)
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_kb
|
30
|
-
assert_equal("1.0 KB", GLib.format_size_for_display(1024))
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_10kb
|
34
|
-
assert_equal("10.0 KB", GLib.format_size_for_display(1024 * 10))
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_mb
|
38
|
-
assert_equal("1.0 MB", GLib.format_size_for_display(1024 * 1024))
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_gb
|
42
|
-
assert_equal("1.0 GB", GLib.format_size_for_display(1024 * 1024 * 1024))
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_over_guint32_value
|
46
|
-
guint32_max = 2 ** 32 - 1
|
47
|
-
assert_equal("4.0 GB", GLib.format_size_for_display(guint32_max + 1))
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
24
|
sub_test_case "#format_size" do
|
52
|
-
def setup
|
53
|
-
only_glib_version(2, 30, 0)
|
54
|
-
end
|
55
|
-
|
56
25
|
def test_kb
|
57
26
|
assert_equal("1.0 kB",
|
58
27
|
normalize_space(GLib.format_size(1000)))
|
data/test/test-iochannel.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-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
|
@@ -26,11 +26,13 @@ class TestGIOChannel < Test::Unit::TestCase
|
|
26
26
|
|
27
27
|
@file = Tempfile.new("glib2-content")
|
28
28
|
@file.open
|
29
|
+
@file.binmode
|
29
30
|
@file.print(@content)
|
30
31
|
@file.close
|
31
32
|
|
32
33
|
@sjis_file = Tempfile.new("glib2-sjis-content")
|
33
34
|
@sjis_file.open
|
35
|
+
@sjis_file.binmode
|
34
36
|
@sjis_file.print(@sjis_content)
|
35
37
|
@sjis_file.close
|
36
38
|
end
|
@@ -66,10 +68,6 @@ class TestGIOChannel < Test::Unit::TestCase
|
|
66
68
|
end
|
67
69
|
end
|
68
70
|
|
69
|
-
assert_raises(GLib::IOChannelError) do
|
70
|
-
io.close
|
71
|
-
end
|
72
|
-
|
73
71
|
assert_raises(GLib::FileError) do
|
74
72
|
GLib::IOChannel.new("foo")
|
75
73
|
end
|
data/test/test-key-file.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Ruby-
|
1
|
+
# Copyright (C) 2015-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
|
@@ -20,8 +20,6 @@ class TestGLibKeyFile < Test::Unit::TestCase
|
|
20
20
|
include GLibTestUtils
|
21
21
|
|
22
22
|
def test_load_from_dirs
|
23
|
-
only_glib_version(2, 14, 0)
|
24
|
-
|
25
23
|
key_file = GLib::KeyFile.new
|
26
24
|
assert_raise(GLib::KeyFileError::NotFound) do
|
27
25
|
key_file.load_from_dirs("non-existent")
|
@@ -34,7 +32,8 @@ class TestGLibKeyFile < Test::Unit::TestCase
|
|
34
32
|
key_file.load_from_dirs("non-existent", search_dirs)
|
35
33
|
end
|
36
34
|
if GLib.check_version?(2, 31, 2)
|
37
|
-
|
35
|
+
loaded_path = key_file.load_from_dirs(base_name, search_dirs)
|
36
|
+
assert_equal(temp.path, normalize_path(loaded_path))
|
38
37
|
elsif GLib.check_version?(2, 30, 0)
|
39
38
|
assert_raise(GLib::KeyFileError::NotFound) do
|
40
39
|
key_file.load_from_dirs(base_name, search_dirs)
|
@@ -49,11 +48,11 @@ class TestGLibKeyFile < Test::Unit::TestCase
|
|
49
48
|
key = value
|
50
49
|
EOK
|
51
50
|
temp.close
|
52
|
-
|
51
|
+
loaded_path = key_file.load_from_dirs(base_name, search_dirs)
|
52
|
+
assert_equal(temp.path, normalize_path(loaded_path))
|
53
53
|
end
|
54
54
|
|
55
55
|
def test_desktop_constants
|
56
|
-
only_glib_version(2, 14, 0)
|
57
56
|
assert_equal("Desktop Entry", GLib::KeyFile::DESKTOP_GROUP)
|
58
57
|
assert_equal("URL", GLib::KeyFile::DESKTOP_KEY_URL)
|
59
58
|
end
|
data/test/test-match-info.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-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,10 +17,6 @@
|
|
17
17
|
class TestMatchInfo < Test::Unit::TestCase
|
18
18
|
include GLibTestUtils
|
19
19
|
|
20
|
-
setup do
|
21
|
-
only_glib_version(2, 30, 0)
|
22
|
-
end
|
23
|
-
|
24
20
|
def test_string
|
25
21
|
regex = GLib::Regex.new("[A-Z]+")
|
26
22
|
match_info = regex.match("abc def")
|
data/test/test-regex.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-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,10 +17,6 @@
|
|
17
17
|
class TestRegex < Test::Unit::TestCase
|
18
18
|
include GLibTestUtils
|
19
19
|
|
20
|
-
setup do
|
21
|
-
only_glib_version(2, 30, 0)
|
22
|
-
end
|
23
|
-
|
24
20
|
def test_enum_match_flags
|
25
21
|
assert_const_defined(GLib, :RegexMatchFlags)
|
26
22
|
assert_kind_of(GLib::RegexMatchFlags, GLib::RegexMatchFlags::PARTIAL_HARD)
|
data/test/test-source.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2013-
|
3
|
+
# Copyright (C) 2013-2021 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
|
@@ -32,15 +32,6 @@ class TestGLibSource < Test::Unit::TestCase
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_destroy
|
35
|
-
# only_glib_version(2, 35, 4)
|
36
|
-
# GMainContext may be freed before GSource by Ruby's GC.
|
37
|
-
# If GMainContext is freed before GSource, GLib 2.35.3 or earlier is
|
38
|
-
# crashed.
|
39
|
-
#
|
40
|
-
# See also:
|
41
|
-
# * https://bugzilla.gnome.org/show_bug.cgi?id=661767
|
42
|
-
# * https://git.gnome.org/browse/glib/commit/?id=26056558be4656ee6e891a4fae5d4198de7519cf
|
43
|
-
|
44
35
|
context = GLib::MainContext.new
|
45
36
|
source = GLib::Idle.source_new
|
46
37
|
id = source.attach(context)
|
@@ -52,8 +43,6 @@ class TestGLibSource < Test::Unit::TestCase
|
|
52
43
|
end
|
53
44
|
|
54
45
|
def test_name
|
55
|
-
only_glib_version(2, 26, 0)
|
56
|
-
|
57
46
|
source = GLib::Idle.source_new
|
58
47
|
|
59
48
|
source_name = "glib source"
|
@@ -62,8 +51,6 @@ class TestGLibSource < Test::Unit::TestCase
|
|
62
51
|
end
|
63
52
|
|
64
53
|
def test_ready_time
|
65
|
-
only_glib_version(2, 36, 0)
|
66
|
-
|
67
54
|
source = GLib::Idle.source_new
|
68
55
|
|
69
56
|
ready_time = 5
|
data/test/test-spawn.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-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
|
@@ -34,6 +34,9 @@ class TestGLibSpawn < Test::Unit::TestCase
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_async_clear_environment
|
37
|
+
only_not_windows
|
38
|
+
only_not_scl
|
39
|
+
|
37
40
|
if RbConfig.respond_to?(:ruby)
|
38
41
|
ruby = RbConfig.ruby
|
39
42
|
else
|
data/test/test-time-zone.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2016-
|
1
|
+
# Copyright (C) 2016-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,10 +17,6 @@
|
|
17
17
|
class TestTimeZone < Test::Unit::TestCase
|
18
18
|
include GLibTestUtils
|
19
19
|
|
20
|
-
setup do
|
21
|
-
only_glib_version(2, 34, 0)
|
22
|
-
end
|
23
|
-
|
24
20
|
sub_test_case "new" do
|
25
21
|
test "local" do
|
26
22
|
local_1 = GLib::TimeZone.local
|
data/test/test-timeout.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Ruby-
|
1
|
+
# Copyright (C) 2015-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
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# You should have received a copy of the GNU Lesser General Public
|
14
14
|
# License along with this library; if not, write to the Free Software
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
-
|
16
|
+
|
17
17
|
class TestGLibTimeout < Test::Unit::TestCase
|
18
18
|
include GLibTestUtils
|
19
19
|
|
@@ -33,7 +33,6 @@ class TestGLibTimeout < Test::Unit::TestCase
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_timeout_add_seconds_priority
|
36
|
-
only_glib_version(2, 14, 0)
|
37
36
|
priority = GLib::PRIORITY_HIGH
|
38
37
|
@id = GLib::Timeout.add_seconds(10, priority)
|
39
38
|
source = GLib::MainContext.default.find_source(@id)
|
data/test/test-unicode.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Ruby-
|
1
|
+
# Copyright (C) 2015-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
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# You should have received a copy of the GNU Lesser General Public
|
14
14
|
# License along with this library; if not, write to the Free Software
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
-
|
16
|
+
|
17
17
|
class TestGLibUnicode < Test::Unit::TestCase
|
18
18
|
include GLibTestUtils
|
19
19
|
|
@@ -113,7 +113,6 @@ class TestGLibUnicode < Test::Unit::TestCase
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def test_unichar_wide_cjk?
|
116
|
-
only_glib_version(2, 12, 0)
|
117
116
|
assert(GLib::UniChar.wide_cjk?(unichar("あ")))
|
118
117
|
assert(GLib::UniChar.wide_cjk?(0xD55C)) # HANGUL SYLLABLE HAN
|
119
118
|
assert(!GLib::UniChar.wide_cjk?(unichar("a")))
|
@@ -176,17 +175,28 @@ class TestGLibUnicode < Test::Unit::TestCase
|
|
176
175
|
GLib::Unicode.canonical_ordering(utf8_to_utf32(original)))
|
177
176
|
end
|
178
177
|
|
179
|
-
def
|
178
|
+
def test_unichar_compose
|
179
|
+
a_with_acute = 0x00E1
|
180
|
+
assert_equal(a_with_acute,
|
181
|
+
GLib::UniChar.compose(unichar("a"), 0x0301))
|
182
|
+
|
183
|
+
hiragana_ga = 0x304C
|
184
|
+
hiragana_ka = 0x304B
|
185
|
+
assert_equal(hiragana_ga,
|
186
|
+
GLib::UniChar.compose(hiragana_ka, 0x3099))
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_unichar_decompose
|
180
190
|
a_with_acute = 0x00E1
|
181
191
|
expected = [unichar("a"), 0x0301].pack("U*")
|
182
192
|
assert_equal(utf8_to_utf32(expected),
|
183
|
-
GLib::
|
193
|
+
GLib::UniChar.decompose(a_with_acute))
|
184
194
|
|
185
195
|
hiragana_ga = 0x304C
|
186
196
|
hiragana_ka = 0x304B
|
187
197
|
expected = [hiragana_ka, 0x3099].pack("U*")
|
188
198
|
assert_equal(utf8_to_utf32(expected),
|
189
|
-
GLib::
|
199
|
+
GLib::UniChar.decompose(hiragana_ga))
|
190
200
|
end
|
191
201
|
|
192
202
|
def test_unichar_get_mirror_char
|
@@ -196,7 +206,6 @@ class TestGLibUnicode < Test::Unit::TestCase
|
|
196
206
|
end
|
197
207
|
|
198
208
|
def test_unichar_get_script
|
199
|
-
only_glib_version(2, 14, 0)
|
200
209
|
assert_equal(GLib::Unicode::SCRIPT_HIRAGANA,
|
201
210
|
GLib::UniChar.get_script(unichar("あ")))
|
202
211
|
end
|
@@ -261,14 +270,12 @@ class TestGLibUnicode < Test::Unit::TestCase
|
|
261
270
|
end
|
262
271
|
|
263
272
|
def test_utf8_collate
|
264
|
-
only_glib_version(2, 16, 0)
|
265
273
|
assert_operator(0, :>, GLib::UTF8.collate("あ", "い"))
|
266
274
|
assert_operator(0, :<, GLib::UTF8.collate("い", "あ"))
|
267
275
|
assert_equal(0, GLib::UTF8.collate("あ", "あ"))
|
268
276
|
end
|
269
277
|
|
270
278
|
def test_utf8_collate_key
|
271
|
-
only_glib_version(2, 16, 0)
|
272
279
|
assert_operator(0, :>,
|
273
280
|
GLib::UTF8.collate_key("あ") <=>
|
274
281
|
GLib::UTF8.collate_key("い"))
|
@@ -340,20 +347,17 @@ class TestGLibUnicode < Test::Unit::TestCase
|
|
340
347
|
end
|
341
348
|
|
342
349
|
def test_unichar_combining_class
|
343
|
-
only_glib_version(2, 14, 0)
|
344
350
|
assert_equal(0, GLib::UniChar.combining_class(unichar("a")))
|
345
351
|
assert_equal(230, GLib::UniChar.combining_class(unichar("́")))
|
346
352
|
end
|
347
353
|
|
348
354
|
def test_unichar_mark?
|
349
|
-
only_glib_version(2, 14, 0)
|
350
355
|
assert(!GLib::UniChar.mark?(unichar("a")))
|
351
356
|
assert(!GLib::UniChar.mark?(0x200E)) # LEFT-TO-RIGHT MARK
|
352
357
|
assert(GLib::UniChar.mark?(0x1DC3)) # COMBINING SUSPENSION MARK
|
353
358
|
end
|
354
359
|
|
355
360
|
def test_unichar_zero_width?
|
356
|
-
only_glib_version(2, 14, 0)
|
357
361
|
assert(!GLib::UniChar.zero_width?(unichar("a")))
|
358
362
|
assert(GLib::UniChar.zero_width?(0x200B)) # ZERO WIDTH SPACE
|
359
363
|
end
|
data/test/test-utils.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Ruby-
|
1
|
+
# Copyright (C) 2015-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
|
@@ -13,37 +13,31 @@
|
|
13
13
|
# You should have received a copy of the GNU Lesser General Public
|
14
14
|
# License along with this library; if not, write to the Free Software
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
-
|
16
|
+
|
17
17
|
class TestGLibUtils < Test::Unit::TestCase
|
18
18
|
include GLibTestUtils
|
19
19
|
|
20
20
|
def test_user_cache_dir
|
21
|
-
only_glib_version(2, 6, 0)
|
22
21
|
assert_kind_of(String, GLib.user_cache_dir)
|
23
22
|
end
|
24
23
|
|
25
24
|
def test_user_data_dir
|
26
|
-
only_glib_version(2, 6, 0)
|
27
25
|
assert_kind_of(String, GLib.user_data_dir)
|
28
26
|
end
|
29
27
|
|
30
28
|
def test_user_config_dir
|
31
|
-
only_glib_version(2, 6, 0)
|
32
29
|
assert_kind_of(String, GLib.user_config_dir)
|
33
30
|
end
|
34
31
|
|
35
32
|
def test_system_data_dirs
|
36
|
-
only_glib_version(2, 6, 0)
|
37
33
|
assert_kind_of(Array, GLib.system_data_dirs)
|
38
34
|
end
|
39
35
|
|
40
36
|
def test_system_config_dirs
|
41
|
-
only_glib_version(2, 6, 0)
|
42
37
|
assert_kind_of(Array, GLib.system_config_dirs)
|
43
38
|
end
|
44
39
|
|
45
40
|
def test_get_user_special_dir
|
46
|
-
only_glib_version(2, 14, 0)
|
47
41
|
assert_nothing_raised do
|
48
42
|
GLib.get_user_special_dir(GLib::UserDirectory::DESKTOP)
|
49
43
|
end
|
data/test/test-variant-type.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Ruby-
|
1
|
+
# Copyright (C) 2015-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
|
@@ -111,7 +111,6 @@ class TestGLibVariantType < Test::Unit::TestCase
|
|
111
111
|
end
|
112
112
|
|
113
113
|
test "OBJECT_PATH_ARRAY" do
|
114
|
-
only_glib_version(2, 30, 0)
|
115
114
|
assert_equal("ao", GLib::VariantType::OBJECT_PATH_ARRAY.to_s)
|
116
115
|
end
|
117
116
|
|
@@ -124,7 +123,6 @@ class TestGLibVariantType < Test::Unit::TestCase
|
|
124
123
|
end
|
125
124
|
|
126
125
|
test "VARDICT" do
|
127
|
-
only_glib_version(2, 30, 0)
|
128
126
|
assert_equal("a{sv}", GLib::VariantType::VARDICT.to_s)
|
129
127
|
end
|
130
128
|
end
|
data/test/test-win32.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Ruby-
|
1
|
+
# Copyright (C) 2015-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
|
@@ -13,15 +13,15 @@
|
|
13
13
|
# You should have received a copy of the GNU Lesser General Public
|
14
14
|
# License along with this library; if not, write to the Free Software
|
15
15
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
-
|
16
|
+
|
17
17
|
class TestGLibWin32 < Test::Unit::TestCase
|
18
18
|
include GLibTestUtils
|
19
19
|
|
20
20
|
def test_get_package_install_directory_of_module
|
21
|
-
|
22
|
-
only_glib_version(2, 16, 0)
|
21
|
+
only_windows
|
23
22
|
|
24
|
-
|
25
|
-
|
23
|
+
expected = Pathname(RbConfig.ruby).parent.parent.to_s
|
24
|
+
actual = GLib::Win32.get_package_installation_directory_of_module
|
25
|
+
assert_equal(expected, normalize_path(actual))
|
26
26
|
end
|
27
27
|
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.
|
4
|
+
version: 3.5.1
|
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:
|
11
|
+
date: 2022-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pkg-config
|
@@ -65,6 +65,8 @@ 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
|
68
70
|
- ext/glib2/glib2.def
|
69
71
|
- ext/glib2/rbgcompat.h
|
70
72
|
- ext/glib2/rbglib-bytes.c
|
@@ -128,7 +130,6 @@ files:
|
|
128
130
|
- ext/glib2/rbgobj_typemodule.c
|
129
131
|
- ext/glib2/rbgobj_typeplugin.c
|
130
132
|
- ext/glib2/rbgobj_value.c
|
131
|
-
- ext/glib2/rbgobj_valuearray.c
|
132
133
|
- ext/glib2/rbgobj_valuetypes.c
|
133
134
|
- ext/glib2/rbgobject.c
|
134
135
|
- ext/glib2/rbgobject.h
|
@@ -170,13 +171,13 @@ files:
|
|
170
171
|
- sample/type-register.rb
|
171
172
|
- sample/type-register2.rb
|
172
173
|
- sample/utils.rb
|
173
|
-
- test/glib-test-init.rb
|
174
174
|
- test/glib-test-utils.rb
|
175
175
|
- test/run-test.rb
|
176
176
|
- test/test-binding.rb
|
177
177
|
- test/test-bytes.rb
|
178
178
|
- test/test-date-time.rb
|
179
179
|
- test/test-enum.rb
|
180
|
+
- test/test-error.rb
|
180
181
|
- test/test-file-utils.rb
|
181
182
|
- test/test-flags.rb
|
182
183
|
- test/test-glib2.rb
|
@@ -221,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
222
|
- !ruby/object:Gem::Version
|
222
223
|
version: '0'
|
223
224
|
requirements: []
|
224
|
-
rubygems_version: 3.
|
225
|
+
rubygems_version: 3.4.0.dev
|
225
226
|
signing_key:
|
226
227
|
specification_version: 4
|
227
228
|
summary: Ruby/GLib2 is a Ruby binding of GLib-2.x.
|
@@ -1,100 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011-2019 Ruby-GNOME Project Team
|
4
|
-
* Copyright (C) 2006 Sjoerd Simons
|
5
|
-
*
|
6
|
-
* This library is free software; you can redistribute it and/or
|
7
|
-
* modify it under the terms of the GNU Lesser General Public
|
8
|
-
* License as published by the Free Software Foundation; either
|
9
|
-
* version 2.1 of the License, or (at your option) any later version.
|
10
|
-
*
|
11
|
-
* This library is distributed in the hope that it will be useful,
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
* Lesser General Public License for more details.
|
15
|
-
*
|
16
|
-
* You should have received a copy of the GNU Lesser General Public
|
17
|
-
* License along with this library; if not, write to the Free Software
|
18
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
-
* MA 02110-1301 USA
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include "rbgprivate.h"
|
23
|
-
|
24
|
-
static VALUE
|
25
|
-
value_array_to_ruby(const GValue *from)
|
26
|
-
{
|
27
|
-
VALUE ary;
|
28
|
-
guint i;
|
29
|
-
|
30
|
-
GValueArray *array = (GValueArray *)g_value_get_boxed(from);
|
31
|
-
if (array == NULL)
|
32
|
-
return Qnil;
|
33
|
-
|
34
|
-
ary = rb_ary_new();
|
35
|
-
for (i = 0; i < array->n_values; i++)
|
36
|
-
rb_ary_push(ary, GVAL2RVAL(g_value_array_get_nth(array, i)));
|
37
|
-
|
38
|
-
return ary;
|
39
|
-
}
|
40
|
-
|
41
|
-
struct value_array_from_ruby_args {
|
42
|
-
VALUE ary;
|
43
|
-
long n;
|
44
|
-
GValueArray *result;
|
45
|
-
};
|
46
|
-
|
47
|
-
static VALUE
|
48
|
-
value_array_from_ruby_body(VALUE value)
|
49
|
-
{
|
50
|
-
long i;
|
51
|
-
struct value_array_from_ruby_args *args = (struct value_array_from_ruby_args *)value;
|
52
|
-
|
53
|
-
for (i = 0; i < args->n; i++) {
|
54
|
-
GValue v = G_VALUE_INIT;
|
55
|
-
|
56
|
-
g_value_init(&v, RVAL2GTYPE(RARRAY_PTR(args->ary)[i]));
|
57
|
-
rbgobj_rvalue_to_gvalue(RARRAY_PTR(args->ary)[i], &v);
|
58
|
-
|
59
|
-
g_value_array_append(args->result, &v);
|
60
|
-
}
|
61
|
-
|
62
|
-
return Qnil;
|
63
|
-
}
|
64
|
-
|
65
|
-
static G_GNUC_NORETURN VALUE
|
66
|
-
value_array_from_ruby_rescue(VALUE value, VALUE error)
|
67
|
-
{
|
68
|
-
g_value_array_free(((struct value_array_from_ruby_args *)value)->result);
|
69
|
-
|
70
|
-
rb_exc_raise(error);
|
71
|
-
}
|
72
|
-
|
73
|
-
static void
|
74
|
-
value_array_from_ruby(const VALUE from, GValue *to)
|
75
|
-
{
|
76
|
-
struct value_array_from_ruby_args args;
|
77
|
-
|
78
|
-
if (NIL_P(from)) {
|
79
|
-
g_value_set_boxed(to, NULL);
|
80
|
-
|
81
|
-
return;
|
82
|
-
}
|
83
|
-
|
84
|
-
args.ary = rb_ary_to_ary(from);
|
85
|
-
args.n = RARRAY_LEN(args.ary);
|
86
|
-
args.result = g_value_array_new((guint)args.n);
|
87
|
-
|
88
|
-
rb_rescue(value_array_from_ruby_body, (VALUE)&args,
|
89
|
-
value_array_from_ruby_rescue, (VALUE)&args);
|
90
|
-
|
91
|
-
g_value_set_boxed(to, args.result);
|
92
|
-
}
|
93
|
-
|
94
|
-
void
|
95
|
-
Init_gobject_value_array(void)
|
96
|
-
{
|
97
|
-
/* ValueArray is treated as Array */
|
98
|
-
rbgobj_register_g2r_func(G_TYPE_VALUE_ARRAY, value_array_to_ruby);
|
99
|
-
rbgobj_register_r2g_func(G_TYPE_VALUE_ARRAY, value_array_from_ruby);
|
100
|
-
}
|