gio2 3.3.3 → 3.3.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.
- checksums.yaml +4 -4
- data/gio2.gemspec +2 -2
- data/lib/gio2/file.rb +14 -1
- data/lib/gio2/icon.rb +24 -0
- data/lib/gio2/input-stream.rb +14 -1
- data/lib/gio2/loader.rb +14 -2
- data/test/gio2-test-utils.rb +2 -1
- data/test/test-file.rb +42 -2
- data/test/test-icon.rb +49 -0
- data/test/test-input-stream.rb +40 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 741721a2dcc24884a3725014dd3a535b3077d61447cf767397fcc2f6d4a4b618
|
4
|
+
data.tar.gz: cd78753af48448bbd53f7bf989d17464e8811d6bb1b298bdfc584cef5a9ff8c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e875d0b677d3431bac3ea260a64a8201bc273af30125d6c335fa09cf4252a76fe82fee50d1f7c4fc26bb220a2ef309ef287621a3da53a7042af7a911c8a7b196
|
7
|
+
data.tar.gz: 817a30eba075643064204eb73da2cd14ce4c67932949eb010d9c279a3fc4459be01f6edadc900bcee4b5426c393976647bc4d2993d0bfccb84816587b9ed0512
|
data/gio2.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
#
|
3
|
-
# Copyright (C) 2018 Ruby-
|
3
|
+
# Copyright (C) 2018 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
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.description =
|
25
25
|
"Ruby/GIO2 provide Ruby binding to a VFS API and useful APIs " +
|
26
26
|
"for desktop applications (such as networking and D-Bus support)."
|
27
|
-
s.author = "The Ruby-
|
27
|
+
s.author = "The Ruby-GNOME Project Team"
|
28
28
|
s.email = "ruby-gnome2-devel-en@lists.sourceforge.net"
|
29
29
|
s.homepage = "https://ruby-gnome2.osdn.jp/"
|
30
30
|
s.licenses = ["LGPL-2.1+"]
|
data/lib/gio2/file.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2016-
|
1
|
+
# Copyright (C) 2016-2019 Ruby-GNOME2 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,7 @@ module Gio
|
|
30
30
|
file = new_for_commandline_arg(arg)
|
31
31
|
end
|
32
32
|
elsif path
|
33
|
+
path = path.to_path if path.respond_to?(:to_path)
|
33
34
|
file = new_for_path(path)
|
34
35
|
elsif uri
|
35
36
|
file = new_for_uri(uri)
|
@@ -45,5 +46,17 @@ module Gio
|
|
45
46
|
end
|
46
47
|
end
|
47
48
|
end
|
49
|
+
|
50
|
+
alias_method :read_raw, :read
|
51
|
+
def read(cancellable=nil)
|
52
|
+
input_stream = read_raw(cancellable)
|
53
|
+
return input_stream unless block_given?
|
54
|
+
|
55
|
+
begin
|
56
|
+
yield(input_stream)
|
57
|
+
ensure
|
58
|
+
input_stream.close unless input_stream.closed?
|
59
|
+
end
|
60
|
+
end
|
48
61
|
end
|
49
62
|
end
|
data/lib/gio2/icon.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Copyright (C) 2019 Ruby-GNOME Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
module Gio
|
18
|
+
module Icon
|
19
|
+
def eql?(other)
|
20
|
+
other.is_a?(self.class) and
|
21
|
+
hash == other.hash
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/gio2/input-stream.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2014-2019 Ruby-GNOME2 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
|
@@ -16,6 +16,19 @@
|
|
16
16
|
|
17
17
|
module Gio
|
18
18
|
class InputStream
|
19
|
+
class << self
|
20
|
+
def open(*arguments)
|
21
|
+
input_stream = new(*arguments)
|
22
|
+
return input_stream unless block_given?
|
23
|
+
|
24
|
+
begin
|
25
|
+
yield(input_stream)
|
26
|
+
ensure
|
27
|
+
input_stream.close unless input_stream.closed?
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
19
32
|
alias_method :read_raw, :read
|
20
33
|
def read(size=nil)
|
21
34
|
if size.nil?
|
data/lib/gio2/loader.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013-
|
1
|
+
# Copyright (C) 2013-2019 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
|
@@ -51,6 +51,7 @@ module Gio
|
|
51
51
|
require "gio2/application-command-line"
|
52
52
|
require "gio2/content-type"
|
53
53
|
require "gio2/file"
|
54
|
+
require "gio2/icon"
|
54
55
|
require "gio2/inet-address"
|
55
56
|
require "gio2/input-stream"
|
56
57
|
require "gio2/menu-item"
|
@@ -113,7 +114,7 @@ module Gio
|
|
113
114
|
when /\Adbus_/
|
114
115
|
name = rubyish_method_name(info, :prefix => "dbus_")
|
115
116
|
define_singleton_method(@dbus_module, name, info)
|
116
|
-
when /\
|
117
|
+
when /\A{file,icon}_/
|
117
118
|
# Ignore because they are defined by load_interface_info
|
118
119
|
else
|
119
120
|
super
|
@@ -171,6 +172,17 @@ module Gio
|
|
171
172
|
end
|
172
173
|
end
|
173
174
|
|
175
|
+
def load_function_info_singleton_method(info, klass, method_name)
|
176
|
+
case "#{klass.name}##{method_name}"
|
177
|
+
when "Gio::Icon#hash"
|
178
|
+
define_method(info, klass, method_name)
|
179
|
+
when "Gio::Icon#new_for_string"
|
180
|
+
super(info, klass, "find")
|
181
|
+
else
|
182
|
+
super
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
174
186
|
def rubyish_class_name(info)
|
175
187
|
case info.name
|
176
188
|
when /Enum\z/
|
data/test/gio2-test-utils.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2013-2019 Ruby-GNOME2 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
|
@@ -16,6 +16,7 @@
|
|
16
16
|
|
17
17
|
require "test-unit"
|
18
18
|
|
19
|
+
require "pathname"
|
19
20
|
require "tempfile"
|
20
21
|
|
21
22
|
require "gio2-test-utils/fixture"
|
data/test/test-file.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014-
|
1
|
+
# Copyright (C) 2014-2019 Ruby-GNOME2 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
|
@@ -18,7 +18,33 @@ class TestFile < Test::Unit::TestCase
|
|
18
18
|
include GioTestUtils::Fixture
|
19
19
|
include GioTestUtils::Omissions
|
20
20
|
|
21
|
-
|
21
|
+
sub_test_case(".open") do
|
22
|
+
sub_test_case(":path") do
|
23
|
+
def test_string
|
24
|
+
path = __FILE__
|
25
|
+
Gio::File.open(path: path) do |file|
|
26
|
+
file.read do |input|
|
27
|
+
assert_equal(File.read(__FILE__), input.read)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_pathname
|
33
|
+
path = Pathname(__FILE__)
|
34
|
+
Gio::File.open(path: path) do |file|
|
35
|
+
file.read do |input|
|
36
|
+
assert_equal(File.read(__FILE__), input.read)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
sub_test_case("instance methods") do
|
44
|
+
def setup
|
45
|
+
@file = Gio::File.open(path: __FILE__)
|
46
|
+
end
|
47
|
+
|
22
48
|
def test_guess_content_type
|
23
49
|
omit_on_os_x
|
24
50
|
path = fixture_path("content-type", "x-content", "unix-software")
|
@@ -26,5 +52,19 @@ class TestFile < Test::Unit::TestCase
|
|
26
52
|
assert_equal(["x-content/unix-software"],
|
27
53
|
dir.guess_content_types.collect(&:to_s))
|
28
54
|
end
|
55
|
+
|
56
|
+
sub_test_case("#read") do
|
57
|
+
def test_no_block
|
58
|
+
input_stream = @file.read
|
59
|
+
assert_equal(File.read(__FILE__), input_stream.read)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_with_block
|
63
|
+
content = @file.read do |input_stream|
|
64
|
+
input_stream.read
|
65
|
+
end
|
66
|
+
assert_equal(File.read(__FILE__), content)
|
67
|
+
end
|
68
|
+
end
|
29
69
|
end
|
30
70
|
end
|
data/test/test-icon.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Copyright (C) 2019 Ruby-GNOME Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class TestIcon < Test::Unit::TestCase
|
18
|
+
include GioTestUtils::Fixture
|
19
|
+
include GioTestUtils::Omissions
|
20
|
+
|
21
|
+
sub_test_case(".find") do
|
22
|
+
def test_found
|
23
|
+
assert_equal(Gio::ThemedIcon.new("open"),
|
24
|
+
Gio::Icon.find("open"))
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_not_found
|
28
|
+
Gio::Icon.find("nonexistent")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
sub_test_case(".hash") do
|
33
|
+
def test_use_as_key
|
34
|
+
hash = {Gio::Icon => true}
|
35
|
+
assert do
|
36
|
+
hash[Gio::Icon]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
sub_test_case("#hash") do
|
42
|
+
def test_use_as_key
|
43
|
+
hash = {Gio::Icon.find("open") => true}
|
44
|
+
assert do
|
45
|
+
hash[Gio::Icon.find("open")]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/test/test-input-stream.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2014-2019 Ruby-GNOME2 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,6 +26,45 @@ class TestInputStream < Test::Unit::TestCase
|
|
26
26
|
teardown_socket_client
|
27
27
|
end
|
28
28
|
|
29
|
+
sub_test_case(".open") do
|
30
|
+
def setup
|
31
|
+
super
|
32
|
+
@data = "Hello\n"
|
33
|
+
client = @server.accept
|
34
|
+
client.write(@data)
|
35
|
+
client.flush
|
36
|
+
client.close
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_no_block
|
40
|
+
input = Gio::BufferedInputStream.open(@stream)
|
41
|
+
assert_equal(@data[0, 4], input.read(4))
|
42
|
+
input.close
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_block
|
46
|
+
input = nil
|
47
|
+
read_data = Gio::BufferedInputStream.open(@stream) do |i|
|
48
|
+
input = i
|
49
|
+
input.read(4)
|
50
|
+
end
|
51
|
+
assert_equal([@data[0, 4], true],
|
52
|
+
[read_data, input.closed?])
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_block_closed
|
56
|
+
input = nil
|
57
|
+
read_data = Gio::BufferedInputStream.open(@stream) do |i|
|
58
|
+
input = i
|
59
|
+
_data = input.read(4)
|
60
|
+
input.close
|
61
|
+
_data
|
62
|
+
end
|
63
|
+
assert_equal([@data[0, 4], true],
|
64
|
+
[read_data, input.closed?])
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
29
68
|
sub_test_case("#read") do
|
30
69
|
def test_with_size
|
31
70
|
data = "Hello\n"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gio2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- The Ruby-
|
7
|
+
- The Ruby-GNOME Project Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gobject-introspection
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.3.
|
19
|
+
version: 3.3.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.3.
|
26
|
+
version: 3.3.8
|
27
27
|
description: Ruby/GIO2 provide Ruby binding to a VFS API and useful APIs for desktop
|
28
28
|
applications (such as networking and D-Bus support).
|
29
29
|
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- lib/gio2/content-type.rb
|
51
51
|
- lib/gio2/deprecated.rb
|
52
52
|
- lib/gio2/file.rb
|
53
|
+
- lib/gio2/icon.rb
|
53
54
|
- lib/gio2/inet-address.rb
|
54
55
|
- lib/gio2/input-stream.rb
|
55
56
|
- lib/gio2/loader.rb
|
@@ -82,6 +83,7 @@ files:
|
|
82
83
|
- test/test-file-enumerator.rb
|
83
84
|
- test/test-file-monitor.rb
|
84
85
|
- test/test-file.rb
|
86
|
+
- test/test-icon.rb
|
85
87
|
- test/test-inet-address.rb
|
86
88
|
- test/test-input-stream.rb
|
87
89
|
- test/test-memory-input-stream.rb
|