gtk3 3.1.9 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/sample/gtk-demo/TODO +1 -1
- data/sample/gtk-demo/tree_store.rb +257 -0
- metadata +17 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92788580e31fbe2e3cc8da5a77b37fd8ce47c665
|
4
|
+
data.tar.gz: e7c6c6370e439f7e496d090fdbf72ce914bb40f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebf5cbae6c016926b98116386fac33ebdc5623ca8fa77ea2bfe847eabdee9aaad8fb22d6d675b4a171e4d934b89ebc0dc1f19bb9a5d062c8b3a92ab2654bb588
|
7
|
+
data.tar.gz: 6d08b56e0085566e98ba8d3ff657bdaff5db4fc717f87738db590889b1422061ffff5dcf09703a1fba0efdf328d412d1544995b43773458baac86936322cd07f
|
data/sample/gtk-demo/TODO
CHANGED
@@ -59,6 +59,7 @@ combobox.c ok ok
|
|
59
59
|
css_blendmodes.c ok ok
|
60
60
|
fishbowl.c ok ok
|
61
61
|
flowbox.c ok ok
|
62
|
+
tree_store.c ok ok
|
62
63
|
|
63
64
|
Remains :
|
64
65
|
|
@@ -68,7 +69,6 @@ foreigndrawing no no
|
|
68
69
|
gestures.c no no
|
69
70
|
shortcuts.c no no
|
70
71
|
toolpalette.c no no
|
71
|
-
tree_store.c ok no
|
72
72
|
|
73
73
|
# Ruby version
|
74
74
|
Check all the ruby demos that doesn't correspond to a C version.
|
@@ -0,0 +1,257 @@
|
|
1
|
+
# Copyright (c) 2017 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
|
+
#
|
4
|
+
=begin
|
5
|
+
= Tree View/Tree Store
|
6
|
+
|
7
|
+
The GtkTreeStore is used to store data in tree form, to be
|
8
|
+
used later on by a GtkTreeView to display it. This demo builds
|
9
|
+
a simple GtkTreeStore and displays it. If you're new to the
|
10
|
+
GtkTreeView widgets and associates, look into the GtkListStore
|
11
|
+
example first.
|
12
|
+
=end
|
13
|
+
class TreeStoreDemo
|
14
|
+
TreeItem = Struct.new("TreeItem",
|
15
|
+
:label, :alex, :havoc, :tim, :owen, :dave,
|
16
|
+
:world_holiday, :children)
|
17
|
+
HOLIDAY_NAME_COLUMN, ALEX_COLUMN, HAVOC_COLUMN, TIM_COLUMN, OWEN_COLUMN,
|
18
|
+
DAVE_COLUMN, VISIBLE_COLUMN, WORLD_COLUMN, NUM_COLUMNS = (0..8).to_a
|
19
|
+
|
20
|
+
January = [
|
21
|
+
["New Years Day", true, true, true, true, false, true, nil],
|
22
|
+
["Presidential Inauguration", false, true, false, true, false, false, nil],
|
23
|
+
["Martin Luther King Jr. day", false, true, false, true, false, false, nil]
|
24
|
+
].collect do |ary|
|
25
|
+
TreeItem.new(*ary)
|
26
|
+
end
|
27
|
+
|
28
|
+
February = [
|
29
|
+
["Presidents' Day", false, true, false, true, false, false, nil],
|
30
|
+
["Groundhog Day", false, false, false, false, false, false, nil],
|
31
|
+
["Valentine's Day", false, false, false, false, true, true, nil]
|
32
|
+
].collect do |ary|
|
33
|
+
TreeItem.new(*ary)
|
34
|
+
end
|
35
|
+
|
36
|
+
March = [
|
37
|
+
["National Tree Planting Day", false, false, false, false, false, false, nil],
|
38
|
+
["St Patrick's Day", false, false, false, false, false, true, nil]
|
39
|
+
].collect do |ary|
|
40
|
+
TreeItem.new(*ary)
|
41
|
+
end
|
42
|
+
|
43
|
+
April = [
|
44
|
+
["April Fools' Day", false, false, false, false, false, true, nil],
|
45
|
+
["Army Day", false, false, false, false, false, false, nil],
|
46
|
+
["Earth Day", false, false, false, false, false, true, nil],
|
47
|
+
["Administrative Professionals' Day", false, false, false, false, false, false, nil]
|
48
|
+
].collect do |ary|
|
49
|
+
TreeItem.new(*ary)
|
50
|
+
end
|
51
|
+
|
52
|
+
May = [
|
53
|
+
["Nurses' Day", false, false, false, false, false, false, nil],
|
54
|
+
["National Day of Prayer", false, false, false, false, false, false, nil],
|
55
|
+
["Mothers' Day", false, false, false, false, false, true, nil],
|
56
|
+
["Armed Forces Day", false, false, false, false, false, false, nil],
|
57
|
+
["Memorial Day", true, true, true, true, false, true, nil]
|
58
|
+
].collect do |ary|
|
59
|
+
TreeItem.new(*ary)
|
60
|
+
end
|
61
|
+
|
62
|
+
June = [
|
63
|
+
["June Fathers' Day", false, false, false, false, false, true, nil],
|
64
|
+
["Juneteenth (Liberation of Slaves)", false, false, false, false, false, false, nil],
|
65
|
+
["Flag Day", false, true, false, true, false, false, nil]
|
66
|
+
].collect do |ary|
|
67
|
+
TreeItem.new(*ary)
|
68
|
+
end
|
69
|
+
|
70
|
+
July = [
|
71
|
+
["Parents' Day", false, false, false, false, false, true, nil],
|
72
|
+
["Independence Day", false, true, false, true, false, false, nil]
|
73
|
+
].collect do |ary|
|
74
|
+
TreeItem.new(*ary)
|
75
|
+
end
|
76
|
+
|
77
|
+
August = [
|
78
|
+
["Air Force Day", false, false, false, false, false, false, nil],
|
79
|
+
["Coast Guard Day", false, false, false, false, false, false, nil],
|
80
|
+
["Friendship Day", false, false, false, false, false, false, nil]
|
81
|
+
].collect do |ary|
|
82
|
+
TreeItem.new(*ary)
|
83
|
+
end
|
84
|
+
|
85
|
+
September = [
|
86
|
+
["Grandparents' Day", false, false, false, false, false, true, nil],
|
87
|
+
["Citizenship Day or Constitution Day", false, false, false, false, false, false, nil],
|
88
|
+
["Labor Day", true, true, true, true, false, true, nil]
|
89
|
+
].collect do |ary|
|
90
|
+
TreeItem.new(*ary)
|
91
|
+
end
|
92
|
+
|
93
|
+
October = [
|
94
|
+
["National Children's Day", false, false, false, false, false, false, nil],
|
95
|
+
["Bosses' Day", false, false, false, false, false, false, nil],
|
96
|
+
["Sweetest Day", false, false, false, false, false, false, nil],
|
97
|
+
["Mother-in-Law's Day", false, false, false, false, false, false, nil],
|
98
|
+
["Navy Day", false, false, false, false, false, false, nil],
|
99
|
+
["Columbus Day", false, true, false, true, false, false, nil],
|
100
|
+
["Halloween", false, false, false, false, false, true, nil]
|
101
|
+
].collect do |ary|
|
102
|
+
TreeItem.new(*ary)
|
103
|
+
end
|
104
|
+
|
105
|
+
November = [
|
106
|
+
["Marine Corps Day", false, false, false, false, false, false, nil],
|
107
|
+
["Veterans' Day", true, true, true, true, false, true, nil],
|
108
|
+
["Thanksgiving", false, true, false, true, false, false, nil]
|
109
|
+
].collect do |ary|
|
110
|
+
TreeItem.new(*ary)
|
111
|
+
end
|
112
|
+
|
113
|
+
December = [
|
114
|
+
["Pearl Harbor Remembrance Day", false, false, false, false, false, false, nil],
|
115
|
+
["Christmas", true, true, true, true, false, true, nil],
|
116
|
+
["Kwanzaa", false, false, false, false, false, false, nil]
|
117
|
+
].collect do |ary|
|
118
|
+
TreeItem.new(*ary)
|
119
|
+
end
|
120
|
+
|
121
|
+
Toplevel = [
|
122
|
+
["January", false, false, false, false, false, false, January],
|
123
|
+
["February", false, false, false, false, false, false, February],
|
124
|
+
["March", false, false, false, false, false, false, March],
|
125
|
+
["April", false, false, false, false, false, false, April],
|
126
|
+
["May", false, false, false, false, false, false, May],
|
127
|
+
["June", false, false, false, false, false, false, June],
|
128
|
+
["July", false, false, false, false, false, false, July],
|
129
|
+
["August", false, false, false, false, false, false, August],
|
130
|
+
["September", false, false, false, false, false, false, September],
|
131
|
+
["October", false, false, false, false, false, false, October],
|
132
|
+
["November", false, false, false, false, false, false, November],
|
133
|
+
["December", false, false, false, false, false, false, December]
|
134
|
+
].collect do |ary|
|
135
|
+
TreeItem.new(*ary)
|
136
|
+
end
|
137
|
+
|
138
|
+
def initialize(main_window)
|
139
|
+
@window = Gtk::Window.new(:toplevel)
|
140
|
+
@window.screen = main_window.screen
|
141
|
+
@window.title = "Tree Store"
|
142
|
+
|
143
|
+
vbox = Gtk::Box.new(:vertical, 8)
|
144
|
+
vbox.margin = 8
|
145
|
+
@window.add(vbox)
|
146
|
+
label = Gtk::Label.new("Jonathan's Holiday Card Planning Sheet")
|
147
|
+
vbox.pack_start(label)
|
148
|
+
|
149
|
+
sw = Gtk::ScrolledWindow.new
|
150
|
+
sw.shadow_type = :etched_in
|
151
|
+
sw.set_policy(:automatic, :automatic)
|
152
|
+
vbox.pack_start(sw, :expand => true, :fill => true, :padding => 0)
|
153
|
+
|
154
|
+
create_model
|
155
|
+
@treeview = Gtk::TreeView.new(@model)
|
156
|
+
@treeview.selection.mode = :multiple
|
157
|
+
|
158
|
+
add_columns
|
159
|
+
sw.add(@treeview)
|
160
|
+
|
161
|
+
# Expand all rows after the treeview widget has been realized
|
162
|
+
@treeview.signal_connect("realize", &:expand_all)
|
163
|
+
@window.set_default_size(650, 400)
|
164
|
+
end
|
165
|
+
|
166
|
+
def run
|
167
|
+
if !@window.visible?
|
168
|
+
@window.show_all
|
169
|
+
else
|
170
|
+
@window.destroy
|
171
|
+
end
|
172
|
+
@window
|
173
|
+
end
|
174
|
+
|
175
|
+
private
|
176
|
+
|
177
|
+
def create_model
|
178
|
+
@model = Gtk::TreeStore.new(String, TrueClass, TrueClass, TrueClass,
|
179
|
+
TrueClass, TrueClass, TrueClass, TrueClass)
|
180
|
+
Toplevel.each do |month|
|
181
|
+
iter = @model.append(nil)
|
182
|
+
iter[HOLIDAY_NAME_COLUMN] = month.label
|
183
|
+
iter[ALEX_COLUMN] = false
|
184
|
+
iter[HAVOC_COLUMN] = false
|
185
|
+
iter[TIM_COLUMN] = false
|
186
|
+
iter[OWEN_COLUMN] = false
|
187
|
+
iter[DAVE_COLUMN] = false
|
188
|
+
iter[VISIBLE_COLUMN] = false
|
189
|
+
iter[WORLD_COLUMN] = false
|
190
|
+
|
191
|
+
holidays = month.children
|
192
|
+
# add children
|
193
|
+
holidays.each do |holiday|
|
194
|
+
child_iter = @model.append(iter)
|
195
|
+
child_iter[HOLIDAY_NAME_COLUMN] = holiday.label
|
196
|
+
child_iter[ALEX_COLUMN] = holiday.alex
|
197
|
+
child_iter[HAVOC_COLUMN] = holiday.havoc
|
198
|
+
child_iter[TIM_COLUMN] = holiday.tim
|
199
|
+
child_iter[OWEN_COLUMN] = holiday.owen
|
200
|
+
child_iter[DAVE_COLUMN] = holiday.dave
|
201
|
+
child_iter[VISIBLE_COLUMN] = true
|
202
|
+
child_iter[WORLD_COLUMN] = holiday.world_holiday
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
def add_toggle_column(label, col_index, attributes)
|
208
|
+
renderer = Gtk::CellRendererToggle.new
|
209
|
+
renderer.xalign = 0.0
|
210
|
+
renderer.signal_connect "toggled" do |_cell, path_str|
|
211
|
+
path = Gtk::TreePath.new(path_str)
|
212
|
+
iter = @model.get_iter(path)
|
213
|
+
toggle_item = iter[col_index]
|
214
|
+
|
215
|
+
toggle_item = !toggle_item
|
216
|
+
iter[col_index] = toggle_item
|
217
|
+
end
|
218
|
+
|
219
|
+
col_offset = @treeview.insert_column(-1, label, renderer, attributes)
|
220
|
+
column = @treeview.get_column(col_offset - 1)
|
221
|
+
column.sizing = :fixed
|
222
|
+
column.clickable = true
|
223
|
+
end
|
224
|
+
|
225
|
+
def add_columns
|
226
|
+
# column for holiday names
|
227
|
+
renderer = Gtk::CellRendererText.new
|
228
|
+
renderer.xalign = 0.0
|
229
|
+
|
230
|
+
col_offset = @treeview.insert_column(-1, "Holiday", renderer,
|
231
|
+
:text => HOLIDAY_NAME_COLUMN)
|
232
|
+
column = @treeview.get_column(col_offset - 1)
|
233
|
+
column.clickable = true
|
234
|
+
|
235
|
+
add_toggle_column("Alex", ALEX_COLUMN,
|
236
|
+
:active => ALEX_COLUMN,
|
237
|
+
:visible => VISIBLE_COLUMN,
|
238
|
+
:activatable => WORLD_COLUMN)
|
239
|
+
|
240
|
+
add_toggle_column("Havoc", HAVOC_COLUMN,
|
241
|
+
:active => HAVOC_COLUMN,
|
242
|
+
:visible => VISIBLE_COLUMN)
|
243
|
+
|
244
|
+
add_toggle_column("Tim", TIM_COLUMN,
|
245
|
+
:active => TIM_COLUMN,
|
246
|
+
:visible => VISIBLE_COLUMN,
|
247
|
+
:activatable => WORLD_COLUMN)
|
248
|
+
|
249
|
+
add_toggle_column("Owen", OWEN_COLUMN,
|
250
|
+
:active => OWEN_COLUMN,
|
251
|
+
:visible => VISIBLE_COLUMN)
|
252
|
+
|
253
|
+
add_toggle_column("Dave", DAVE_COLUMN,
|
254
|
+
:active => DAVE_COLUMN,
|
255
|
+
:visible => VISIBLE_COLUMN)
|
256
|
+
end
|
257
|
+
end
|
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
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Ruby-GNOME2 Project Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glib2
|
@@ -16,98 +16,98 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.2.0
|
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.
|
26
|
+
version: 3.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gio2
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
33
|
+
version: 3.2.0
|
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.
|
40
|
+
version: 3.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: atk
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.
|
47
|
+
version: 3.2.0
|
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.
|
54
|
+
version: 3.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pango
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
61
|
+
version: 3.2.0
|
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.
|
68
|
+
version: 3.2.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: gdk_pixbuf2
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 3.
|
75
|
+
version: 3.2.0
|
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.
|
82
|
+
version: 3.2.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: gdk3
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 3.
|
89
|
+
version: 3.2.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 3.
|
96
|
+
version: 3.2.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: gobject-introspection
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 3.
|
103
|
+
version: 3.2.0
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 3.
|
110
|
+
version: 3.2.0
|
111
111
|
description: Ruby/GTK3 is a Ruby binding of GTK+-3.x.
|
112
112
|
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
113
113
|
executables: []
|
@@ -401,6 +401,7 @@ files:
|
|
401
401
|
- sample/gtk-demo/theming.ui
|
402
402
|
- sample/gtk-demo/theming_style_classes.rb
|
403
403
|
- sample/gtk-demo/transparent.rb
|
404
|
+
- sample/gtk-demo/tree_store.rb
|
404
405
|
- sample/gtk-demo/vertical_text_cursor.png
|
405
406
|
- sample/gtk-demo/w_resize_cursor.png
|
406
407
|
- sample/gtk-demo/wait_cursor.png
|