gtk3 2.1.0-x86-mingw32 → 2.2.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gtk3/extconf.rb +1 -1
  3. data/ext/gtk3/rbgtk-about-dialog.c +0 -6
  4. data/ext/gtk3/rbgtk-accessible.c +0 -16
  5. data/ext/gtk3/rbgtk-entry.c +4 -18
  6. data/ext/gtk3/rbgtk-header-bar.c +58 -0
  7. data/ext/gtk3/rbgtk-icon-view.c +30 -5
  8. data/ext/gtk3/rbgtk-level-bar.c +88 -0
  9. data/ext/gtk3/rbgtk-link-button.c +0 -6
  10. data/ext/gtk3/rbgtk-menu-button.c +41 -0
  11. data/ext/gtk3/rbgtk-revealer.c +42 -0
  12. data/ext/gtk3/rbgtk-search-bar.c +59 -0
  13. data/ext/gtk3/rbgtk-search-entry.c +42 -0
  14. data/ext/gtk3/rbgtk-stack.c +106 -0
  15. data/ext/gtk3/rbgtk-tree-selection.c +7 -22
  16. data/ext/gtk3/rbgtk.c +24 -3
  17. data/ext/gtk3/rbgtk3conversions.h +25 -2
  18. data/ext/gtk3/rbgtk3private.h +23 -3
  19. data/lib/1.9/gtk3.so +0 -0
  20. data/lib/2.0/gtk3.so +0 -0
  21. data/lib/2.1/gtk3.so +0 -0
  22. data/sample/gtk-demo/appwindow.rb +95 -95
  23. data/sample/gtk-demo/cairo-operator.rb +8 -8
  24. data/sample/gtk-demo/drawingarea.rb +74 -99
  25. data/sample/gtk-demo/pixbufs.rb +48 -57
  26. data/sample/misc/alpha-demo.rb +1 -1
  27. data/sample/misc/assistant.rb +45 -51
  28. data/sample/misc/cairo-pong.rb +26 -24
  29. data/sample/misc/composited-windows.rb +2 -2
  30. data/sample/misc/dnd.rb +23 -23
  31. data/sample/misc/drag-move.rb +19 -11
  32. data/sample/misc/drawing.rb +1 -1
  33. data/sample/misc/mouse-gesture.rb +3 -3
  34. data/sample/misc/pangorenderer.rb +1 -1
  35. data/sample/misc/properties.rb +1 -0
  36. data/sample/misc/to_drawable.rb +1 -1
  37. data/sample/misc/tooltips.rb +1 -1
  38. data/test/test_gtk_accessible.rb +31 -0
  39. data/test/test_gtk_entry.rb +36 -0
  40. data/test/test_gtk_header_bar.rb +66 -0
  41. data/test/test_gtk_icon_view.rb +41 -0
  42. data/test/test_gtk_level_bar.rb +82 -0
  43. data/test/test_gtk_list_store.rb +2 -1
  44. data/test/test_gtk_menu_button.rb +49 -0
  45. data/test/test_gtk_revealer.rb +57 -0
  46. data/test/test_gtk_search_bar.rb +55 -0
  47. data/test/test_gtk_search_entry.rb +34 -0
  48. data/test/test_gtk_stack.rb +115 -0
  49. data/test/test_gtk_tree_selection.rb +31 -0
  50. metadata +31 -14
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
1
+ # Copyright (c) 2003-2014 Ruby-GNOME2 Project Team
2
2
  # This program is licenced under the same licence as Ruby-GNOME2.
3
3
  #
4
4
  # $Id: pixbufs.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $
@@ -16,29 +16,29 @@ off how to use Gtk::DrawingArea to do a simple animation.
16
16
  Look at the Image demo for additional pixbuf usage examples.
17
17
  =end
18
18
 
19
- require 'common'
19
+ require "common"
20
20
 
21
21
  module Demo
22
22
  class Pixbufs < BasicWindow
23
23
  FRAME_DELAY = 50
24
24
 
25
- BACKGROUND_NAME = 'background.jpg'
25
+ BACKGROUND_NAME = "background.jpg"
26
26
 
