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

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.
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
@@ -38,7 +38,7 @@ event.colormap = event.screen.rgba_colormap
38
38
  # that "transparency" is the background colour for a widget.
39
39
  event.app_paintable = true
40
40
 
41
- event.signal_connect('expose-event') do |widget, event|
41
+ event.signal_connect('draw') do |widget, event|
42
42
  # This function simply draws a transparency onto a widget on the area
43
43
  # for which it receives expose events. This is intended to give the
44
44
  # event box a "transparent" background.
@@ -72,7 +72,7 @@ event.window.composited = true
72
72
  # Note that we do _after_ so that the normal (red) background is drawn
73
73
  # by gtk before our compositing occurs.
74
74
  #
75
- window.signal_connect_after('expose-event') do |widget, event|
75
+ window.signal_connect_after('draw') do |widget, event|
76
76
  # This function performs the actual compositing of the event box onto
77
77
  # the already-existing background of the window at 50% normal opacity.
78
78
  #
data/sample/misc/dnd.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  $Id: dnd.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $
9
9
  =end
10
10
 
11
- require 'gtk3'
11
+ require "gtk3"
12
12
 
13
13
  class SrcWindow < Gtk::Window
14
14
  def initialize
@@ -16,19 +16,18 @@ class SrcWindow < Gtk::Window
16
16
  @label = Gtk::Label.new("Drag here!")
17
17
  add(@label)
18
18
  set_default_size(100, 100)
19
- drag_source_set(Gdk::Window::ModifierType::BUTTON1_MASK |
20
- Gdk::Window::ModifierType::BUTTON2_MASK,
21
- [["test", Gtk::Drag::TargetFlags::SAME_APP, 12345]],
22
- Gdk::DragContext::Action::COPY |
23
- Gdk::DragContext::Action::MOVE)
24
- signal_connect("drag_data_get") do |widget, context, selection_data, info, time|
25
- # selection_data.set("text/uri-list", 8, "hoge.txt")
26
- selection_data.set(Gdk::Selection::TYPE_STRING, "hoge.txt")
19
+ drag_source_set(Gdk::Window::ModifierType::BUTTON1_MASK |
20
+ Gdk::Window::ModifierType::BUTTON2_MASK,
21
+ [["test", Gtk::Drag::TargetFlags::SAME_APP, 12345]],
22
+ Gdk::DragContext::Action::COPY |
23
+ Gdk::DragContext::Action::MOVE)
24
+ signal_connect("drag-data-get") do |widget, context, selection_data, info, time|
25
+ # selection_data.set("text/uri-list", 8, "hoge.txt")
26
+ selection_data.set(Gdk::Selection::TYPE_STRING, "hoge.txt")
27
27
  end
28
28
  end
29
29
  end
30
30
 
31
-
32
31
  class DestWindow < Gtk::Window
33
32
  def initialize
34
33
  super("Dest Window")
@@ -36,20 +35,22 @@ class DestWindow < Gtk::Window
36
35
  @label = Gtk::Label.new("Drop here!")
37
36
  add(@label)
38
37
  set_default_size(100, 100)
39
- drag_dest_set(Gtk::Drag::DestDefaults::MOTION | Gtk::Drag::DestDefaults::HIGHLIGHT,
40
- [["test", :same_app, 12345]],
41
- Gdk::DragContext::Action::COPY|Gdk::DragContext::Action::MOVE)
42
-
43
- signal_connect("drag-data-received") do |w, dc, x, y, selectiondata, info, time|
44
- dc.targets.each do |target|
38
+ drag_dest_set(Gtk::Drag::DestDefaults::MOTION |
39
+ Gtk::Drag::DestDefaults::HIGHLIGHT,
40
+ [["test", :same_app, 12345]],
41
+ Gdk::DragContext::Action::COPY |
42
+ Gdk::DragContext::Action::MOVE)
43
+
44
+ signal_connect("drag-data-received") do |widget, context, x, y, selection_data, info, time|
45
+ context.targets.each do |target|
45
46
  if target.name == "test" ||
46
- selectiondata.type == Gdk::Selection::TYPE_STRING
47
- puts selectiondata.data
47
+ selection_data.type == Gdk::Selection::TYPE_STRING
48
+ puts selection_data.data
48
49
  end
49
50
  end
