gtk3 3.4.1 → 3.4.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 +4 -4
- data/README.md +2 -2
- data/lib/gtk3/widget.rb +4 -1
- data/sample/gtk-demo/README +6 -1
- data/sample/misc/aboutdialog.rb +5 -5
- data/sample/misc/aboutdialog2.rb +21 -16
- data/sample/misc/builder.rb +3 -1
- data/sample/misc/button2.rb +4 -4
- data/sample/misc/cairo-cursor.rb +3 -3
- data/sample/misc/calendar.rb +3 -7
- data/sample/misc/cursor.rb +10 -10
- data/sample/misc/dndtreeview.rb +4 -4
- data/sample/misc/drawing.rb +7 -6
- data/sample/misc/eventbox.rb +8 -6
- data/sample/misc/filechooser.rb +6 -6
- data/sample/misc/flowbox.rb +3 -3
- data/sample/misc/image.rb +10 -24
- data/sample/misc/linkbutton.rb +3 -3
- data/sample/misc/misc-button.rb +3 -4
- data/sample/misc/recentchooserdialog.rb +5 -5
- data/sample/misc/scalebutton.rb +4 -4
- data/sample/misc/stock.rb +8 -12
- data/sample/tutorial/README.md +1 -1
- data/test/gtk-test-utils.rb +1 -1
- data/test/run-test.rb +24 -13
- data/test/test-gtk-toggle-action.rb +4 -6
- data/test/test-gtk-widget.rb +15 -5
- metadata +13 -15
- data/test/fixture/image.gresource +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64d3209874a7760d9434effdb9cd647e2cb27de31e2a62b8fcb70a7039620936
|
4
|
+
data.tar.gz: 9cd0f812a686ae4a17067cf0e18b49c2b05ad95f46b9798e86b354a623454fcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90388bd55133bf5fecf33a3e27ce89bdfda80cd339924de8023d900c5f6d4f39c8739a6d34394242c0b80c6f94acd60ed7a1cb7d5bb1bb11d4cde4ea2d5c7b4a
|
7
|
+
data.tar.gz: 818c98587d78540ac1643d92c298c1af2dfb19f3f3a80eb43ed5789a56e7ec33e38bb1131e69c7914e7de46ac8f02b86f5325cfd24cc4fca6f39dde9c33f7b8d
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Ruby/GTK3 is a Ruby binding of GTK+ 3.
|
|
6
6
|
|
7
7
|
* Ruby/GLib2, Ruby/ATK, Ruby/Pango, Ruby/GdkPixbuf2, Ruby/GIO2,
|
8
8
|
Ruby/GDK3, Ruby/GObjectIntrospection and Ruby/GTK3 in
|
9
|
-
[Ruby-
|
9
|
+
[Ruby-GNOME](https://ruby-gnome2.osdn.jp/)
|
10
10
|
* [rcairo](https://github.com/rcairo/rcairo)
|
11
11
|
* [GTK+](http://www.gtk.org/) 3.4.2 or later
|
12
12
|
|
@@ -23,7 +23,7 @@ Ruby/GTK3 is a Ruby binding of GTK+ 3.
|
|
23
23
|
|
24
24
|
## License
|
25
25
|
|
26
|
-
Copyright (c) 2002-
|
26
|
+
Copyright (c) 2002-2020 Ruby-GNOME Project Team
|
27
27
|
|
28
28
|
This program is free software. You can distribute/modify this program
|
29
29
|
under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
|
data/lib/gtk3/widget.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-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
|
@@ -97,6 +97,9 @@ module Gtk
|
|
97
97
|
alias_method :style_get_property_raw, :style_get_property
|
98
98
|
def style_get_property(name)
|
99
99
|
property = self.class.find_style_property(name)
|
100
|
+
if property.nil?
|
101
|
+
raise ArgumentError, "unknown style: #{name.inspect}"
|
102
|
+
end
|
100
103
|
value = GLib::Value.new(property.value_type)
|
101
104
|
style_get_property_raw(name, value)
|
102
105
|
value.value
|
data/sample/gtk-demo/README
CHANGED
data/sample/misc/aboutdialog.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
=begin
|
3
3
|
aboutdialog.rb - Ruby/GTK sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2005-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2005-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
=end
|
8
8
|
|
9
9
|
require "gtk3"
|
@@ -17,15 +17,15 @@ a = Gtk::AboutDialog.new
|
|
17
17
|
a.artists = ["Artist 1 <no1@foo.bar.com>", "Artist 2 <no2@foo.bar.com>"]
|
18
18
|
a.authors = ["Author 1 <no1@foo.bar.com>", "Author 2 <no2@foo.bar.com>"]
|
19
19
|
a.comments = "This is a sample script for Gtk::AboutDialog"
|
20
|
-
a.copyright = "Copyright (C)
|
20
|
+
a.copyright = "Copyright (C) 2020 Ruby-GNOME Project"
|
21
21
|
a.documenters = ["Documenter 1 <no1@foo.bar.com>", "Documenter 2 <no2@foo.bar.com>"]
|
22
|
-
a.license = "This program is licenced under the same licence as Ruby-
|
22
|
+
a.license = "This program is licenced under the same licence as Ruby-GNOME."
|
23
23
|
a.logo = GdkPixbuf::Pixbuf.new(:file => File.join(__dir__, "gnome-logo-icon.png"))
|
24
24
|
a.program_name = "Gtk::AboutDialog sample"
|
25
25
|
a.translator_credits = "Translator 1\nTranslator 2\n"
|
26
26
|
a.version = "1.0.0"
|
27
27
|
a.website = "https://ruby-gnome2.osdn.jp"
|
28
|
-
a.website_label = "Ruby-
|
28
|
+
a.website_label = "Ruby-GNOME Project Website"
|
29
29
|
|
30
30
|
a.signal_connect("activate-link") do |_widget, uri|
|
31
31
|
p _widget.class
|
data/sample/misc/aboutdialog2.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
=begin
|
3
3
|
aboutdialog2.rb - Ruby/GTK sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2005-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2005-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
=end
|
8
8
|
require "gtk3"
|
9
9
|
|
@@ -12,19 +12,24 @@ unless Gtk::Version.or_later?(3, 4, 2)
|
|
12
12
|
exit
|
13
13
|
end
|
14
14
|
|
15
|
-
Gtk::AboutDialog.show(
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
15
|
+
about_dialog = Gtk::AboutDialog.show(
|
16
|
+
nil,
|
17
|
+
"artists" => ["Artist 1 <no1@foo.bar.com>", "Artist 2 <no2@foo.bar.com>"],
|
18
|
+
"authors" => ["Author 1 <no1@foo.bar.com>", "Author 2 <no2@foo.bar.com>"],
|
19
|
+
"comments" => "This is a sample script for Gtk::AboutDialog",
|
20
|
+
"copyright" => "Copyright (C) 2005-2020 Ruby-GNOME Project",
|
21
|
+
"documenters" => ["Documenter 1 <no1@foo.bar.com>", "Documenter 2 <no2@foo.bar.com>"],
|
22
|
+
"license" => "This program is licenced under the same licence as Ruby-GNOME.",
|
23
|
+
"logo_icon_name" => "gtk-home",
|
24
|
+
"program_name" => "Gtk::AboutDialog sample",
|
25
|
+
"translator_credits" => "Translator 1 <no1@foo.bar.com>\nTranslator 2 <no2@foo.bar.com>\n",
|
26
|
+
"version" => "1.0.0",
|
27
|
+
"website" => "https://ruby-gnome2.osdn.jp",
|
28
|
+
"website_label" => "Ruby-GNOME Project Website"
|
29
|
+
)
|
30
|
+
|
31
|
+
about_dialog.signal_connect('delete_event') do
|
32
|
+
Gtk.main_quit
|
33
|
+
end
|
29
34
|
|
30
35
|
Gtk.main
|
data/sample/misc/builder.rb
CHANGED
@@ -5,8 +5,10 @@
|
|
5
5
|
Copyright (c) 2015 Ruby-GNOME2 Project Team
|
6
6
|
This program is licenced under the same licence as Ruby-GNOME2.
|
7
7
|
=end
|
8
|
+
|
8
9
|
require "gtk3"
|
9
|
-
|
10
|
+
|
11
|
+
ui_file = File.expand_path("builder.ui", __dir__)
|
10
12
|
builder = Gtk::Builder.new
|
11
13
|
builder.add_from_file(ui_file)
|
12
14
|
|
data/sample/misc/button2.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
=begin
|
3
3
|
button2.rb - Ruby/GTK2 sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2002-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2002-2020 Ruby-GNOME2 Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
=end
|
8
8
|
|
9
9
|
require "gtk3"
|
@@ -12,7 +12,7 @@ window = Gtk::Window.new("Gtk::Button sample")
|
|
12
12
|
|
13
13
|
button1 = Gtk::Button.new(:mnemonic => "_HELLO")
|
14
14
|
button2 = Gtk::Button.new(:label => "_HELLO")
|
15
|
-
button3 = Gtk::Button.new(:stock_id => Gtk::Stock::QUIT)
|
15
|
+
button3 = Gtk::Button.new(:stock_id => Gtk::Stock::QUIT)
|
16
16
|
|
17
17
|
button3.signal_connect("clicked"){ Gtk.main_quit }
|
18
18
|
|
@@ -22,7 +22,7 @@ box.add(button2)
|
|
22
22
|
box.add(button3)
|
23
23
|
|
24
24
|
window.add(box)
|
25
|
-
window.set_default_size(100,100)
|
25
|
+
window.set_default_size(100, 100)
|
26
26
|
window.show_all
|
27
27
|
|
28
28
|
Gtk.main
|
data/sample/misc/cairo-cursor.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
cairo_cursor.rb Ruby/GTK3 script
|
3
3
|
Adapted from https://developer.gnome.org/gtk3/stable/ch25s02.html#id-1.6.3.4.5
|
4
|
-
Copyright (c) 2015 Ruby-
|
5
|
-
This program is licenced under the same licence as Ruby-
|
4
|
+
Copyright (c) 2015-2020 Ruby-GNOME Project Team
|
5
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
6
6
|
=end
|
7
7
|
|
8
8
|
require "gtk3"
|
@@ -20,7 +20,7 @@ cr.arc(3, 3, 3, 0, 2 * Math::PI)
|
|
20
20
|
cr.fill
|
21
21
|
cr.destroy
|
22
22
|
|
23
|
-
pixbuf = surface.to_pixbuf(0, 0, 6, 6)
|
23
|
+
pixbuf = surface.to_pixbuf(src_x: 0, src_y: 0, width: 6, heihgt: 6)
|
24
24
|
cursor = Gdk::Cursor.new(pixbuf, 0, 0)
|
25
25
|
|
26
26
|
# generate the underlaying GDK resource associated with the window widget.
|
data/sample/misc/calendar.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
calendar.rb - Gtk::Calendar sample script.
|
3
3
|
|
4
|
-
Copyright (c) 2002-
|
5
|
-
This program is licenced under the same licence as Ruby-
|
4
|
+
Copyright (c) 2002-2020 Ruby-GNOME Project Team
|
5
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
6
6
|
=end
|
7
7
|
|
8
8
|
require "gtk3"
|
@@ -21,11 +21,7 @@ date = Time.new
|
|
21
21
|
cal.select_month(date.month, date.year)
|
22
22
|
cal.select_day(date.day)
|
23
23
|
cal.mark_day(date.day)
|
24
|
-
#cal.clear_marks
|
25
|
-
|
26
|
-
#
|
27
|
-
# Gtk::CalendarDisplayOptions::WEEK_START_MONDAY does not exist anymore
|
28
|
-
#
|
24
|
+
# cal.clear_marks
|
29
25
|
|
30
26
|
cal.set_display_options(Gtk::CalendarDisplayOptions::SHOW_HEADING |
|
31
27
|
Gtk::CalendarDisplayOptions::SHOW_DAY_NAMES |
|
data/sample/misc/cursor.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
cursor.rb - Gdk::Cursor sample script.
|
3
3
|
|
4
4
|
Copyright (C) 2001-2006 Masao Mutoh
|
5
|
-
Copyright (c) 2002-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2002-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
=end
|
8
8
|
|
9
9
|
require "gtk3"
|
@@ -15,20 +15,20 @@ window.realize
|
|
15
15
|
button = Gtk::Button.new(:label => "Click!")
|
16
16
|
button.use_underline = false
|
17
17
|
|
18
|
-
cursors = Gdk::CursorType.values -
|
19
|
-
|
18
|
+
cursors = Gdk::CursorType.values -
|
19
|
+
[Gdk::CursorType::CURSOR_IS_PIXMAP] -
|
20
|
+
[Gdk::CursorType::LAST_CURSOR]
|
21
|
+
cursors = cursors.cycle
|
20
22
|
|
21
|
-
cnt = 0
|
22
23
|
button.signal_connect('clicked') do
|
23
|
-
cursor = cursors
|
24
|
-
p cursor
|
24
|
+
cursor = cursors.next
|
25
|
+
p cursor
|
25
26
|
button.set_label(cursor.inspect)
|
26
27
|
window.window.set_cursor(Gdk::Cursor.new(cursor))
|
27
|
-
cnt += 1
|
28
|
-
cnt = 0 if cnt == cursors.size
|
29
28
|
end
|
29
|
+
|
30
30
|
window.add(button)
|
31
|
-
window.set_default_size(400,100)
|
31
|
+
window.set_default_size(400, 100)
|
32
32
|
window.show_all
|
33
33
|
|
34
34
|
Gtk.main
|
data/sample/misc/dndtreeview.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
dndtreeview.rb - Drag and Drop sample script.
|
3
3
|
|
4
4
|
Copyright (C) 2003-2015 Masao Mutoh
|
5
|
-
Copyright (c) 2003-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2003-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
=end
|
8
8
|
|
9
9
|
require "gtk3"
|
@@ -27,8 +27,8 @@ class TestWindow < Gtk::Window
|
|
27
27
|
model = Gtk::ListStore.new(String, String)
|
28
28
|
view = Gtk::TreeView.new(model)
|
29
29
|
renderer = Gtk::CellRendererText.new
|
30
|
-
col1 = Gtk::TreeViewColumn.new("
|
31
|
-
col2 = Gtk::TreeViewColumn.new("
|
30
|
+
col1 = Gtk::TreeViewColumn.new("English", renderer, { :text => 0 })
|
31
|
+
col2 = Gtk::TreeViewColumn.new("Japanese", renderer, { :text => 1 })
|
32
32
|
view.append_column(col1)
|
33
33
|
view.append_column(col2)
|
34
34
|
|
data/sample/misc/drawing.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
drawing.rb - Ruby/GTK version of gtk+/examples/drawing.c.
|
3
3
|
https://git.gnome.org/browse/gtk+/tree/examples/drawing.c?h=gtk-3-16
|
4
|
-
Copyright (c) 2015 Ruby-
|
5
|
-
This program is licenced under the same licence as Ruby-
|
4
|
+
Copyright (c) 2015-2020 Ruby-GNOME Project Team
|
5
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
6
6
|
=end
|
7
7
|
|
8
8
|
require "gtk3"
|
@@ -24,7 +24,7 @@ def draw_brush(widget, surface, x, y)
|
|
24
24
|
widget.queue_draw_area(x - 3, y - 3, 6, 6)
|
25
25
|
end
|
26
26
|
|
27
|
-
myapp = Gtk::Application.new "org.gtk.example", :flags_none
|
27
|
+
myapp = Gtk::Application.new "org.gtk.example", :flags_none
|
28
28
|
|
29
29
|
myapp.signal_connect "activate" do |app|
|
30
30
|
win = Gtk::ApplicationWindow.new app
|
@@ -69,7 +69,7 @@ myapp.signal_connect "activate" do |app|
|
|
69
69
|
drawing_area.signal_connect "motion-notify-event" do |da, ev|
|
70
70
|
return false unless surface
|
71
71
|
|
72
|
-
if (
|
72
|
+
if (ev.state & Gdk::EventMask::BUTTON_PRESS_MASK.to_i) != 0
|
73
73
|
draw_brush(da, surface, ev.x, ev.y)
|
74
74
|
end
|
75
75
|
end
|
@@ -77,9 +77,10 @@ myapp.signal_connect "activate" do |app|
|
|
77
77
|
drawing_area.signal_connect "button-press-event" do |da, ev|
|
78
78
|
return false unless surface
|
79
79
|
|
80
|
-
|
80
|
+
case ev.button
|
81
|
+
when Gdk::BUTTON_PRIMARY
|
81
82
|
draw_brush(da, surface, ev.x, ev.y)
|
82
|
-
|
83
|
+
when Gdk::BUTTON_SECONDARY
|
83
84
|
clear_surface(surface)
|
84
85
|
da.queue_draw
|
85
86
|
end
|
data/sample/misc/eventbox.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
eventbox.rb - Ruby/GTK sample script.
|
3
3
|
|
4
|
-
Copyright (c) 2015 Ruby-
|
5
|
-
This program is licenced under the same licence as Ruby-
|
4
|
+
Copyright (c) 2015-2020 Ruby-GNOME Project Team
|
5
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
6
6
|
=end
|
7
7
|
|
8
8
|
# https://developer.gnome.org/gtk3/unstable/GtkEventBox.html
|
@@ -31,7 +31,9 @@ cr.set_source_rgb(0, 0, 1)
|
|
31
31
|
cr.rectangle(*r3)
|
32
32
|
cr.fill
|
33
33
|
|
34
|
-
image = Gtk::Image.new(
|
34
|
+
image = Gtk::Image.new(
|
35
|
+
pixbuf: surface.to_pixbuf(src_x: 0, src_y: 0, width: 265, height: 95)
|
36
|
+
)
|
35
37
|
|
36
38
|
event_box = Gtk::EventBox.new
|
37
39
|
|
@@ -40,11 +42,11 @@ event_box.add(image)
|
|
40
42
|
event_box.signal_connect "button-press-event" do |_widget, event|
|
41
43
|
if event.y >= 10 && event.y <= 85
|
42
44
|
if event.x >= 10 && event.x <= 85
|
43
|
-
puts "red
|
45
|
+
puts "red x = #{event.x} \t y = #{event.y}"
|
44
46
|
elsif event.x >= 95 && event.x <= 180
|
45
|
-
puts "green x = #{event.x} y = #{event.y}"
|
47
|
+
puts "green x = #{event.x} \t y = #{event.y}"
|
46
48
|
elsif event.x >= 190 && event.x <= 255
|
47
|
-
puts "blue
|
49
|
+
puts "blue x = #{event.x} \t y = #{event.y}"
|
48
50
|
end
|
49
51
|
end
|
50
52
|
end
|
data/sample/misc/filechooser.rb
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
=begin
|
3
3
|
filechooser.rb - Ruby/GTK2 sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2004-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2004-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
=end
|
8
8
|
|
9
9
|
require "gtk3"
|
10
10
|
|
11
|
-
dialog =
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
dialog = Gtk::FileChooserDialog.new(:title => "Gtk::FileChooser sample",
|
12
|
+
:action => :open,
|
13
|
+
:buttons => [[Gtk::Stock::OPEN, :accept],
|
14
|
+
[Gtk::Stock::CANCEL, :cancel]])
|
15
15
|
|
16
16
|
extra_button = Gtk::Button.new(:label => "Extra button")
|
17
17
|
extra_button.signal_connect("clicked") do
|
data/sample/misc/flowbox.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
3
|
# Copyright (c) 2014 Gian Mario Tagliaretti
|
4
|
-
# Copyright (c) 2015-
|
4
|
+
# Copyright (c) 2015-2020 Ruby-GNOME Project Team
|
5
5
|
#
|
6
6
|
# Permission is granted to copy, distribute and/or modify this document
|
7
7
|
# under the terms of the GNU Free Documentation License, Version 1.3
|
@@ -44,7 +44,7 @@ class FlowBoxWindow < Gtk::Window
|
|
44
44
|
set_titlebar(header)
|
45
45
|
|
46
46
|
scrolled = Gtk::ScrolledWindow.new
|
47
|
-
scrolled.set_policy(
|
47
|
+
scrolled.set_policy(:never, :automatic)
|
48
48
|
|
49
49
|
flowbox = Gtk::FlowBox.new
|
50
50
|
flowbox.valign = :start
|
@@ -73,7 +73,7 @@ class FlowBoxWindow < Gtk::Window
|
|
73
73
|
area.signal_connect("draw") do |_, context|
|
74
74
|
context.set_source_rgba(color)
|
75
75
|
context.paint
|
76
|
-
end
|
76
|
+
end
|
77
77
|
|
78
78
|
button.add(area)
|
79
79
|
end
|
data/sample/misc/image.rb
CHANGED
@@ -2,42 +2,28 @@
|
|
2
2
|
=begin
|
3
3
|
image.rb - Ruby/GTK sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2002-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2002-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
=end
|
8
8
|
|
9
9
|
require "gtk3"
|
10
10
|
|
11
11
|
window = Gtk::Window.new("Image")
|
12
|
-
window.signal_connect("destroy")
|
13
|
-
|
14
|
-
end
|
15
|
-
window.border_width = 0
|
16
|
-
|
17
|
-
box1 = Gtk::Box.new(:vertical, 10)
|
18
|
-
box1.border_width = 10
|
12
|
+
window.signal_connect("destroy") { Gtk.main_quit }
|
13
|
+
window.border_width = 10
|
19
14
|
|
20
15
|
button = Gtk::Button.new
|
21
|
-
box1.add(button)
|
22
16
|
|
23
|
-
label = Gtk::Label.new("Gtk::Image
|
17
|
+
label = Gtk::Label.new("Gtk::Image")
|
24
18
|
image = Gtk::Image.new(:file => "test.xpm")
|
25
19
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
button.add(box2)
|
31
|
-
|
32
|
-
box1.add(Gtk::Separator.new(:horizontal))
|
20
|
+
box = Gtk::Box.new(:horizontal, 5)
|
21
|
+
box.add(image)
|
22
|
+
box.add(label)
|
33
23
|
|
34
|
-
button
|
35
|
-
button.signal_connect("clicked") do
|
36
|
-
Gtk.main_quit
|
37
|
-
end
|
38
|
-
box1.add(button)
|
24
|
+
button.add(box)
|
39
25
|
|
40
|
-
window.add(
|
26
|
+
window.add(button)
|
41
27
|
window.show_all
|
42
28
|
|
43
29
|
Gtk.main
|
data/sample/misc/linkbutton.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
=begin
|
3
3
|
linkbutton.rb - Gtk::LinkButton sample.
|
4
4
|
|
5
|
-
Copyright (c) 2006-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2006-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
=end
|
8
8
|
|
9
9
|
require "gtk3"
|
@@ -22,7 +22,7 @@ vbox.pack_start(button1)
|
|
22
22
|
|
23
23
|
# URI with a label
|
24
24
|
button2 = Gtk::LinkButton.new("https://ruby-gnome2.osdn.jp/",
|
25
|
-
|
25
|
+
"Ruby-GNOME Website")
|
26
26
|
button2.signal_connect("clicked") do
|
27
27
|
puts button2.uri
|
28
28
|
end
|
data/sample/misc/misc-button.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
=begin
|
3
3
|
misc_button.rb - Ruby/GTK sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2004-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2004-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
=end
|
8
8
|
|
9
9
|
require "gtk3"
|
@@ -25,8 +25,7 @@ end
|
|
25
25
|
box.add(fontbutton)
|
26
26
|
|
27
27
|
# Gtk::FileChooserButton
|
28
|
-
filebutton = Gtk::FileChooserButton.new("Gtk::FileChooserButton",
|
29
|
-
Gtk::FileChooserAction::OPEN)
|
28
|
+
filebutton = Gtk::FileChooserButton.new("Gtk::FileChooserButton", :open)
|
30
29
|
filebutton.filename = GLib.home_dir
|
31
30
|
filebutton.signal_connect("current-folder-changed") do |w, e|
|
32
31
|
p filebutton.filename
|
@@ -2,15 +2,15 @@
|
|
2
2
|
=begin
|
3
3
|
recentchooserdialog.rb - Ruby/GTK sample script.
|
4
4
|
|
5
|
-
Copyright (c) 2006-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2006-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
=end
|
8
8
|
|
9
9
|
require "gtk3"
|
10
10
|
|
11
11
|
dialog = Gtk::RecentChooserDialog.new(:title => "Recent Chooser Dialog Sample",
|
12
|
-
:buttons => [["_Cancel",
|
13
|
-
["_Accept",
|
12
|
+
:buttons => [["_Cancel", :cancel],
|
13
|
+
["_Accept", :accept]])
|
14
14
|
|
15
15
|
dialog.signal_connect("response") do |_widget, response|
|
16
16
|
case response
|
@@ -40,7 +40,7 @@ dialog.signal_connect("response") do |_widget, response|
|
|
40
40
|
puts info.exist?
|
41
41
|
end
|
42
42
|
else
|
43
|
-
|
43
|
+
puts "Close"
|
44
44
|
dialog.destroy
|
45
45
|
Gtk.main_quit
|
46
46
|
end
|
data/sample/misc/scalebutton.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
=begin
|
3
3
|
scalebutton.rb - Very simple Gtk::ScaleButton example.
|
4
4
|
|
5
|
-
Copyright (c) 2007-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2007-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
=end
|
8
8
|
|
9
9
|
require "gtk3"
|
@@ -12,8 +12,8 @@ window = Gtk::Window.new
|
|
12
12
|
window.set_size_request(300, 300)
|
13
13
|
scale = Gtk::ScaleButton.new
|
14
14
|
scale.set_value(30)
|
15
|
-
scale.set_valign(
|
16
|
-
scale.set_halign(
|
15
|
+
scale.set_valign(:end)
|
16
|
+
scale.set_halign(:end)
|
17
17
|
box = Gtk::Box.new(:vertical)
|
18
18
|
box.add(scale)
|
19
19
|
box.vexpand = true
|
data/sample/misc/stock.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
stock.rb - Gtk::Stock sample script.
|
3
3
|
|
4
4
|
Copyright (C) 2001-2006 Masao Mutoh
|
5
|
-
Copyright (c) 2001-
|
6
|
-
This program is licenced under the same licence as Ruby-
|
5
|
+
Copyright (c) 2001-2020 Ruby-GNOME Project Team
|
6
|
+
This program is licenced under the same licence as Ruby-GNOME.
|
7
7
|
=end
|
8
8
|
|
9
9
|
require "gtk3"
|
@@ -11,26 +11,22 @@ require "gtk3"
|
|
11
11
|
window = Gtk::Window.new("Gtk::Stock sample")
|
12
12
|
window.signal_connect("destroy") { Gtk.main_quit }
|
13
13
|
|
14
|
-
stocks = Gtk::Stock.constants.sort
|
14
|
+
stocks = Gtk::Stock.constants.sort.cycle
|
15
15
|
|
16
16
|
image = Gtk::Image.new(:stock => Gtk::Stock::OK, :size => :dialog)
|
17
17
|
label = Gtk::Label.new("Gtk::Stock::OK")
|
18
18
|
button = Gtk::Button.new(:label => "Click!")
|
19
|
-
|
19
|
+
|
20
20
|
button.signal_connect("clicked") do
|
21
|
-
|
21
|
+
stock = stocks.next
|
22
|
+
stock_name = "Gtk::Stock::#{stock}"
|
22
23
|
label.set_text(stock_name)
|
23
24
|
image.set_stock(eval(stock_name))
|
24
|
-
if cnt < stocks.size - 1
|
25
|
-
cnt += 1
|
26
|
-
else
|
27
|
-
cnt = 0
|
28
|
-
end
|
29
25
|
end
|
30
26
|
|
31
27
|
box = Gtk::Box.new(:vertical, 0)
|
32
|
-
box.add(image)
|
33
|
-
box.add(label)
|
28
|
+
box.add(image, :expand => true)
|
29
|
+
box.add(label, :expand => true)
|
34
30
|
box.add(button)
|
35
31
|
window.add(box)
|
36
32
|
window.set_default_size(200, 200)
|
data/sample/tutorial/README.md
CHANGED
@@ -391,7 +391,7 @@ Here is the "window.ui" file that contains the template of the window:
|
|
391
391
|
</template>
|
392
392
|
</interface>
|
393
393
|
```
|
394
|
-
Unlike regular interface descriptions, in template XML descriptions, a`<template>` tag is expected as a direct child of the toplevel `<interface>` tag.
|
394
|
+
Unlike regular interface descriptions, in template XML descriptions, a`<template>` tag is expected as a direct child of the toplevel `<interface>` tag. The `<template>` tag must specify the "*class*" attribute which must be the class name of the widget. Optionally, the "*parent*" attribute may be specified to indicate the direct parent class (superclass).
|
395
395
|
|
396
396
|
More informations can be found in the part [building composite widgets from template XML](https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget.description) of the `Gtk::Widget` documentation.
|
397
397
|
|
data/test/gtk-test-utils.rb
CHANGED
data/test/run-test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# Copyright (C) 2013-
|
3
|
+
# Copyright (C) 2013-2020 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
|
@@ -16,18 +16,22 @@
|
|
16
16
|
# License along with this library; if not, write to the Free Software
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
|
-
|
20
|
-
ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
|
19
|
+
require "fileutils"
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
21
|
+
build_dir = File.expand_path(".")
|
22
|
+
|
23
|
+
ruby_gnome_base = File.join(__dir__, "..", "..")
|
24
|
+
ruby_gnome_base = File.expand_path(ruby_gnome_base)
|
25
|
+
|
26
|
+
glib_base = File.join(ruby_gnome_base, "glib2")
|
27
|
+
gobject_introspection_base = File.join(ruby_gnome_base, "gobject-introspection")
|
28
|
+
atk_base = File.join(ruby_gnome_base, "atk")
|
29
|
+
cairo_gobject_base = File.join(ruby_gnome_base, "cairo-gobject")
|
30
|
+
pango_base = File.join(ruby_gnome_base, "pango")
|
31
|
+
gdk_pixbuf_base = File.join(ruby_gnome_base, "gdk_pixbuf2")
|
32
|
+
gio2_base = File.join(ruby_gnome_base, "gio2")
|
33
|
+
gdk3_base = File.join(ruby_gnome_base, "gdk3")
|
34
|
+
gtk3_base = File.join(ruby_gnome_base, "gtk3")
|
31
35
|
|
32
36
|
[
|
33
37
|
[glib_base, "glib2"],
|
@@ -49,7 +53,14 @@ gtk3_base = File.join(ruby_gnome2_base, "gtk3")
|
|
49
53
|
$LOAD_PATH.unshift(File.join(target, "lib"))
|
50
54
|
end
|
51
55
|
|
52
|
-
|
56
|
+
source_fixture_dir = File.join(gtk3_base, "test", "fixture")
|
57
|
+
build_fixture_dir = File.join(build_dir, "test", "fixture")
|
58
|
+
unless source_fixture_dir == build_fixture_dir
|
59
|
+
FileUtils.rm_rf(build_fixture_dir)
|
60
|
+
FileUtils.mkdir_p(File.dirname(build_fixture_dir))
|
61
|
+
FileUtils.cp_r(source_fixture_dir, build_fixture_dir)
|
62
|
+
end
|
63
|
+
Dir.chdir(build_fixture_dir) do
|
53
64
|
system("rake") or exit(false)
|
54
65
|
end
|
55
66
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-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
|
@@ -46,11 +46,9 @@ class TestGtkToggleAction < Test::Unit::TestCase
|
|
46
46
|
|
47
47
|
sub_test_case("#active=") do
|
48
48
|
def test_nil
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
assert_raise(ArgumentError) do
|
53
|
-
@action.active = nil
|
49
|
+
@action.active = nil
|
50
|
+
assert do
|
51
|
+
not @action.active?
|
54
52
|
end
|
55
53
|
end
|
56
54
|
|
data/test/test-gtk-widget.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2008-
|
1
|
+
# Copyright (C) 2008-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
|
@@ -130,10 +130,20 @@ class TestGtkWidget < Test::Unit::TestCase
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
133
|
+
sub_test_case "#style_get_property" do
|
134
|
+
test("existent") do
|
135
|
+
entry = Gtk::Entry.new
|
136
|
+
assert do
|
137
|
+
entry.style_get_property("focus-padding").is_a?(Integer)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
test("nonexistent") do
|
142
|
+
entry = Gtk::Entry.new
|
143
|
+
name = "nonexistent"
|
144
|
+
assert_raise(ArgumentError.new("unknown style: #{name.inspect}")) do
|
145
|
+
entry.style_get_property(name)
|
146
|
+
end
|
137
147
|
end
|
138
148
|
end
|
139
149
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gtk3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.2
|
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: 2020-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gio2
|
@@ -16,70 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.4.
|
19
|
+
version: 3.4.2
|
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.4.
|
26
|
+
version: 3.4.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: atk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.4.
|
33
|
+
version: 3.4.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.4.
|
40
|
+
version: 3.4.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pango
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.4.
|
47
|
+
version: 3.4.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.4.
|
54
|
+
version: 3.4.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: gdk_pixbuf2
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.4.
|
61
|
+
version: 3.4.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.4.
|
68
|
+
version: 3.4.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: gdk3
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 3.4.
|
75
|
+
version: 3.4.2
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 3.4.
|
82
|
+
version: 3.4.2
|
83
83
|
description: Ruby/GTK3 is a Ruby binding of GTK+-3.x.
|
84
84
|
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
85
85
|
executables: []
|
@@ -537,7 +537,6 @@ files:
|
|
537
537
|
- sample/tutorial/exampleapp9/window.ui
|
538
538
|
- test/fixture/Rakefile
|
539
539
|
- test/fixture/gnome-logo-icon.png
|
540
|
-
- test/fixture/image.gresource
|
541
540
|
- test/fixture/image.gresource.xml
|
542
541
|
- test/fixture/simple_window.gresource.xml
|
543
542
|
- test/fixture/simple_window.ui
|
@@ -654,8 +653,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
654
653
|
- !ruby/object:Gem::Version
|
655
654
|
version: '0'
|
656
655
|
requirements: []
|
657
|
-
|
658
|
-
rubygems_version: 2.7.6.2
|
656
|
+
rubygems_version: 3.2.0.pre1
|
659
657
|
signing_key:
|
660
658
|
specification_version: 4
|
661
659
|
summary: Ruby/GTK3 is a Ruby binding of GTK+-3.x.
|
Binary file
|