27
27
  IMAGE_NAMES = [
28
- 'apple-red.png',
29
- 'gnome-applets.png',
30
- 'gnome-calendar.png',
31
- 'gnome-foot.png',
32
- 'gnome-gmush.png',
33
- 'gnome-gimp.png',
34
- 'gnome-gsame.png',
35
- 'gnu-keys.png',
36
- 'ruby-gnome2-logo.png'
28
+ "apple-red.png",
29
+ "gnome-applets.png",
30
+ "gnome-calendar.png",
31
+ "gnome-foot.png",
32
+ "gnome-gmush.png",
33
+ "gnome-gimp.png",
34
+ "gnome-gsame.png",
35
+ "gnu-keys.png",
36
+ "ruby-gnome2-logo.png",
37
37
  ]
38
38
 
39
39
  CYCLE_LEN = 60
40
40
  def initialize
41
- super('Pixbufs')
41
+ super("Pixbufs")
42
42
  set_resizable(false)
43
43
 
44
44
  @background = nil
@@ -47,40 +47,41 @@ module Demo
47
47
  @images = []
48
48
 
49
49
  begin
50
- load_pixbufs
50
+ load_pixbufs
51
51
 
52
- set_size_request(@background.width, @background.height)
52
+ set_size_request(@background.width, @background.height)
53
53
 
54
- @frame = Gdk::Pixbuf.new(Gdk::Pixbuf::COLORSPACE_RGB,
55
- false, 8,
56
- @background.width, @background.height)
54
+ @frame = Gdk::Pixbuf.new(Gdk::Pixbuf::COLORSPACE_RGB,
55
+ false, 8,
56
+ @background.width, @background.height)
57
57
 
58
- @da = Gtk::DrawingArea.new
58
+ @da = Gtk::DrawingArea.new
59
59
 
60
- @da.signal_connect('expose_event') do |w, e|
61
- expose_cb(w, e)
62
- end
60
+ @da.signal_connect("draw") do |w, e|
61
+ draw_cb(w, e)
62
+ end
63
63
 
64
- add(@da)
64
+ add(@da)
65
65
 
66
- timeout_id = Gtk.timeout_add(FRAME_DELAY) do
66
+ timeout_id = GLib::Timeout.add(FRAME_DELAY) do
67
67
  timeout
68
- end
69
- signal_connect('destroy') do
70
- Gtk.timeout_remove(timeout_id)
68
+ end
69
+ signal_connect("destroy") do
70
+ GLib::Source.remove(timeout_id)
71
71
  end
72
72
  rescue
73
- dialog = Gtk::MessageDialog.new(self,
74
- Gtk::Dialog::DESTROY_WITH_PARENT,
75
- Gtk::MessageDialog::ERROR,
76
- Gtk::MessageDialog::BUTTONS_CLOSE,
77
- "Failed to load an image: #{$!.message}")
78
-
79
- dialog.signal_connect('response') do
80
- dialog.destroy
81
- end
73
+ message = "Failed to load an image: #{$!.message}"
74
+ dialog = Gtk::MessageDialog.new(:parent => self,
75
+ :flags => :destroy_with_parent,
76
+ :type => :error,
77
+ :buttons_type => :close,
78
+ :message => message)
79
+
80
+ dialog.signal_connect("response") do
81
+ dialog.destroy
82
+ end
82
83
 
83
- dialog.show
84
+ dialog.show
84
85
  end
85
86
  end
86
87
 
@@ -88,7 +89,7 @@ module Demo
88
89
  # Loads the images for the demo
89
90
 
90
91
  if @background
91
- return # already loaded earlier
92
+ return # already loaded earlier
92
93
  end
93
94
 
94
95
  # demo_find_file() looks in the the current directory first,
@@ -99,25 +100,15 @@ module Demo
99
100
  @background = Gdk::Pixbuf.new(filename)
100
101
 
101
102
  IMAGE_NAMES.each_with_index do |basename, i|
102
- filename = Demo.find_file(basename)
103
+ filename = Demo.find_file(basename)
103
104
 
104
- @images[i] = Gdk::Pixbuf.new(filename)
105
+ @images[i] = Gdk::Pixbuf.new(filename)
105
106
  end
106
107
  end
107
108
 
108
- def expose_cb(widget, event)
109
- rowstride = @frame.rowstride
110
-
111
- pixels = @frame.pixels
112
- pixels[0, rowstride * event.area.y + event.area.x * 3] = ''
113
-
114
- Gdk::RGB.draw_rgb_image(widget.window,
115
- widget.style.black_gc,
116
- event.area.x, event.area.y,
117
- event.area.width, event.area.height,
118
- Gdk::RGB::Dither::NORMAL,
119
- pixels, rowstride,
120
- event.area.x, event.area.y)
109
+ def draw_cb(widget, cairo_context)
110
+ cairo_context.set_source_pixbuf(@frame)
111
+ cairo_context.paint
121
112
  true
