gtk4 4.3.0 → 4.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e445adab7c4bcd0886ee873496d272f57997094a74dc88063c7f994f53a8eb8b
4
- data.tar.gz: 7201c4544addc0d79e149ffc91b5c37c4a56414166b82b80a8f33ac6f8778c38
3
+ metadata.gz: 838a276243d9f6bc498f5c937019071b08665fa803d7408fce708168321a3aa5
4
+ data.tar.gz: 76ffb0a798252613e79235cd66dbd0578bfa4912fac3412aa9e6c1e42ba5ce3e
5
5
  SHA512:
6
- metadata.gz: ac0b21520ad2d1c4e282841a7adea57b39dc9f81fd95595d91a9f811dd83c46b3e8ea0536b774472a9c2c5d15b011846a96f1febc9936d92b405b628019bca2f
7
- data.tar.gz: bb691d2ac8a8d673c5ad10c98b60ec4b7d95bb6f5fda6f0b3a871ca1703ffa669add253d8c1566e6cd36a8f6eb1a45cb8a9185efeb9cc22595f5db2af18338f1
6
+ metadata.gz: 5edeab3e46e8cd81c545dcf1c99f3d1788a6c0a3bc21246c095e971e09b5e94c1c4d8d95d5a7378d2f6154c3df0e2684b973cab9c5c2fe1bb8a9d7dd6d3cad39
7
+ data.tar.gz: 75485b2b4317c06d01151f439b764fbfd2659a236d604f1671c5a425cec4595067f7a3b74d75660c4a7991af1907bf215290a3e139bf4503bfa5cbc57a0f324b
data/README.md CHANGED
@@ -4,15 +4,17 @@ Ruby/GTK4 is a Ruby binding of GTK 4.
4
4
 
5
5
  ## Requirements
6
6
 