50
51
  end
51
- signal_connect("drag-drop") do |w, dc, x, y, time|
52
- w.drag_get_data(dc, dc.targets[0], time)
52
+ signal_connect("drag-drop") do |widget, context, x, y, time|
53
+ widget.drag_get_data(context, context.targets[0], time)
53
54
  end
54
55
  end
55
56
  end
@@ -57,8 +58,7 @@ end
57
58
  win1 = SrcWindow.new
58
59
  win2 = DestWindow.new
59
60
 
60
- win1.show_all.signal_connect("destroy"){Gtk.main_quit}
61
- win2.show_all.signal_connect("destroy"){Gtk.main_quit}
61
+ win1.show_all.signal_connect("destroy") {Gtk.main_quit}
62
+ win2.show_all.signal_connect("destroy") {Gtk.main_quit}
62
63
 
63
64
  Gtk.main
64
-
@@ -1,6 +1,7 @@
1
1
  =begin
2
2
  drag-move.rb - Move widget by drag sample script.
3
3
 
4
+ Copyright (C) 2011-2014 Ruby-GNOME2 Project Team
4
5
  Copyright (C) 2006 Kouhei Sutou
5
6
  This program is licenced under the same licence as Ruby-GNOME2.
6
7
 
@@ -8,7 +9,7 @@
8
9
  $Id: drag-move.rb,v 1.2 2006/06/17 13:18:12 mutoh Exp $
9
10
  =end
10
11
 
11
- require 'gtk3'
12
+ require "gtk3"
12
13
 
13
14
  class DraggableWidget < Gtk::EventBox
14
15
  def initialize
@@ -40,7 +41,7 @@ class DraggableWidget < Gtk::EventBox
40
41
 
41
42
  private
42
43
  def set_button_press_event
43
- signal_connect("button_press_event") do |widget, event|
44
+ signal_connect("button-press-event") do |widget, event|
44
45
  if event.button == @drag_button
45
46
  Gtk.grab_add(widget)
46
47
  x, y, w, h = widget.allocation.to_a
@@ -52,7 +53,7 @@ class DraggableWidget < Gtk::EventBox
52
53
  end
53
54
 
54
55
  def set_motion_notify_event
55
- signal_connect("motion_notify_event") do |widget, event|
56
+ signal_connect("motion-notify-event") do |widget, event|
56
57
  if dragging?
57
58
  drag_motion(event.x_root, event.y_root)
58
59
  else
@@ -62,7 +63,7 @@ class DraggableWidget < Gtk::EventBox
62
63
  end
63
64
 
64
65
  def set_button_release_event
65
- signal_connect("button_release_event") do |widget, event|
66
+ signal_connect("button-release-event") do |widget, event|
66
67
  if event.button == @drag_button
67
68
  Gtk.grab_remove(widget)
68
69
  drag_end
@@ -73,7 +74,7 @@ class DraggableWidget < Gtk::EventBox
73
74
  end
74
75
 
75
76
  def set_drag_move_position_event
76
- signal_connect("drag_move_position") do |widget, x, y|
77
+ signal_connect("drag-move-position") do |widget, x, y|
77
78
  if layout
78
79
  layout.move(widget, x, y)
79
80
  true
@@ -101,7 +102,7 @@ class DraggableWidget < Gtk::EventBox
101
102
  false
102
103
  end
103
104
  end
104
-
105
+
105
106
  def drag_end
106
107
  @dragging = false
107
108
  true
@@ -109,7 +110,7 @@ class DraggableWidget < Gtk::EventBox
109
110
  end
110
111
 
111
112
  window = Gtk::Window.new("Draggable Widget sample")
112
- window.signal_connect("destroy"){Gtk.main_quit}
113
+ window.signal_connect("destroy") {Gtk.main_quit}
113
114
 
114
115
  layout = Gtk::Layout.new
115
116
 
@@ -117,10 +118,17 @@ draggable_widget = DraggableWidget.new
117
118
  draggable_widget.set_size_request(50, 50)
118
119
  layout.put(draggable_widget, 75, 75)
119
120
 