122
113
  end
123
114
 
@@ -128,7 +119,7 @@ module Demo
128
119
 
129
120
  f = Float(@frame_num % CYCLE_LEN) / CYCLE_LEN;
130
121
 
131
- xmid = @background.width / 2.0
122
+ xmid = @background.width / 2.0
132
123
  ymid = @background.height / 2.0
133
124
 
134
125
  radius = [xmid, ymid].min / 2.0
@@ -138,7 +129,7 @@ module Demo
138
129
 
139
130
  r = radius + (radius / 3.0) * Math.sin(f * 2.0 * Math::PI)
140
131
 
141
- xpos = (xmid + r * Math.cos(ang) - image.width / 2.0 + 0.5).floor
132
+ xpos = (xmid + r * Math.cos(ang) - image.width / 2.0 + 0.5).floor
142
133
  ypos = (ymid + r * Math.sin(ang) - image.height / 2.0 + 0.5).floor
143
134
 
144
135
  k = if (i & 1) == 1
@@ -158,12 +149,12 @@ module Demo
158
149
  if (i & 1) == 1
159
150
  [
160
151
  127,
161
- (255 * Math.sin(f * 2.0 * Math::PI)).abs
152
+ (255 * Math.sin(f * 2.0 * Math::PI)).abs,
162
153
  ].max
163
154
  else
164
155
  [
165
156
  127,
166
- (255 * Math.cos(f * 2.0 * Math::PI)).abs
157
+ (255 * Math.cos(f * 2.0 * Math::PI)).abs,
167
158
  ].max
168
159
  end)
169
160
  end
@@ -31,7 +31,7 @@ class AlphaDemo < Gtk::Window
31
31
  end
32
32
  set_double_buffered(false)
33
33
 
34
- signal_connect('expose-event') do |widget, event|
34
+ signal_connect('draw') do |widget, event|
35
35
  cr = widget.window.create_cairo_context
36
36
 
37
37
  rgba = [1.0, 1.0, 1.0]
@@ -10,13 +10,7 @@
10
10
  $Id: assistant.rb,v 1.1 2006/11/23 08:39:12 mutoh Exp $
11
11
  =end
12
12
 
13
- require 'gtk3'
14
-
15
- if str = Gtk.check_version(2, 10, 0)
16
- puts "This sample requires GTK+ 2.10.0 or later"
17
- puts str
18
- exit
19
- end
13
+ require "gtk3"
20
14
 
21
15
  class AssistantRunner
22
16
  def initialize
@@ -60,12 +54,12 @@ class AssistantRunner
60
54
  end
61
55
 
62
56
  def add_completion_test_page(assistant, text, visible, complete)
63
- page = Gtk::VBox.new(0, 0)
57
+ page = Gtk::Box.new(:vertical, 0)
64
58
  check = Gtk::CheckButton.new("Complete")
65
59
  page.add(Gtk::Label.new(text))
66
60
  page.add(check)
67
61
  check.active = complete
68
- check.signal_connect('toggled') do
62
+ check.signal_connect("toggled") do
69
63
  complete = check.active?
70
64
  assistant.set_page_complete(page, complete)
71
65
  end
@@ -83,11 +77,11 @@ class AssistantRunner
83
77
  def prepare_cb(assistant, page)
84
78
  if page.is_a?(Gtk::Label)
85
79
  puts "prepare: #{page.text}"
86
- elsif assistant.get_page_type(page) == Gtk::Assistant::PAGE_PROGRESS
80
+ elsif assistant.get_page_type(page) == :progress
87
81
  progress = page.child
88
82
  assistant.set_page_complete(page, false)
89
83
  progress.fraction = 0.0
90
- Gtk.timeout_add(300) do
84
+ GLib::Timeout.add(300) do
91
85
  page = assistant.get_nth_page(assistant.current_page)
92
86
  progress = page.child
93
87
  value = progress.fraction = progress.fraction + 0.1
@@ -103,18 +97,18 @@ class AssistantRunner
103
97
  def create_simple_assistant
104
98
  assistant = Gtk::Assistant.new
105
99
  assistant.set_default_size(400, 300)
106
- assistant.signal_connect('cancel') do
100
+ assistant.signal_connect("cancel") do
107
101
  puts "cancel"
108
102
  assistant.hide
109
103
  end