7
- * Ruby/GLib2, Ruby/ATK, Ruby/Pango, Ruby/GdkPixbuf2, Ruby/GIO2,
8
- Ruby/GDK4, Ruby/GObjectIntrospection and Ruby/GTK4 in
7
+ * Ruby/GLib2, Ruby/GObjectIntrospection, Ruby/ATK, Ruby/Pango, Ruby/GdkPixbuf2,
8
+ Ruby/GIO2, Ruby/GDK4, Ruby/Graphene and Ruby/GSK4 in
9
9
  [Ruby-GNOME2](https://ruby-gnome.github.io/)
10
10
  * [rcairo](https://github.com/rcairo/rcairo)
11
11
  * [GTK](https://www.gtk.org/)
12
12
 
13
13
  ## Install
14
14
 
15
- gem install gtk4
15
+ ```bash
16
+ gem install gtk4
17
+ ```
16
18
 
17
19
  ## Tutorials, examples:
18
20
 
@@ -20,12 +22,12 @@ Ruby/GTK4 is a Ruby binding of GTK 4.
20
22
 
21
23
  ## License
22
24
 
23
- Copyright (C) 2002-2024 Ruby-GNOME Project Team
25
+ Copyright (C) 2002-2025 Ruby-GNOME Project Team
24
26
 
25
27
  This program is free software. You can distribute/modify this program
26
- under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
28
+ under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
29
+ or later.
27
30
 
28
31
  ## Project Websites
29
32
 
30
- * https://github.com/ruby-gnome/ruby-gnome
31
33
  * https://ruby-gnome.github.io/
data/gtk4.gemspec CHANGED
@@ -51,4 +51,5 @@ Gem::Specification.new do |s|
51
51
 
52
52
  s.add_runtime_dependency("atk", "= #{s.version}")
53
53
  s.add_runtime_dependency("gdk4", "= #{s.version}")
54
+ s.add_runtime_dependency("gsk4", "= #{s.version}")
54
55
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2011-2022 Ruby-GNOME Project Team
1
+ # Copyright (C) 2011-2025 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
@@ -619,7 +619,8 @@ module Gtk
619
619
  define_deprecated_method :set, warn: message
620
620
  define_deprecated_method_by_hash_args :initialize,
621
621
  'image',
622
- 'icon_name: nil, icon: nil, file: nil, pixbuf: nil' do
622
+ 'icon_name: nil, icon: nil, file: nil, pixbuf: nil, resource: nil, ' +
623
+ 'paintable: nil' do
623
624
  |_self, image|
624
625
  case image
625
626
  when String
@@ -631,9 +632,11 @@ module Gtk
631
632
  when Symbol
632
633
  [{icon_name: image}]
633
634
  when GdkPixbuf::Pixbuf
634
- [{:pixbuf => image}]
635
+ [{pixbuf: image}]
635
636
  when Gio::Icon
636
637
  [{icon: image}]
638
+ when Gdk::Paintable
639
+ [{paintable: paintable}]
637
640
  else
638
641
  message =
639
642
  "Image must be String, Symbol, GdkPixbuf::Pixbuf or " +
data/lib/gtk4/image.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014-2022 Ruby-GNOME Project Team
1
+ # Copyright (C) 2014-2025 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,7 +20,7 @@ module Gtk
20
20
  # Creates a Gtk::Image. The source of the image depends on the options
21
21
  # given.
22
22
  #
23
- # @param Hash{Symbol => String, Gio::Icon, GdkPixbuf::Pixbuf}
23
+ # @param Hash{Symbol => String, Gio::Icon, GdkPixbuf::Pixbuf, Gdk::Paintable}
24
24
  #
25
25
  # @example Create an empty image.
26
26
  # image = Gtk::Image.new
@@ -49,12 +49,19 @@ module Gtk
49
49
  # Gio::Resources.register(resource)
50
50
  # resource_path = "/path/to/image.png"
51
51
  # image = Gtk::Image.new(resource: resource_path)
52
+ #
53
+ # @example Create an image from a paintable
54
+ # Gio::File.open(path: "my.png") do |file|
55
+ # texture = Gdk::Texture.new(file)
56
+ # image = Gtk::Image.new(paintable: texture)
57
+ # end
52
58
  def initialize(options={})
53
59
  icon_name = options[:icon_name] || nil
54
60
  icon = options[:icon] || options[:gicon] || nil
55
61
  file = options[:file] || nil
56
62
  pixbuf = options[:pixbuf] || nil
57
63
  resource = options[:resource] || nil
64
+ paintable = options[:paintable] || nil
58
65
 
59
66
  if icon_name
60
67
  initialize_new_from_icon_name(icon_name)
@@ -66,6 +73,8 @@ module Gtk
66
73
  initialize_new_from_pixbuf(pixbuf)
67
74
  elsif resource
68
75
  initialize_new_from_resource(resource)
76
+ elsif paintable
77
+ initialize_new_from_paintable(paintable)
69
78
  else
70
79
  initialize_raw
71
80
  end
data/lib/gtk4/loader.rb CHANGED
@@ -109,8 +109,9 @@ module Gtk
109
109
  require_relative "scale-button"
110
110
  require_relative "scrolled-window"
111
111
  require_relative "search-bar"
112
- require_relative "spin-button"
113
112
  require_relative "show-uri"
113
+ require_relative "snapshot"
114
+ require_relative "spin-button"
114
115
  require_relative "stack"
115
116
  require_relative "style-context"
116
117
  require_relative "text-buffer"
@@ -0,0 +1,31 @@
1
+ # Copyright (C) 2025 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 Gtk
18
+ class Snapshot
19
+ alias_method :save_raw, :save
20
+ def save
21
+ save_raw
22
+ if block_given?
23
+ begin
24
+ yield
25
+ ensure
26
+ restore
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
data/lib/gtk4.rb CHANGED
@@ -15,6 +15,7 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  require "gdk4"
18
+ require "gsk4"
18
19
 
19
20
  require_relative "gtk4/loader"
20
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk4
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME Project Team
@@ -15,28 +15,42 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 4.3.0
18
+ version: 4.3.2
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 4.3.0
25
+ version: 4.3.2
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: gdk4
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - '='
31
31
  - !ruby/object:Gem::Version
32
- version: 4.3.0
32
+ version: 4.3.2
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 4.3.0
39
+ version: 4.3.2
40
+ - !ruby/object:Gem::Dependency
41
+ name: gsk4
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '='
45
+ - !ruby/object:Gem::Version
46
+ version: 4.3.2
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '='
52
+ - !ruby/object:Gem::Version
53
+ version: 4.3.2
40
54
  description: Ruby/GTK4 is a Ruby binding of GTK 4.x. It allows Ruby programmers to
41
55
  use the GTK graphics toolkit to make graphical user interfaces for their Ruby scripts.
42
56
  Many of the programs you use like file explorers, browsers, graphics programs etc.
@@ -105,6 +119,7 @@ files:
105
119
  - lib/gtk4/scrolled-window.rb
106
120
  - lib/gtk4/search-bar.rb
107
121
  - lib/gtk4/show-uri.rb
122
+ - lib/gtk4/snapshot.rb
108
123
  - lib/gtk4/spin-button.rb
109
124
  - lib/gtk4/stack.rb
110
125
  - lib/gtk4/style-context.rb
@@ -205,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
220
  - !ruby/object:Gem::Version
206
221
  version: '0'
207
222
  requirements: []
208
- rubygems_version: 3.6.7
223
+ rubygems_version: 3.6.9
209
224
  specification_version: 4
210
225
  summary: Ruby/GTK4 is a Ruby binding of GTK+-4.x.
211
226
  test_files: []