120
- draggable_widget.signal_connect("expose_event") do |widget, event|
121
- x, y, w, h = widget.allocation.to_a
122
- fg = Gdk::GC.new(widget.window)
123
- widget.window.draw_arc(fg, true, x, y, w, h, 0 * 64, 360 * 64)
121
+ draggable_widget.signal_connect("draw") do |widget, context|
122
+ width = widget.width_request
123
+ height = widget.height_request
124
+ context.fill do
125
+ center_x = width / 2
126
+ center_y = height / 2
127
+ radius = width / 2
128
+ start_angle = 0 * Math::PI
129
+ stop_angle = 2 * Math::PI
130
+ context.arc(center_x, center_y, radius, start_angle, stop_angle)
131
+ end
124
132
  false
125
133
  end
126
134
 
@@ -12,7 +12,7 @@ require 'gtk3'
12
12
  class Canvas < Gtk::DrawingArea
13
13
  def initialize
14
14
  super
15
- signal_connect("expose_event") { |w,e| expose_event(w,e) }
15
+ signal_connect("draw") { |w,e| expose_event(w,e) }
16
16
  signal_connect("configure_event") { |w, e| configure_event(w,e) }
17
17
  @buffer = nil
18
18
  @bgc = nil
@@ -214,7 +214,7 @@ class Gesture < Gtk::EventBox
214
214
  end
215
215
 
216
216
  def set_expose_event
217
- signal_connect("expose_event") do |widget, event|
217
+ signal_connect("draw") do |widget, event|
218
218
  if @processor.started?
219
219
  cr = widget.window.create_cairo_context
220
220
 
@@ -372,7 +372,7 @@ layout = Layout.new
372
372
 
373
373
  gestured_widget = GesturedWidget.new
374
374
  gestured_widget.set_size_request(50, 50)
375
- gestured_widget.signal_connect("expose_event") do |widget, event|
375
+ gestured_widget.signal_connect("draw") do |widget, event|
376
376
  x, y, w, h = widget.allocation.to_a
377
377
  cr = widget.window.create_cairo_context
378
378
  cr.set_source_rgba([0.8, 0.8, 0.3, 1])
@@ -388,7 +388,7 @@ layout.put(gestured_widget, 75, 75)
388
388
 
389
389
  gestured_widget2 = GesturedWidget.new
390
390
  gestured_widget2.set_size_request(100, 50)
391
- gestured_widget2.signal_connect("expose_event") do |widget, event|
391
+ gestured_widget2.signal_connect("draw") do |widget, event|
392
392
  x, y, w, h = widget.allocation.to_a
393
393
  cr = widget.window.create_cairo_context
394
394
  cr.set_source_rgba([0.3, 0.3, 0.8, 1])
@@ -46,7 +46,7 @@ background = Gdk::Color.new(65535, 65535, 65535)
46
46
  Gdk::Colormap.system.alloc_color(background, false, true)
47
47
  win.window.background = background
48
48
 
49
- win.signal_connect("expose_event") do
49
+ win.signal_connect("draw") do
50
50
  (0...N_WORDS).each do |i|
51
51
  rotated_matrix = matrix.dup
52
52
  angle = 360 * i / N_WORDS.to_f
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env ruby
1
2
  =begin
2
3
  properties.rb -
3
4
 
@@ -26,7 +26,7 @@ end
26
26
 
27
27
  d = Gtk::DrawingArea.new
28
28
  gc = Gdk::GC.new(w.window)
29
- d.signal_connect('expose-event') do |w, e|
29
+ d.signal_connect('draw') do |w, e|
30
30
  unless e.count > 0
31
31
  width = w.allocation.width
32
32
  height = w.allocation.height
@@ -178,7 +178,7 @@ if Gdk.cairo_available?
178
178
  drawingarea = Gtk::DrawingArea.new
179
179
  drawingarea.set_size_request(320, 240)
180
180
  drawingarea.has_tooltip = true