110
- assistant.signal_connect('close') do
104
+ assistant.signal_connect("close") do
111
105
  puts "close"
112
106
  assistant.hide
113
107
  end
114
- assistant.signal_connect('apply') do
108
+ assistant.signal_connect("apply") do
115
109
  puts "apply"
116
110
  end
117
- assistant.signal_connect('prepare') do |_assistant, page|
111
+ assistant.signal_connect("prepare") do |_assistant, page|
118
112
  prepare_cb(_assistant, page)
119
113
  end
120
114
 
@@ -135,18 +129,18 @@ class AssistantRunner
135
129
  def create_generous_assistant
136
130
  assistant = Gtk::Assistant.new
137
131
  assistant.set_default_size(400, 300)
138
- assistant.signal_connect('cancel') do
132
+ assistant.signal_connect("cancel") do
139
133
  puts "cancel"
140
134
  assistant.hide
141
135
  end
142
- assistant.signal_connect('close') do
136
+ assistant.signal_connect("close") do
143
137
  puts "close"
144
138
  assistant.hide
145
139
  end
146
- assistant.signal_connect('apply') do
140
+ assistant.signal_connect("apply") do
147
141
  puts "apply"
148
142
  end
149
- assistant.signal_connect('prepare') do|_assistant, page|
143
+ assistant.signal_connect("prepare") do|_assistant, page|
150
144
  prepare_cb(_assistant, page)
151
145
  end
152
146
 
@@ -162,7 +156,7 @@ class AssistantRunner
162
156
 
163
157
  check = Gtk::CheckButton.new("Next page visible");
164
158
  check.active = true
165
- check.signal_connect('toggled') do
159
+ check.signal_connect("toggled") do
166
160
  puts "beuh"
167
161
  next_page.visible = check.active?
168
162
  end
@@ -197,25 +191,25 @@ class AssistantRunner
197
191
  def create_nonlinear_assistant
198
192
  assistant = Gtk::Assistant.new
199
193
  assistant.set_default_size(400, 300)
200
- assistant.signal_connect('cancel') do
194
+ assistant.signal_connect("cancel") do
201
195
  puts "cancel"
202
196
  assistant.hide
203
197
  end
204
- assistant.signal_connect('close') do
198
+ assistant.signal_connect("close") do
205
199
  puts "close"
206
200
  assistant.hide
207
201
  end
208
- assistant.signal_connect('apply') do
202
+ assistant.signal_connect("apply") do
209
203
  puts "apply"
210
204
  end
211
- assistant.signal_connect('prepare') do |_assistant, page|
205
+ assistant.signal_connect("prepare") do |_assistant, page|
212
206
  prepare_cb(_assistant, page)
213
207
  end
214
208
 
215
209
  assistant.set_forward_page_func do |current_page|
216
210
  retval = -1
217
211
  if current_page == 0
218
- if @selected_branch == 'A'
212
+ if @selected_branch == "A"
219
213
  retval = 1
220
214
  else
221
215
  retval = 2
@@ -226,17 +220,17 @@ class AssistantRunner
226
220
  retval
227
221
  end
228
222
 
229
- page = Gtk::VBox.new(false, 6)
230
- button = Gtk::RadioButton.new('branch A')
231
- page.pack_start(button, false, false, 0)
232
- button.signal_connect('toggled') do
233
- @selected_branch = 'A'
223
+ page = Gtk::Box.new(:vertical, 6)
224
+ button = Gtk::RadioButton.new("branch A")
225
+ page.pack_start(button, :expand => false, :fill => false, :padding => 0)
226
+ button.signal_connect("toggled") do
227
+ @selected_branch = "A"
234
228
  end
235
229
  button.active = true
236
- button = Gtk::RadioButton.new(button, 'branch B')
237
- page.pack_start(button, false, false, 0)
238
- button.signal_connect('toggled') do
239
- @selected_branch = 'B'
230
+ button = Gtk::RadioButton.new(button, "branch B")
231
+ page.pack_start(button, :expand => false, :fill => false, :padding => 0)
232
+ button.signal_connect("toggled") do
233
+ @selected_branch = "B"
240
234
  end
241
235
  page.show_all
242
236
  assistant.append_page(page)
@@ -266,22 +260,22 @@ class AssistantRunner
266
260
  def create_full_featured_assistant
267
261
  assistant = Gtk::Assistant.new
268
262
  assistant.set_default_size(400, 300)
269
- assistant.signal_connect('cancel') do
263
+ assistant.signal_connect("cancel") do
270
264
  puts "cancel"
