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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7d76c77c15034dae48d6d53fb7a36a7eaaf030b1071ae583049ac03f5978a29
4
- data.tar.gz: dd28fd52a928da045bed9da1560d3d56c9ea467077bb8828515dea8051e3e2c5
3
+ metadata.gz: 741721a2dcc24884a3725014dd3a535b3077d61447cf767397fcc2f6d4a4b618
4
+ data.tar.gz: cd78753af48448bbd53f7bf989d17464e8811d6bb1b298bdfc584cef5a9ff8c9
5
5
  SHA512:
6
- metadata.gz: 128d909432f664845139698aac832948f89cd41755bc92b9c1cc230581596d3a7902272eff6c68be15177c1a5d8bafceed2473dfbf3ad25ae039bdb82d2d4bd4
7
- data.tar.gz: 2fe97f1306e62fe78952bf832f5bf6f5a3e856235f57533120f86f6f889e14e99c00542d20ed4864dd61fd55dd9bc4caefb7281c8b1384c79d6a30ddb0df9c57
6
+ metadata.gz: e875d0b677d3431bac3ea260a64a8201bc273af30125d6c335fa09cf4252a76fe82fee50d1f7c4fc26bb220a2ef309ef287621a3da53a7042af7a911c8a7b196
7
+ data.tar.gz: 817a30eba075643064204eb73da2cd14ce4c67932949eb010d9c279a3fc4459be01f6edadc900bcee4b5426c393976647bc4d2993d0bfccb84816587b9ed0512
@@ -1,6 +1,6 @@
1
1
  # -*- ruby -*-
2
2
  #
3
- # Copyright (C) 2018 Ruby-GNOME2 Project Team
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-GNOME2 Project Team"
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+"]
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2016-2017 Ruby-GNOME2 Project Team
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
@@ -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
@@ -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?
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2016 Ruby-GNOME2 Project Team
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 /\Afile_/
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/
@@ -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"
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2017 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
@@ -18,7 +18,33 @@ class TestFile < Test::Unit::TestCase
18
18
  include GioTestUtils::Fixture
19
19
  include GioTestUtils::Omissions
20
20
 
21
- class TestContentType < self
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
@@ -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
@@ -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.3
4
+ version: 3.3.8
5
5
  platform: ruby
6
6
  authors:
7
- - The Ruby-GNOME2 Project Team
7
+ - The Ruby-GNOME Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-09 00:00:00.000000000 Z
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.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.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