clutter-gtk 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,176 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This sample code is a port of clutter-gtk/examples/gtk-clutter-test-scroll.c.
4
+ # It is licensed under the terms of the GNU Lesser General Public
5
+ # License, version 2.1 or (at your option) later.
6
+ #
7
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
8
+ #
9
+ # This library is free software; you can redistribute it and/or
10
+ # modify it under the terms of the GNU Lesser General Public
11
+ # License as published by the Free Software Foundation; either
12
+ # version 2.1 of the License, or (at your option) any later version.
13
+ #
14
+ # This library is distributed in the hope that it will be useful,
15
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
+ # Lesser General Public License for more details.
18
+ #
19
+ # You should have received a copy of the GNU Lesser General Public
20
+ # License along with this library; if not, write to the Free Software
21
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
+
23
+ require "clutter-gtk"
24
+
25
+ ClutterGtk.init
26
+
27
+ N_WIDGETS = 5
28
+ WINDOW_WIDTH = 400
29
+ WINDOW_HEIGHT = 400
30
+ RADIUS = 80
31
+
32
+ do_rotate_p = true
33
+
34
+ window = Gtk::Window.new
35
+ window.signal_connect("destroy") do
36
+ Gtk.main_quit
37
+ end
38
+
39
+ vbox = Gtk::Box.new(:vertical, 6)
40
+ window.add(vbox)
41
+
42
+ clutter = ClutterGtk::Embed.new
43
+ clutter.set_size_request(WINDOW_WIDTH, WINDOW_HEIGHT)
44
+
45
+ vbox.add(clutter)
46
+
47
+ stage = clutter.stage
48
+
49
+ button = Gtk::Button.new(:stock_id => Gtk::Stock::QUIT)
50
+ button.signal_connect("clicked") do |_button|
51
+ window.destroy
52
+ end
53
+ vbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
54
+
55
+ # and its background color
56
+ stage.background_color = Clutter::Color.new(0x61, 0x64, 0x8c, 0xff)
57
+
58
+ widgets = []
59
+
60
+ # create a new group to hold multiple actors in a group
61
+ group = Clutter::Group.new
62
+
63
+ create_gtk_actor = lambda do
64
+ gtk_actor = ClutterGtk::Actor.new
65
+ bin = gtk_actor.widget
66
+
67
+ scroll = Gtk::ScrolledWindow.new
68
+ scroll.set_policy(:never, :automatic)
69
+ bin.add(scroll)
70
+
71
+ vbox = Gtk::Box.new(:vertical, 6)
72
+ scroll.add_with_viewport(vbox)
73
+
74
+ button = Gtk::Button.new(:label => "A Button")
75
+ vbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
76
+
77
+ button.signal_connect("clicked") do |_button|
78
+ puts("button clicked")
79
+ label = Gtk::Label.new("A new label")
80
+ label.show
81
+ vbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
82
+ end
83
+
84
+ 6.times do |i|
85
+ button = Gtk::CheckButton.new("Another button")
86
+ vbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
87
+ end
88
+
89
+ entry = Gtk::Entry.new
90
+ vbox.pack_start(entry, :expand => false, :fill => false, :padding => 0)
91
+
92
+ bin.show_all
93
+
94
+ gtk_actor
95
+ end
96
+
97
+ N_WIDGETS.times do |i|
98
+ widget = create_gtk_actor.call
99
+ widgets[i] = widget
100
+
101
+ # Place around a circle
102
+ w = widgets.first.width
103
+ h = widgets.first.height
104
+
105
+ x = WINDOW_WIDTH / 2 +
106
+ RADIUS * Math.cos(i * 2 * Math::PI / (N_WIDGETS)) - w / 2
107
+ y = WINDOW_HEIGHT / 2 +
108
+ RADIUS * Math.sin(i * 2 * Math::PI / (N_WIDGETS)) - h / 2
109
+
110
+ widget.set_position(x, y)
111
+
112
+ # Add to our group group
113
+ group.add_actor(widget)
114
+ end
115
+
116
+ # Add the group to the stage
117
+ stage.add_actor(group)
118
+ stage.signal_connect("button-press-event") do |_stage, event|
119
+ x, y = event.coords
120
+
121
+ actor = _stage.get_actor_at_pos(:all, x, y)
122
+ puts("click at #{x}, #{y} -> #{actor.gtype.name}:#{actor}")
123
+ if !actor.is_a?(Clutter::Stage) and !actor.is_a?(Clutter::Group)
124
+ actor.hide
125
+ end
126
+ end
127
+ stage.signal_connect("key-release-event") do |_sage, event|
128
+ unichar = [event.key_unicode].pack("U*")
129
+ puts("*** key press event (key:#{unichar}) ***")
130
+
131
+ if event.key_symbol == Clutter::Keys::KEY_q
132
+ Gtk.main_quit
133
+ end
134
+ end
135
+
136
+ window.show_all
137
+
138
+ # Only show the actors after parent show otherwise it will just be
139
+ # unrealized when the clutter foreign window is set. widget_show
140
+ # will call show on the stage.
141
+ group.show_all
142
+
143
+ # Create a timeline to manage animation
144
+ timeline = Clutter::Timeline.new(6000)
145
+ timeline.loop = true
146
+
147
+ # fire a callback for frame change
148
+ timeline.signal_connect("new-frame") do |_timeline, m_secs|
149
+ rotation = _timeline.progress * 360.0
150
+ if do_rotate_p
151
+ # Rotate everything clockwise about stage center
152
+ group.set_rotation(:z_axis,
153
+ rotation,
154
+ WINDOW_WIDTH / 2,
155
+ WINDOW_HEIGHT / 2,
156
+ 0)
157
+
158
+ widgets.each do |widget|
159
+ # rotate each widget around its center
160
+ w = widget.width
161
+ h = widget.height
162
+
163
+ widget.set_rotation(:z_axis,
164
+ -(2 * rotation),
165
+ w / 2,
166
+ h / 2,
167
+ 0)
168
+ widget.opacity = 50 * Math.sin(2 * Math::PI * rotation / 360) + (255 - 50)
169
+ end
170
+ end
171
+ end
172
+
173
+ # and start it
174
+ timeline.start
175
+
176
+ Gtk.main
data/sample/test.rb ADDED
@@ -0,0 +1,171 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This sample code is a port of
4
+ # clutter-gtk/examples/gtk-clutter-test.c. The image file used in
5
+ # this sample code is copied from
6
+ # clutter-gtk/examples/redhand.png. They are licensed under the terms
7
+ # of the GNU Lesser General Public License, version 2.1 or (at your
8
+ # option) later.
9
+ #
10
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
11
+ #
12
+ # This library is free software; you can redistribute it and/or
13
+ # modify it under the terms of the GNU Lesser General Public
14
+ # License as published by the Free Software Foundation; either
15
+ # version 2.1 of the License, or (at your option) any later version.
16
+ #
17
+ # This library is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
+ # Lesser General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public
23
+ # License along with this library; if not, write to the Free Software
24
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25
+
26
+ require "clutter-gtk"
27
+ require "gdk_pixbuf2"
28
+
29
+ ClutterGtk.init
30
+
31
+ N_HANDS = 4
32
+ WINDOW_WIDTH = 400
33
+ WINDOW_HEIGHT = 400
34
+ RADIUS = 150
35
+
36
+ fade_p = false
37
+ fullscreen_p = false
38
+
39
+ pixbuf = Gdk::Pixbuf.new(File.expand_path("redhand.png", File.dirname(__FILE__)))
40
+
41
+ window = Gtk::Window.new
42
+ window.set_default_size(WINDOW_WIDTH, WINDOW_HEIGHT)
43
+ window.title = "Clutter Embedding"
44
+ window.signal_connect("destroy") do
45
+ Gtk.main_quit
46
+ end
47
+
48
+ vbox = Gtk::Grid.new
49
+ vbox.orientation = :vertical
50
+ vbox.hexpand = true
51
+ vbox.vexpand = true
52
+ window.add(vbox)
53
+
54
+ clutter = ClutterGtk::Embed.new
55
+ vbox.add(clutter)
56
+
57
+ stage = clutter.stage
58
+ stage.background_color = Clutter::Color.new(:sky_blue_light)
59
+
60
+ label = Gtk::Label.new("This is a label")
61
+ vbox.add(label)
62
+ label.hexpand = true
63
+
64
+ button = Gtk::Button.new(:label => "This is a button...clicky")
65
+ button.signal_connect("clicked") do |_button|
66
+ fade_p = !fade_p
67
+ end
68
+ vbox.add(button)
69
+ button.hexpand = true
70
+
71
+ button = Gtk::Button.new(:label => "Fullscreen")
72
+ button.image = Gtk::Image.new(:stock => Gtk::Stock::FULLSCREEN, :size => :button)
73
+ button.signal_connect("clicked") do |_button|
74
+ if fullscreen_p
75
+ window.unfullscreen
76
+ fullscreen_p = false
77
+ else
78
+ window.fullscreen
79
+ fullscreen_p = true
80
+ end
81
+ end
82
+ vbox.add(button)
83
+ button.hexpand = true
84
+
85
+ button = Gtk::Button.new(:stock_id => Gtk::Stock::QUIT)
86
+ button.signal_connect("clicked") do |_button|
87
+ _button.destroy
88
+ end
89
+ vbox.add(button)
90
+ button.hexpand = true
91
+
92
+ group = Clutter::Actor.new
93
+ hands = []
94
+ N_HANDS.times do |i|
95
+ if i.zero?
96
+ hands[i] = ClutterGtk::Texture.new
97
+ hands[i].set_from_pixbuf(pixbuf)
98
+ else
99
+ hands[i] = Clutter::Clone.new(hands[0])
100
+ end
101
+
102
+ # Place around a circle
103
+ w = hands[0].width
104
+ h = hands[0].height
105
+
106
+ x = WINDOW_WIDTH / 2 + RADIUS * Math.cos(i * Math::PI / (N_HANDS / 2)) - w / 2
107
+ y = WINDOW_HEIGHT / 2 + RADIUS * Math.sin(i * Math::PI / (N_HANDS / 2)) - h / 2
108
+
109
+ hands[i].set_position(x, y)
110
+
111
+ # Add to our group group
112
+ group.add_child(hands[i])
113
+ end
114
+
115
+ # Add the group to the stage
116
+ stage.add_child(group)
117
+
118
+ constraint = Clutter::AlignConstraint.new(stage, :x_axis, 0.5)
119
+ group.add_constraint(constraint)
120
+ constraint = Clutter::AlignConstraint.new(stage, :y_axis, 0.5)
121
+ group.add_constraint(constraint)
122
+
123
+ stage.signal_connect("button-press-event") do |_stage, event|
124
+ x, y = event.coords
125
+ actor = _stage.get_actor_at_pos(:all, x, y)
126
+ if actor.is_a?(ClutterGtk::Texture) or actor.is_a?(Clutter::Clone)
127
+ actor.hide
128
+ end
129
+
130
+ Clutter::Event::STOP
131
+ end
132
+ stage.signal_connect("key-release-event") do |_stage, event|
133
+ puts("*** key press event (key:#{[event.key_unicode].pack('U*')}) ***")
134
+ case event.key_symbol
135
+ when Clutter::Keys::KEY_q
136
+ Gtk.main_quit
137
+ when Clutter::Keys::KEY_r
138
+ N_HANDS.times do |i|
139
+ hands[i].show
140
+ end
141
+ end
142
+
143
+ Clutter::Event::STOP
144
+ end
145
+
146
+ window.show_all
147
+
148
+ # Create a timeline to manage animation
149
+ timeline = Clutter::Timeline.new(6000)
150
+ timeline.repeat_count = -1
151
+
152
+ # fire a callback for frame change
153
+ timeline.signal_connect("new-frame") do |_timeline, msecs|
154
+ rotation = _timeline.progress * 360.0
155
+ group.set_rotation(:z_axis, rotation, WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2, 0)
156
+ N_HANDS.times do |i|
157
+ hands[i].set_rotation(:z_axis,
158
+ -(6.0 * rotation),
159
+ hands[i].width / 2,
160
+ hands[i].height / 2,
161
+ 0)
162
+ if fade_p
163
+ hands[i].opacity = (255 - (rotation % 255))
164
+ end
165
+ end
166
+ end
167
+
168
+ # and start it
169
+ timeline.start
170
+
171
+ Gtk.main
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This sample code is a port of clutter-gtk/examples/gtk-clutter-window-test.c.
4
+ # It is licensed under the terms of the GNU Lesser General Public
5
+ # License, version 2.1 or (at your option) later.
6
+ #
7
+ # The original header:
8
+ # (c) 2009, Collabora Ltd.
9
+ #
10
+ # Written by Davyd Madeley <davyd.madeley@collabora.co.uk>
11
+ #
12
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
13
+ #
14
+ # This library is free software; you can redistribute it and/or
15
+ # modify it under the terms of the GNU Lesser General Public
16
+ # License as published by the Free Software Foundation; either
17
+ # version 2.1 of the License, or (at your option) any later version.
18
+ #
19
+ # This library is distributed in the hope that it will be useful,
20
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
+ # Lesser General Public License for more details.
23
+ #
24
+ # You should have received a copy of the GNU Lesser General Public
25
+ # License along with this library; if not, write to the Free Software
26
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27
+
28
+ require "clutter-gtk"
29
+ require "gdk_pixbuf2"
30
+
31
+ ClutterGtk.init
32
+
33
+ window = ClutterGtk::Window.new
34
+ window.signal_connect("destroy") do
35
+ Gtk.main_quit
36
+ end
37
+ window.set_default_size(400, 300)
38
+
39
+ NAME_COLUMN = 0
40
+ PIXBUF_COLUMN = 1
41
+ store = Gtk::ListStore.new(String, Gdk::Pixbuf)
42
+ theme = Gtk::IconTheme.default
43
+ [
44
+ "devhelp",
45
+ "empathy",
46
+ "evince",
47
+ "gnome-panel",
48
+ "seahorse",
49
+ "sound-juicer",
50
+ "totem",
51
+ ].each do |icon_name|
52
+ pixbuf = theme.load_icon(icon_name, 48, 0)
53
+ iter = store.append
54
+ iter[0] = icon_name
55
+ iter[1] = pixbuf
56
+ end
57
+
58
+ icon_view = Gtk::IconView.new(store)
59
+ icon_view.text_column = NAME_COLUMN
60
+ icon_view.pixbuf_column = PIXBUF_COLUMN
61
+
62
+ scrolled_window = Gtk::ScrolledWindow.new
63
+ window.add(scrolled_window)
64
+ scrolled_window.add(icon_view)
65
+ scrolled_window.show_all
66
+
67
+ # Widget 2 is a toolbar
68
+ stage = window.stage
69
+
70
+ toolbar = Gtk::Toolbar.new
71
+ [
72
+ Gtk::Stock::ADD,
73
+ Gtk::Stock::BOLD,
74
+ Gtk::Stock::ITALIC,
75
+ Gtk::Stock::CANCEL,
76
+ Gtk::Stock::CDROM,
77
+ Gtk::Stock::CONVERT,
78
+ ].each do |stock_id|
79
+ item = Gtk::ToolButton.new(:stock_id => stock_id)
80
+ toolbar.insert(item, -1)
81
+ end
82
+
83
+ toolbar.show_all
84
+ actor = ClutterGtk::Actor.new(toolbar)
85
+ actor.add_constraint(Clutter::BindConstraint.new(stage, :width, 0.0))
86
+ actor.signal_connect("enter-event") do |_actor, event|
87
+ _actor.save_easing_state do
88
+ _actor.easing_mode = :linear
89
+
90
+ _actor.opacity = 255
91
+ _actor.y = 0
92
+ end
93
+
94
+ Clutter::Event::STOP
95
+ end
96
+
97
+ actor.signal_connect("leave-event") do |_actor, event|
98
+ _actor.save_easing_state do
99
+ _actor.easing_mode = :linear
100
+
101
+ _actor.opacity = 128
102
+ _actor.y = _actor.height * -0.5
103
+ end
104
+
105
+ Clutter::Event::STOP
106
+ end
107
+
108
+ actor.y = actor.height * -0.5
109
+ actor.opacity = 128
110
+ actor.reactive = true
111
+ stage.add_child(actor)
112
+
113
+ window.show_all
114
+
115
+ Gtk.main
@@ -0,0 +1,134 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This sample code is a port of clutter-gtk/examples/gtk-clutter-window-test2.c.
4
+ # It is licensed under the terms of the GNU Lesser General Public
5
+ # License, version 2.1 or (at your option) later.
6
+ #
7
+ # The original header:
8
+ # (c) 2009, Collabora Ltd.
9
+ #
10
+ # Written by Davyd Madeley <davyd.madeley@collabora.co.uk>
11
+ #
12
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
13
+ #
14
+ # This library is free software; you can redistribute it and/or
15
+ # modify it under the terms of the GNU Lesser General Public
16
+ # License as published by the Free Software Foundation; either
17
+ # version 2.1 of the License, or (at your option) any later version.
18
+ #
19
+ # This library is distributed in the hope that it will be useful,
20
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
+ # Lesser General Public License for more details.
23
+ #
24
+ # You should have received a copy of the GNU Lesser General Public
25
+ # License along with this library; if not, write to the Free Software
26
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27
+
28
+ require "clutter-gtk"
29
+ require "gdk_pixbuf2"
30
+
31
+ ClutterGtk.init
32
+
33
+ window = ClutterGtk::Window.new
34
+
35
+ table = Gtk::Grid.new
36
+
37
+ table.hexpand = true
38
+ table.vexpand = true
39
+
40
+ add_button = lambda do |stock_id, row|
41
+ button = Gtk::Button.new(:stock_id => stock_id)
42
+ table.insert_row(row)
43
+ table.insert_column(row)
44
+ table.attach(button, row, row, 1, 1)
45
+
46
+ button.signal_connect("clicked") do |_button|
47
+ puts("button clicked: #{stock_id}")
48
+
49
+ toplevel = _button.toplevel
50
+ if toplevel.is_a?(ClutterGtk::Window)
51
+ # create a texture from the button image
52
+ texture = ClutterGtk::Texture.new
53
+ image = _button.image
54
+ size = image.icon_size
55
+ texture.set_from_stock(_button, stock_id.to_s, size)
56
+
57
+ # position the texture on top of the existing icon
58
+ stage = toplevel.stage
59
+ stage.add_actor(texture)
60
+
61
+ allocation = image.allocation
62
+
63
+ # replace the icon itself
64
+ blank = Gdk::Pixbuf.new(:colorspace => :rgb,
65
+ :has_alpha => true,
66
+ :bits_per_sample => 8,
67
+ :width => allocation.width,
68
+ :height => allocation.height)
69
+ blank.fill!(0x00000000)
70
+ image.pixbuf = blank
71
+
72
+ # animate a fall due to gravity
73
+ toplevel_allocation = toplevel.allocation
74
+ texture.save_easing_state do
75
+ texture.easing_mode = :ease_in_quad
76
+ texture.easing_duration = 200
77
+ texture.set_final_state("x", allocation.x.to_f)
78
+ texture.set_final_state("y", allocation.y.to_f)
79
+ texture.y = toplevel_allocation.height.to_f
80
+ end
81
+
82
+ first_completed_id = texture.signal_connect_after("transitions-completed") do
83
+ image_allocation = image.allocation
84
+
85
+ # do the second animation, have the icon grow out from the middle of the
86
+ # button
87
+ texture.save_easing_state do
88
+ texture.easing_mode = :ease_out_sine
89
+ texture.easing_duration = 100
90
+ texture.set_final_state("x", image_allocation.x.to_f)
91
+ texture.set_final_state("y", image_allocation.y.to_f)
92
+ texture.set_final_state("scale-x", 0.0)
93
+ texture.set_final_state("scale-y", 0.0)
94
+ texture.scale_x = 1.0
95
+ texture.scale_y = 1.0
96
+ texture.set_final_state("scale-gravity", Clutter::Gravity::CENTER)
97
+ end
98
+
99
+ texture.signal_handler_disconnect(first_completed_id)
100
+
101
+ second_completed_id = texture.signal_connect_after("transitions-completed") do
102
+ # undo our changes
103
+ puts("set stock = #{stock_id}, size = #{size}")
104
+ image.icon_size = size
105
+ image.stock = stock_id
106
+ texture.signal_handler_disconnect(second_completed_id)
107
+ texture.destroy
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
113
+
114
+ add_button.call(Gtk::Stock::OK, 0)
115
+ add_button.call(Gtk::Stock::CANCEL, 1)
116
+ add_button.call(Gtk::Stock::CLOSE, 2)
117
+ add_button.call(Gtk::Stock::ABOUT, 3)
118
+ add_button.call(Gtk::Stock::BOLD, 4)
119
+ add_button.call(Gtk::Stock::ITALIC, 5)
120
+
121
+ window.add(table)
122
+ window.show_all
123
+
124
+ # override the gtk-button-images setting, since we kind
125
+ # of rely on this to be true to actually show the stock
126
+ # icon falling off the button
127
+ settings = window.settings
128
+ settings.gtk_button_images = true
129
+
130
+ window.signal_connect("destroy") do
131
+ Gtk.main_quit
132
+ end
133
+
134
+ Gtk.main
@@ -0,0 +1,21 @@
1
+ # Copyright (C) 2013 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
+ require "test-unit"
18
+ require "test/unit/notify"
19
+
20
+ module ClutterGtkTestUtils
21
+ end
data/test/run-test.rb ADDED
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2012 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
+ ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..")
20
+ ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
21
+
22
+ glib_base = File.join(ruby_gnome2_base, "glib2")
23
+ gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
24
+ clutter_base = File.join(ruby_gnome2_base, "clutter")
25
+
26
+ modules = [
27
+ [glib_base, "glib2"],
28
+ [gobject_introspection_base, "gobject-introspection"],
29
+ [clutter_base, "clutter"],
30
+ ]
31
+ modules.each do |target, module_name|
32
+ if system("which make > /dev/null")
33
+ `make -C #{target.dump} > /dev/null` or exit(false)
34
+ end
35
+ $LOAD_PATH.unshift(File.join(target, "ext", module_name))
36
+ $LOAD_PATH.unshift(File.join(target, "lib"))
37
+ end
38
+
39
+ $LOAD_PATH.unshift(File.join(glib_base, "test"))
40
+ require "glib-test-init"
41
+
42
+ $LOAD_PATH.unshift(File.join(gobject_introspection_base, "test"))
43
+ require "gobject-introspection-test-utils"
44
+
45
+ $LOAD_PATH.unshift(File.join(clutter_base, "test"))
46
+ require "clutter-test-utils"
47
+
48
+ require "clutter"
49
+
50
+ exit Test::Unit::AutoRunner.run(true)