271
265
  assistant.hide
272
266
  end
273
- assistant.signal_connect('close') do
267
+ assistant.signal_connect("close") do
274
268
  puts "close"
275
269
  assistant.hide
276
270
  end
277
- assistant.signal_connect('apply') do
271
+ assistant.signal_connect("apply") do
278
272
  puts "apply"
279
273
  end
280
- assistant.signal_connect('prepare') do |_assistant, page|
274
+ assistant.signal_connect("prepare") do |_assistant, page|
281
275
  prepare_cb(_assistant, page)
282
276
  end
283
277
 
284
- button = Gtk::Button.new(Gtk::Stock::STOP)
278
+ button = Gtk::Button.new(:stock_id => Gtk::Stock::STOP)
285
279
  button.show
286
280
  assistant.add_action_widget(button)
287
281
 
@@ -319,29 +313,29 @@ end
319
313
 
320
314
  runner = AssistantRunner.new
321
315
  buttons = [
322
- [ 'simple assistant', proc { runner.run_simple_assistant } ],
323
- [ 'generous assistant', proc { runner.run_generous_assistant } ],
324
- [ 'nonlinear assistant', proc { runner.run_nonlinear_assistant } ],
325
- [ 'full featured assistant', proc { runner.run_full_featured_assistant } ],
316
+ [ "simple assistant", proc { runner.run_simple_assistant } ],
317
+ [ "generous assistant", proc { runner.run_generous_assistant } ],
318
+ [ "nonlinear assistant", proc { runner.run_nonlinear_assistant } ],
319
+ [ "full featured assistant", proc { runner.run_full_featured_assistant } ],
326
320
  ]
327
321
 
328
- if ENV['RTL']
322
+ if ENV["RTL"]
329
323
  Gtk::Widget.default_direction = Gtk::Widget::TEXT_DIR_RTL
330
324
  end
331
325
 
332
- window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
333
- window.signal_connect('destroy') { Gtk.main_quit }
334
- window.signal_connect('delete-event') { false }
326
+ window = Gtk::Window.new(:toplevel)
327
+ window.signal_connect("destroy") { Gtk.main_quit }
328
+ window.signal_connect("delete-event") { false }
335
329
 
336
- box = Gtk::VBox.new(false, 6)
330
+ box = Gtk::Box.new(:vertical, 6)
337
331
  window.add(box)
338
332
 
339
333
  buttons.each do |label, callback|
340
- button = Gtk::Button.new(label)
341
- button.signal_connect('clicked') do
334
+ button = Gtk::Button.new(:label => label)
335
+ button.signal_connect("clicked") do
342
336
  callback.call
343
337
  end
344
- box.pack_start(button, true, true, 0)
338
+ box.pack_start(button, :expand => true, :fill => true, :padding => 0)
345
339
  end
346
340
  window.show_all
347
341
  Gtk.main
@@ -4,7 +4,7 @@
4
4
 
5
5
  Original: gtkcairo sample by Evan Martins.
6
6
 
7
- Copyright (c) 2005,2006 Ruby-GNOME2 Project Team
7
+ Copyright (c) 2005,2006 Ruby-GNOME2 Project Team
8
8
  This program is licenced under the same licence as Ruby-GNOME2.
9
9
 
10
10
  $Id: cairo-pong.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
@@ -20,7 +20,7 @@ module Pong
20
20
  class CenteredItem
21
21
  attr_accessor :x, :y
22
22
  attr_reader :width, :height
23
-
23
+
24
24
  def initialize(x, y, width, height)
25
25
  @x = x
26
26
  @y = y
@@ -31,15 +31,15 @@ module Pong
31
31
  def min_x
32
32
  @x - @width / 2
33
33
  end
34
-
34
+
35
35
  def max_x
36
36
  @x + @width / 2
37
37
  end
38
-
38
+
39
39
  def min_y
40
40
  @y - @height / 2
41
41
  end
42
-
42
+
43
43
  def max_y
44
44
  @y + @height / 2
45
45
  end
@@ -53,7 +53,7 @@ module Pong
53
53
  cr.fill
54
54
  end
55
55
  end
56
-
56
+
57
57
  class CenteredRect < CenteredItem
58
58
  def draw(cr)
59
59
  cr.translate(min_x, min_y)
@@ -62,7 +62,7 @@ module Pong
62
62
  cr.fill
63
63
  end
64
64
  end