181
- drawingarea.signal_connect('expose_event') {
181
+ drawingarea.signal_connect('draw') {
182
182
  cr = drawingarea.window.create_cairo_context
183
183
  cr.rectangle(0, 0, drawingarea.allocation.width, drawingarea.allocation.height)
184
184
  cr.set_source_rgb(1.0, 1.0, 1.0)
@@ -0,0 +1,31 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2014 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ class TestGtkAccessible < Test::Unit::TestCase
20
+ include GtkTestUtils
21
+
22
+ def setup
23
+ @accessible = Gtk::Accessible.new
24
+ end
25
+
26
+ def test_widget_accessors
27
+ widget = Gtk::Box.new(:horizontal)
28
+ @accessible.widget = widget
29
+ assert_equal(widget, @accessible.widget)
30
+ end
31
+ end
@@ -1,3 +1,21 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2014 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
1
19
  class TestGtkEntry < Test::Unit::TestCase
2
20
  include GtkTestUtils
3
21
 
@@ -13,4 +31,22 @@ class TestGtkEntry < Test::Unit::TestCase
13
31
  @entry.cursor_hadjustment = adjustment
14
32
  assert_equal(adjustment, @entry.cursor_hadjustment)
15
33
  end
34
+
35
+ def test_completion_accsessors
36
+ entry_completion = Gtk::EntryCompletion.new
37
+ @entry.completion = entry_completion
38
+ assert_equal(entry_completion, @entry.completion)
39
+ end
40
+
41
+ class TestEnum < self
42
+ def test_input_purpose_enum
43
+ only_gtk_version(3, 6, 0)
44
+ assert_const_defined(Gtk::InputPurpose, :ALPHA)
45
+ end
46
+
47
+ def test_input_hints_enum
48
+ only_gtk_version(3, 6, 0)
49
+ assert_const_defined(Gtk::InputHints, :SPELLCHECK)
50
+ end
51
+ end
16
52
  end
@@ -0,0 +1,66 @@
1
+ # Copyright (C) 2014 Ruby-GNOME2 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 TestGtkHeaderBar < Test::Unit::TestCase
18
+ include GtkTestUtils
19
+
20
+ def setup
21
+ only_gtk_version(3, 10, 0)
22
+ @header_bar = Gtk::HeaderBar.new
23
+ end
24
+
25
+ def test_custom_title_accessros
26
+ widget = Gtk::EventBox.new
27
+ @header_bar.custom_title = widget
28
+ assert_equal(widget, @header_bar.custom_title)
29
+ end
30
+
31
+ def test_title_accessors
32
+ header_bar_title = "no title"
33
+ @header_bar.title = header_bar_title
34
+ assert_equal(header_bar_title, @header_bar.title)
35
+ end
36
+
37
+ def test_subtitle_accessors
38
+ header_bar_subtitle = "sub title"
39
+ @header_bar.subtitle = header_bar_subtitle
40
+ assert_equal(header_bar_subtitle, @header_bar.subtitle)
41
+ end
42
+
43
+ def test_show_close_button_accessors
44
+ @header_bar.show_close_button = true
45
+ assert_equal(true, @header_bar.show_close_button?)
46
+ end
47
+
48
+ def test_spacing_accessors
49
+ spacing_size = 10
50
+ @header_bar.spacing = spacing_size
51
+ assert_equal(spacing_size, @header_bar.spacing)
52
+ end
53
+
54
+ def test_pack
55
+ start1 = Gtk::EventBox.new
56
+ start2 = Gtk::EventBox.new
57
+ end1 = Gtk::EventBox.new
58
+ end2 = Gtk::EventBox.new
59
+ @header_bar.pack_start(start1)
60
+ @header_bar.pack_start(start2)
61
+ @header_bar.pack_end(end1)
62
+ @header_bar.pack_end(end2)
63
+ assert_equal([start1, start2, end1, end2],
64
+ @header_bar.children)
65
+ end
66
+ end
@@ -0,0 +1,41 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2014 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ class TestGtkIconView < Test::Unit::TestCase
20
+ include GtkTestUtils
21
+
22
+ class TestGetCellRect < self
23
+ def setup
24
+ only_gtk_version(3, 6, 0)
25
+ model = Gtk::ListStore.new(String, Gdk::Pixbuf)
26
+ iter = model.append
27
+ model.set_values(iter, ["label", nil])
28
+ @path = iter.path
29
+ @icon_view = Gtk::IconView.new(model)
30
+ end
31
+
32
+ def test_found
33
+ assert_kind_of(Gdk::Rectangle, @icon_view.get_cell_rect(@path))
34
+ end
35
+
36
+ def test_not_found
37
+ not_found_path = Gtk::TreePath.new(@path.indices.first + 1)
38
+ assert_nil(@icon_view.get_cell_rect(not_found_path))
39
+ end
40
+ end
41
+ end