65
-
65
+
66
66
  class Ball < CenteredCircle
67
67
  attr_accessor :dx, :dy
68
68
  def initialize(dx=0.02, dy=0.02)
@@ -70,7 +70,7 @@ module Pong
70
70
  @dx = dx
71
71
  @dy = dy
72
72
  end
73
-
73
+
74
74
  def update
75
75
  @x += @dx
76
76
  @y += @dy
@@ -83,7 +83,7 @@ module Pong
83
83
  @y -= min_y
84
84
  @dy *= -1
85
85
  end
86
-
86
+
87
87
  if max_x > 1
88
88
  @x = 1 - (max_x - 1)
89
89
  @dx *= -1
@@ -93,13 +93,13 @@ module Pong
93
93
  end
94
94
  end
95
95
  end
96
-
96
+
97
97
  class Paddle < CenteredRect
98
98
  def initialize(field, x, y)
99
99
  super(x, y, 0.05, 0.3)
100
100
  @field = field
101
101
  end
102
-
102
+
103
103
  def update(ball)
104
104
  # is the ball coming towards us?
105
105
  if (ball.x < @x and ball.dx > 0) or
@@ -112,7 +112,7 @@ module Pong
112
112
  def ball_hit?(ball)
113
113
  ball.y > min_y and ball.y < max_y
114
114
  end
115
-
115
+
116
116
  def update_ball(ball)
117
117
  if ball_hit?(ball)
118
118
  if ball.min_x < @x and ball.max_x > min_x # hit our left side
@@ -128,16 +128,16 @@ module Pong
128
128
 
129
129
  class Field
130
130
  attr_accessor :width, :height
131
-
131
+
132
132
  def initialize(margin=0.05)
133
133
  @margin = margin
134
-
134
+
135
135
  @left_paddle = Paddle.new(self, @margin, 0.5)
136
136
  @right_paddle = Paddle.new(self, 1 - @margin, 0.7)
137
137
  @paddles = [@left_paddle, @right_paddle]
138
138
  @ball = Ball.new
139
139
  end
140
-
140
+
141
141
  def update
142
142
  @paddles.each do |paddle|
143
143
  paddle.update(@ball)
@@ -147,7 +147,7 @@ module Pong
147
147
  paddle.update_ball(@ball)
148
148
  end
149
149
  end
150
-
150
+
151
151
  def draw(cr)
152
152
  cr.set_source_rgba(1, 1, 1)
153
153
  cr.rectangle(0, 0, 1, 1)
@@ -160,7 +160,7 @@ module Pong
160
160
  cr.save {paddle.draw(cr)}
161
161
  end
162
162
  end
163
-
163
+
164
164
  cr.set_source_rgba(0, 0, 0)
165
165
  cr.save {@ball.draw(cr)}
166
166
  end
@@ -170,9 +170,9 @@ module Pong
170
170
  def initialize(speed=30)
171
171
  super()
172
172
  @speed = speed
173
-
174
- self.title = 'Pong Demonstration'
175
- signal_connect('destroy') { Gtk.main_quit }
173
+
174
+ self.title = "Pong Demonstration"
175
+ signal_connect("destroy") { Gtk.main_quit }
176
176
  signal_connect("key_press_event") do |widget, event|
177
177
  if event.state.control_mask? and event.keyval == Gdk::Keyval::GDK_q
178
178
  destroy
@@ -189,20 +189,22 @@ module Pong
189
189
  @drawing_area = Gtk::DrawingArea.new
190
190
  set_draw
191
191
 
192
- vb = Gtk::VBox.new(false, 5)
192
+ vb = Gtk::Box.new(:vertical, 5)
193
193
  vb.border_width = 10
194
- vb.pack_start(@drawing_area, true, true, 0)
194
+ vb.pack_start(@drawing_area, :expand => true,
195
+ :fill => true,
196
+ :padding => 0)
195
197
  vb.show_all
196
198
  add(vb)
197
199
 
198
- Gtk.timeout_add(@speed) do
200
+ GLib::Timeout.add(@speed) do
199
201
  @field.update
200
202
  @drawing_area.queue_draw unless @drawing_area.destroyed?
201
203
  end
202
204
  end
203
205
 
204
206
  def set_draw
205
- @drawing_area.signal_connect('draw') do |widget, cr|
207
+ @drawing_area.signal_connect("draw") do |widget, cr|
206
208
  window = widget.window
207
209
  cr.scale(window.width, window.height)
208
210
  @field.draw(cr)