[svn-upgrade] Integrating new upstream version, libgtk2-perl (1.212)
Ryan Niebur
15 years ago
0 | 2009-03-08 Torsten Schoenfeld <kaffeetisch@gmx.de> | |
1 | ||
2 | * Gtk2.pm | |
3 | * Makefile | |
4 | * NEWS | |
5 | * README: Unstable release 1.212. | |
6 | ||
7 | 2009-03-08 Torsten Schoenfeld <kaffeetisch@gmx.de> | |
8 | ||
9 | * t/GtkHBox.t: Test that widgets packed into a box are completely | |
10 | freed upon removal even if they previously appeared as a callback | |
11 | argument. This is a test for a recent memory leak fix in Glib. | |
12 | ||
13 | * t/GtkTreeModelIface.t: The leak fix mentioned above causes this | |
14 | test to correctly run FINALIZE_INSTANCE now, so adjust the test | |
15 | plan. | |
16 | ||
17 | 2009-03-08 Torsten Schoenfeld <kaffeetisch@gmx.de> | |
18 | ||
19 | * t/GtkTreeModelFilter.t | |
20 | * xs/GtkTreeModelFilter.xs: Take ownership of objects returned by | |
21 | gtk_tree_model_filter_new to avoid leaking them. Patch by | |
22 | Kevin Ryde. | |
23 | ||
24 | 2009-03-08 Torsten Schoenfeld <kaffeetisch@gmx.de> | |
25 | ||
26 | * t/GtkStyle.t | |
27 | * xs/GtkStyle.xs: Remove the get_property() alias for | |
28 | Gtk2::Style::get() so that calling get_property() on a Gtk2::Style | |
29 | resolves to Glib::Object::get_property(). | |
30 | ||
31 | 2009-03-01 Torsten Schoenfeld <kaffeetisch@gmx.de> | |
32 | ||
33 | * xs/GtkAccelGroup.xs: Remove two FIXME comments which turned out | |
34 | to be incorrect. Patch by Kevin Ryde. | |
35 | ||
36 | 2009-02-22 Torsten Schoenfeld <kaffeetisch@gmx.de> | |
37 | ||
38 | * t/GdkKeys.t: Skip most tests if we can't find a key entry to | |
39 | test against. | |
40 | ||
41 | 2009-02-22 Torsten Schoenfeld <kaffeetisch@gmx.de> | |
42 | ||
43 | * t/00.Gtk2.t: Don't fail if there is no valid DISPLAY. | |
44 | ||
45 | 2009-02-22 Torsten Schoenfeld <kaffeetisch@gmx.de> | |
46 | ||
47 | * pm/TestHelper.pm | |
48 | * pm/Helper.pm | |
49 | * Gtk2.pm: Fix more POD errors. | |
50 | ||
51 | 2009-02-22 Torsten Schoenfeld <kaffeetisch@gmx.de> | |
52 | ||
53 | * xs/Gtk2.xs | |
54 | * xs/GtkTreeModel.xs | |
55 | * xs/GtkWidget.xs | |
56 | * xs/GtkWindow.xs: Fix POD errors reported by podchecker. | |
57 | ||
58 | 2009-02-21 Torsten Schoenfeld <kaffeetisch@gmx.de> | |
59 | ||
60 | * t/GtkStyle.t | |
61 | * xs/GtkStyle.xs: Wrap the gtk_style_get() family of methods as | |
62 | Gtk2::Style::get(), and make Gtk2::Style::get_property() an alias | |
63 | for get(). Patch by Emmanuel Rodriguez. | |
64 | ||
0 | 65 | 2009-02-13 Torsten Schoenfeld <kaffeetisch@gmx.de> |
1 | 66 | |
2 | 67 | * Gtk2.pm |
15 | 15 | # along with this library; if not, write to the Free Software Foundation, Inc., |
16 | 16 | # 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA. |
17 | 17 | # |
18 | # $Id: Gtk2.pm 2142 2009-02-13 15:58:53Z tsch $ | |
18 | # $Id: Gtk2.pm 2155 2009-03-08 20:00:50Z tsch $ | |
19 | 19 | # |
20 | 20 | |
21 | 21 | package Gtk2; |
72 | 72 | use Exporter; |
73 | 73 | require DynaLoader; |
74 | 74 | |
75 | our $VERSION = '1.211'; | |
75 | our $VERSION = '1.212'; | |
76 | 76 | |
77 | 77 | our @ISA = qw(DynaLoader Exporter); |
78 | 78 | |
389 | 389 | |
390 | 390 | =head1 AUTHORS |
391 | 391 | |
392 | =encoding utf8 | |
393 | ||
392 | 394 | The gtk2-perl team: |
393 | 395 | |
394 | 396 | muppet <scott at asofyet dot org> |
0 | 0 | --- #YAML:1.0 |
1 | 1 | name: Gtk2 |
2 | version: 1.211 | |
2 | version: 1.212 | |
3 | 3 | abstract: Perl interface to the 2.x series of the Gimp Toolkit library |
4 | 4 | author: [] |
5 | 5 | license: unknown |
9 | 9 | ExtUtils::Depends: 0.300 |
10 | 10 | ExtUtils::MakeMaker: 0 |
11 | 11 | ExtUtils::PkgConfig: 1.030 |
12 | Glib: 1.212 | |
12 | Glib: 1.214 | |
13 | 13 | Pango: 1.210 |
14 | 14 | requires: |
15 | 15 | Cairo: 1.000 |
16 | 16 | ExtUtils::Depends: 0.300 |
17 | 17 | ExtUtils::PkgConfig: 1.030 |
18 | Glib: 1.212 | |
18 | Glib: 1.214 | |
19 | 19 | Pango: 1.210 |
20 | 20 | no_index: |
21 | 21 | directory: |
14 | 14 | # along with this library; if not, write to the Free Software Foundation, Inc., |
15 | 15 | # 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA. |
16 | 16 | # |
17 | # $Id: Makefile.PL 2140 2009-02-13 15:36:37Z tsch $ | |
17 | # $Id: Makefile.PL 2155 2009-03-08 20:00:50Z tsch $ | |
18 | 18 | # |
19 | 19 | |
20 | 20 | BEGIN { require 5.008; } |
32 | 32 | our %build_reqs = ( |
33 | 33 | 'perl-ExtUtils-Depends' => '0.300', |
34 | 34 | 'perl-ExtUtils-PkgConfig' => '1.030', |
35 | 'perl-Glib' => '1.212', # FIXME: 1.220 | |
36 | 'perl-Pango' => '1.210', | |
35 | 'perl-Glib' => '1.214', # FIXME: Glib 1.220 | |
36 | 'perl-Pango' => '1.210', # FIXME: Pango 1.220 | |
37 | 37 | 'perl-Cairo' => '1.000', |
38 | 38 | 'Gtk+' => '2.0.0', |
39 | 39 | ); |
0 | Overview of changes in Gtk2 1.212 | |
1 | ================================= | |
2 | ||
3 | * Wrap gtk_style_get. | |
4 | * Fix a leak in Gtk2::TreeModelFilter::new. | |
5 | * Fix a few POD errors. | |
6 | * Fix some test suite issues. | |
7 | ||
0 | 8 | Overview of changes in Gtk2 1.211 |
1 | 9 | ================================= |
2 | 10 |
0 | Gtk2 version 1.211 | |
0 | Gtk2 version 1.212 | |
1 | 1 | ================== |
2 | 2 | |
3 | 3 | Perl bindings to the 2.x series of the Gtk+ graphical user interface library. |
101 | 101 | with this library; if not, write to the Free Software Foundation, Inc., 59 |
102 | 102 | Temple Place - Suite 330, Boston, MA 02111-1307 USA. |
103 | 103 | |
104 | # $Id: README 2142 2009-02-13 15:58:53Z tsch $ | |
104 | # $Id: README 2155 2009-03-08 20:00:50Z tsch $ |
0 | 0 | # |
1 | # $Id: Helper.pm 2054 2008-10-05 12:49:36Z tsch $ | |
1 | # $Id: Helper.pm 2148 2009-02-22 16:46:43Z tsch $ | |
2 | 2 | # |
3 | 3 | |
4 | 4 | package Gtk2::Helper; |
183 | 183 | |
184 | 184 | =head1 AUTHOR |
185 | 185 | |
186 | Jörn Reder E<lt>joern AT zyn.deE<gt> | |
186 | =encoding utf8 | |
187 | ||
188 | Jörn Reder E<lt>joern AT zyn.deE<gt> | |
187 | 189 | |
188 | 190 | =head1 COPYRIGHT AND LICENSE |
189 | 191 | |
190 | Copyright 2003 by Jörn Reder | |
192 | Copyright 2003 by Jörn Reder | |
191 | 193 | |
192 | 194 | This library is free software; you can redistribute it and/or |
193 | 195 | modify it under the terms of the GNU Library General Public |
0 | 0 | # |
1 | # $Id: TestHelper.pm 2054 2008-10-05 12:49:36Z tsch $ | |
1 | # $Id: TestHelper.pm 2148 2009-02-22 16:46:43Z tsch $ | |
2 | 2 | # |
3 | 3 | |
4 | 4 | package Gtk2::TestHelper; |
218 | 218 | with all of the GInterfaces that the type system claims it supports. Something |
219 | 219 | like an isa_ok() in steroids. |
220 | 220 | |
221 | =back | |
222 | ||
223 | 221 | =item delta_ok (A, B [, NAME]) |
224 | 222 | |
225 | 223 | Checks that the absolute difference of the numbers A and B is smaller than |
0 | 0 | #!/usr/bin/perl |
1 | 1 | # |
2 | # $Id: 00.Gtk2.t 2095 2008-11-22 14:49:27Z tsch $ | |
2 | # $Id: 00.Gtk2.t 2149 2009-02-22 17:32:48Z tsch $ | |
3 | 3 | # |
4 | 4 | |
5 | 5 | use strict; |
164 | 164 | |
165 | 165 | my $context = Glib::OptionContext->new ('- urgsify your life'); |
166 | 166 | $context->add_main_entries ($options, 'C'); |
167 | $context->add_group (Gtk2->get_option_group (1)); | |
167 | $context->add_group (Gtk2->get_option_group (0)); | |
168 | 168 | |
169 | 169 | @ARGV = qw(--name Foo --foos 23); |
170 | 170 | $context->parse (); |
1 | 1 | use strict; |
2 | 2 | use Gtk2::TestHelper tests => 43; |
3 | 3 | |
4 | # $Id: GdkKeys.t 2054 2008-10-05 12:49:36Z tsch $ | |
4 | # $Id: GdkKeys.t 2150 2009-02-22 17:33:48Z tsch $ | |
5 | 5 | |
6 | 6 | use Gtk2::Gdk::Keysyms; |
7 | 7 | |
17 | 17 | } |
18 | 18 | |
19 | 19 | my @keys = $map -> get_entries_for_keyval($Gtk2::Gdk::Keysyms{ Escape }); |
20 | ||
21 | SKIP: { | |
22 | skip 'No key entries for Escape found in the keymap', 41 | |
23 | unless scalar @keys; | |
24 | ||
20 | 25 | isa_ok($keys[0], "HASH"); |
21 | 26 | like($keys[0] -> { keycode }, qr/^\d+$/); |
22 | 27 | like($keys[0] -> { group }, qr/^\d+$/); |
97 | 102 | my $unicode = Gtk2::Gdk -> keyval_to_unicode($a); |
98 | 103 | is(Gtk2::Gdk -> unicode_to_keyval($unicode), $a); |
99 | 104 | |
105 | } | |
106 | ||
100 | 107 | __END__ |
101 | 108 | |
102 | 109 | Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the |
0 | 0 | #!/usr/bin/perl -w |
1 | 1 | use strict; |
2 | use Gtk2::TestHelper tests => 1, noinit => 1; | |
2 | use Gtk2::TestHelper tests => 3, noinit => 1; | |
3 | 3 | |
4 | # $Id: GtkHBox.t 2054 2008-10-05 12:49:36Z tsch $ | |
4 | # $Id: GtkHBox.t 2154 2009-03-08 18:40:43Z tsch $ | |
5 | 5 | |
6 | 6 | my $box = Gtk2::HBox -> new(); |
7 | 7 | isa_ok($box, "Gtk2::HBox"); |
8 | 8 | |
9 | { | |
10 | my $label = Gtk2::Label->new ('hello'); | |
11 | $box->pack_start ($label, 0,0,0); | |
12 | $box->remove($label); | |
13 | require Scalar::Util; | |
14 | Scalar::Util::weaken ($label); | |
15 | is ($label, undef, 'child destroyed by weakening after being in box'); | |
16 | } | |
17 | { | |
18 | my $label = Gtk2::Label->new ('hello'); | |
19 | $box->pack_start ($label, 0,0,0); | |
20 | $box->foreach (sub { }); | |
21 | $box->remove($label); | |
22 | require Scalar::Util; | |
23 | Scalar::Util::weaken ($label); | |
24 | is ($label, undef, | |
25 | 'child destroyed by weakening after being in box -- and foreach()'); | |
26 | } | |
27 | ||
9 | 28 | __END__ |
10 | 29 | |
11 | Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the | |
30 | Copyright (C) 2003, 2009 by the gtk2-perl team (see the file AUTHORS for the | |
12 | 31 | full list). See LICENSE for more information. |
0 | 0 | #!/usr/bin/perl -w |
1 | 1 | # vim: set ft=perl expandtab shiftwidth=2 softtabstop=2 : |
2 | 2 | use strict; |
3 | use Gtk2::TestHelper tests => 113; | |
4 | ||
5 | # $Id: GtkStyle.t 2054 2008-10-05 12:49:36Z tsch $ | |
3 | use Gtk2::TestHelper tests => 124; | |
4 | use Carp; | |
5 | ||
6 | # $Id: GtkStyle.t 2152 2009-03-08 17:01:28Z tsch $ | |
6 | 7 | |
7 | 8 | my $window = Gtk2::Window -> new(); |
8 | 9 | $window -> realize(); |
132 | 133 | ok (1); |
133 | 134 | } |
134 | 135 | |
136 | SKIP: { | |
137 | skip("get is new in 2.16", 12) | |
138 | unless (Gtk2->CHECK_VERSION(2, 15, 0)); # FIXME 2.16 | |
139 | ||
140 | # Test different properties (gint, gboolean, gchar* and GObject) | |
141 | my $treeview = Gtk2::TreeView -> new(); | |
142 | ||
143 | # get gboolean | |
144 | is ( | |
145 | $style -> get('Gtk2::TreeView', 'allow-rules'), | |
146 | $treeview -> style_get_property('allow-rules'), | |
147 | "get_property gboolean" | |
148 | ); | |
149 | ||
150 | # get gint | |
151 | is ( | |
152 | $style -> get('Gtk2::TreeView', 'expander-size'), | |
153 | $treeview -> style_get_property('expander-size'), | |
154 | "get_property gint" | |
155 | ); | |
156 | ||
157 | # get gchar* | |
158 | is ( | |
159 | $style -> get('Gtk2::TreeView', 'grid_line-pattern'), | |
160 | $treeview -> style_get_property('grid_line-pattern'), | |
161 | "get_property gchar*" | |
162 | ); | |
163 | ||
164 | # get GObject (a color) | |
165 | is ( | |
166 | $style -> get('Gtk2::TreeView', 'even-row-color'), | |
167 | $treeview -> style_get_property('even-row-color'), | |
168 | "get_property GObject*" | |
169 | ); | |
170 | ||
171 | ||
172 | ||
173 | # Get multiple properties simultaneously | |
174 | my @properties = $style -> get('Gtk2::TreeView', 'expander-size', 'even-row-color', 'grid_line-pattern'); | |
175 | is_deeply ( | |
176 | \@properties, | |
177 | [ | |
178 | $treeview -> style_get_property('expander-size'), | |
179 | $treeview -> style_get_property('even-row-color'), | |
180 | $treeview -> style_get_property('grid_line-pattern'), | |
181 | ], | |
182 | 'get multiple properties', | |
183 | ); | |
184 | ||
185 | ||
186 | ||
187 | # Make sure that Glib::GObject::get() and Gtk2::Style::get() can coexist. | |
188 | my $custom_style = Custom::Style -> new(); | |
189 | is ($custom_style -> Glib::Object::get('perl-string'), 'empty'); | |
190 | is ($custom_style -> get_property('perl-string'), 'empty'); | |
191 | is ($custom_style -> get('Gtk2::Button', 'image-spacing'), 2); | |
192 | ||
193 | ||
194 | ||
195 | # Test for bad usage | |
196 | # Bad class | |
197 | test_die( | |
198 | sub { $style -> get('wrong::class', 'border'); }, | |
199 | qr/^package wrong::class is not registered with GPerl/ | |
200 | ); | |
201 | ||
202 | # Non existing property | |
203 | test_die( | |
204 | sub { $style -> get('Gtk2::Button', 'image-spacing', 'perl-var', 'default-border'); }, | |
205 | qr/^type Gtk2::Button does not support style property 'perl-var'/ | |
206 | ); | |
207 | ||
208 | # Not a Gtk2::Widget | |
209 | test_die( | |
210 | sub { $style -> get('Glib::Object', 'prop'); }, | |
211 | qr/^Glib::Object is not a subclass of Gtk2::Widget/ | |
212 | ); | |
213 | } | |
214 | ||
215 | ||
216 | # Test that an error is thrown | |
217 | sub test_die { | |
218 | my ($code, $regexp) = @_; | |
219 | croak "usage(code, regexp)" unless ref $code eq 'CODE'; | |
220 | ||
221 | my $passed = FALSE; | |
222 | eval { | |
223 | $code->(); | |
224 | }; | |
225 | if (my $error = $@) { | |
226 | if ($error =~ /$regexp/) { | |
227 | $passed = TRUE; | |
228 | } | |
229 | else { | |
230 | diag("Expected $regexp but got $error"); | |
231 | } | |
232 | } | |
233 | ||
234 | return Test::More->builder->ok($passed); | |
235 | } | |
236 | ||
237 | ||
238 | # | |
239 | # Used to test if Gtk2::Style::get() conflicts with Glib::GObject::get(). A new | |
240 | # package is needed because as of gtk+ 2.16, Gtk2::Style defines no properties. | |
241 | # | |
242 | package Custom::Style; | |
243 | ||
244 | use Glib::Object::Subclass 'Gtk2::Style' => | |
245 | ||
246 | properties => [ | |
247 | Glib::ParamSpec->string( | |
248 | 'perl-string', | |
249 | 'Test string', | |
250 | 'A test string.', | |
251 | 'empty', | |
252 | ['readable', 'writable'], | |
253 | ), | |
254 | ], | |
255 | ; | |
256 | ||
257 | ||
135 | 258 | __END__ |
136 | 259 | |
137 | Copyright (C) 2003-2006 by the gtk2-perl team (see the file AUTHORS for the | |
260 | Copyright (C) 2003-2009 by the gtk2-perl team (see the file AUTHORS for the | |
138 | 261 | full list). See LICENSE for more information. |
0 | 0 | #!/usr/bin/perl -w |
1 | 1 | use strict; |
2 | 2 | use Gtk2::TestHelper |
3 | tests => 26, | |
3 | tests => 27, | |
4 | 4 | noinit => 1, |
5 | 5 | at_least_version => [2, 4, 0, "GtkTreeModelFilter is new in 2.4"]; |
6 | 6 | |
7 | # $Id: GtkTreeModelFilter.t 2054 2008-10-05 12:49:36Z tsch $ | |
7 | # $Id: GtkTreeModelFilter.t 2153 2009-03-08 17:59:16Z tsch $ | |
8 | 8 | |
9 | 9 | my $list = Gtk2::ListStore -> new("Glib::Int", "Glib::String"); |
10 | 10 | |
75 | 75 | |
76 | 76 | $filter -> set_visible_column(0); |
77 | 77 | |
78 | { | |
79 | require Scalar::Util; | |
80 | my $f = Gtk2::TreeModelFilter->new($list); | |
81 | Scalar::Util::weaken($f); | |
82 | is ($f, undef, 'destroyed by weakening'); | |
83 | } | |
84 | ||
78 | 85 | __END__ |
79 | 86 | |
80 | Copyright (C) 2003-2005 by the gtk2-perl team (see the file AUTHORS for the | |
87 | Copyright (C) 2003-2009 by the gtk2-perl team (see the file AUTHORS for the | |
81 | 88 | full list). See LICENSE for more information. |
0 | 0 | #!/usr/bin/perl -w |
1 | 1 | |
2 | # $Id: GtkTreeModelIface.t 2054 2008-10-05 12:49:36Z tsch $ | |
2 | # $Id: GtkTreeModelIface.t 2154 2009-03-08 18:40:43Z tsch $ | |
3 | 3 | |
4 | 4 | package CustomList; |
5 | 5 | |
345 | 345 | |
346 | 346 | package main; |
347 | 347 | |
348 | use Gtk2::TestHelper tests => 179, noinit => 1; | |
348 | use Gtk2::TestHelper tests => 180, noinit => 1; | |
349 | 349 | use strict; |
350 | 350 | use warnings; |
351 | 351 | |
455 | 455 | $model->sort(3); |
456 | 456 | $model->sort(23); |
457 | 457 | |
458 | # This should result in a call to FINALIZE_INSTANCE | |
459 | $model = undef; | |
460 | ||
458 | 461 | # Exercise Gtk2::TreeIter->set. |
459 | 462 | { my $myvar; |
460 | 463 | my $stamp = 123; |
15 | 15 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | 16 | * Boston, MA 02111-1307 USA. |
17 | 17 | * |
18 | * $Id: Gtk2.xs 2103 2009-01-01 21:40:13Z tsch $ | |
18 | * $Id: Gtk2.xs 2147 2009-02-22 16:12:47Z tsch $ | |
19 | 19 | */ |
20 | 20 | |
21 | 21 | #include "gtk2perl.h" |
166 | 166 | C<$Gtk2::VERSION> for the version of the bindings, all-caps |
167 | 167 | (MAJOR|MINOR|MICRO)_VERSION functions for the bound version, and |
168 | 168 | lower-case (major|minor|micro)_version functions for the runtime version. |
169 | See L<Glib::version> and http://developer.gnome.org/doc/API/2.0/gtk/gtk-Feature-Test-Macros.html for more information. | |
169 | See L<Glib::version> and | |
170 | L<http://developer.gnome.org/doc/API/2.0/gtk/gtk-Feature-Test-Macros.html> | |
171 | for more information. | |
170 | 172 | |
171 | 173 | Note also that gtk_check_version() and GTK_CHECK_VERSION() have different |
172 | 174 | semantics in C, and we have preserved those faithfully. |
281 | 283 | PUSHs (sv_2mortal (newSViv (GTK_MICRO_VERSION))); |
282 | 284 | PERL_UNUSED_VAR (ax); |
283 | 285 | |
284 | =for apidoc | |
286 | =for apidoc | |
285 | 287 | Provides a mechanism for checking the version information that Gtk2 was |
286 | 288 | compiled against. Essentially equvilent to the macro GTK_CHECK_VERSION. In most |
287 | 289 | cases this function should be used rather than |
288 | L<check_version ()|Gtk2-E<gt>check_version>. | |
290 | L<check_version ()|/"string = Gtk2-E<gt>B<check_version> ($required_major, $required_minor, $required_micro)">. | |
289 | 291 | =cut |
290 | 292 | gboolean |
291 | 293 | CHECK_VERSION (class, guint required_major, guint required_minor, guint required_micro) |
0 | 0 | /* |
1 | * Copyright (c) 2003 by the gtk2-perl team (see the file AUTHORS) | |
1 | * Copyright (c) 2003, 2009 by the gtk2-perl team (see the file AUTHORS) | |
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 Library General Public |
15 | 15 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | 16 | * Boston, MA 02111-1307 USA. |
17 | 17 | * |
18 | * $Id: GtkAccelGroup.xs 2067 2008-10-18 22:24:19Z tsch $ | |
18 | * $Id: GtkAccelGroup.xs 2151 2009-03-01 17:10:09Z tsch $ | |
19 | 19 | */ |
20 | 20 | |
21 | 21 | #include "gtk2perl.h" |
83 | 83 | PREINIT: |
84 | 84 | GClosure * closure; |
85 | 85 | CODE: |
86 | /* gtk_accel_group_connect() sinks the floating ref from creation in | |
87 | * gperl_closure_new() | |
88 | */ | |
86 | 89 | closure = gperl_closure_new (func, NULL, FALSE); |
87 | 90 | gtk_accel_group_connect (accel_group, accel_key, accel_mods, |
88 | 91 | accel_flags, closure); |
89 | /* i would swear until i was blue in the face that this unref | |
90 | * is the right thing to do, but with it in there i get a critical | |
91 | * assertion failure from glib when i try to disconnect the closure, | |
92 | * saying that the refcount was zero somehow. */ | |
93 | /* g_closure_unref (closure); FIXME */ | |
94 | 92 | |
95 | 93 | ## void gtk_accel_group_connect_by_path (GtkAccelGroup *accel_group, const gchar *accel_path, GClosure *closure) |
96 | 94 | void |
101 | 99 | PREINIT: |
102 | 100 | GClosure * closure; |
103 | 101 | CODE: |
102 | /* gtk_accel_group_connect_by_path() sinks the floating ref from | |
103 | * creation in gperl_closure_new() | |
104 | */ | |
104 | 105 | closure = gperl_closure_new (func, NULL, FALSE); |
105 | 106 | gtk_accel_group_connect_by_path (accel_group, accel_path, closure); |
106 | /* i wonder if we get the same problem here as above? */ | |
107 | /* g_closure_unref (closure); FIXME */ | |
108 | 107 | |
109 | 108 | # this will not work quite as advertised --- a GClosure can be |
110 | 109 | # attached to only one GtkAccelGroup, but we'll be creating a new |
0 | 0 | /* |
1 | * Copyright (c) 2003-2006 by the gtk2-perl team (see the file AUTHORS) | |
1 | * Copyright (c) 2003-2009 by the gtk2-perl team (see the file AUTHORS) | |
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 Library General Public |
15 | 15 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | 16 | * Boston, MA 02111-1307 USA. |
17 | 17 | * |
18 | * $Id: GtkStyle.xs 2054 2008-10-05 12:49:36Z tsch $ | |
18 | * $Id: GtkStyle.xs 2152 2009-03-08 17:01:28Z tsch $ | |
19 | 19 | */ |
20 | 20 | |
21 | 21 | #include "gtk2perl.h" |
571 | 571 | RETVAL |
572 | 572 | |
573 | 573 | #endif |
574 | ||
575 | #if GTK_CHECK_VERSION (2, 15, 0) /* FIXME 2.16 */ | |
576 | ||
577 | =for apidoc | |
578 | =for signature list = $style->get (widget_package, ...) | |
579 | =for arg widget_package (string) widget package name (ex: 'Gtk2::TreeView') | |
580 | =for arg ... (list) list of property names | |
581 | ||
582 | Fetch and return the values for the style properties named in I<...> for a | |
583 | widget of type I<widget_package>. | |
584 | ||
585 | B<Note>: This method shadows I<Glib::Object::get>. This shouldn't be a problem | |
586 | since I<Gtk2::Style> defines no properties (as of gtk+ 2.16). If you have a | |
587 | class that's derived from Gtk2::Style and adds a property or if a new version | |
588 | of gtk+ adds a property to I<Gtk2::Style>, the property can be accessed with | |
589 | I<get_property> which still resolves to I<Glib::Object::get_property>: | |
590 | ||
591 | my $value = $style->get_property('property'); | |
592 | ||
593 | =cut | |
594 | void | |
595 | gtk_style_get (style, widget_package, ...) | |
596 | GtkStyle *style | |
597 | const char *widget_package | |
598 | PREINIT: | |
599 | int i; | |
600 | GType widget_type; | |
601 | gpointer class; | |
602 | CODE: | |
603 | /* Use CODE: instead of PPCODE: so we can handle the stack ourselves in | |
604 | * order to avoid that xsubs called by gtk_style_get_property overwrite | |
605 | * what we put on the stack. */ | |
606 | ||
607 | widget_type = gperl_type_from_package (widget_package); | |
608 | if (widget_type == 0) | |
609 | croak ("package %s is not registered with GPerl", widget_package); | |
610 | ||
611 | if (! g_type_is_a (widget_type, GTK_TYPE_WIDGET)) | |
612 | croak ("%s is not a subclass of Gtk2::Widget", widget_package); | |
613 | ||
614 | ||
615 | class = g_type_class_ref (widget_type); | |
616 | if (class == NULL) | |
617 | croak ("can't find type class for type %s", widget_package); | |
618 | ||
619 | for (i = 2 ; i < items ; i++) { | |
620 | GValue value = {0, }; | |
621 | gchar *name = SvGChar (ST (i)); | |
622 | GParamSpec *pspec = | |
623 | gtk_widget_class_find_style_property (class, name); | |
624 | ||
625 | if (pspec) { | |
626 | g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); | |
627 | gtk_style_get_property (style, widget_type, name, &value); | |
628 | ST (i - 2) = sv_2mortal (gperl_sv_from_value (&value)); | |
629 | g_value_unset (&value); | |
630 | } | |
631 | else { | |
632 | g_type_class_unref (class); | |
633 | croak ("type %s does not support style property '%s'", | |
634 | widget_package, name); | |
635 | } | |
636 | } | |
637 | ||
638 | g_type_class_unref (class); | |
639 | ||
640 | XSRETURN (items - 2); | |
641 | ||
642 | #endif |
2 | 2 | * |
3 | 3 | * Licensed under the LGPL, see LICENSE file for more information. |
4 | 4 | * |
5 | * $Id: GtkTreeModel.xs 2100 2008-12-30 14:47:41Z tsch $ | |
5 | * $Id: GtkTreeModel.xs 2147 2009-02-22 16:12:47Z tsch $ | |
6 | 6 | */ |
7 | 7 | |
8 | 8 | #include "gtk2perl.h" |
1107 | 1107 | |
1108 | 1108 | =for apidoc get_value |
1109 | 1109 | =for arg ... of column indices |
1110 | Alias for L<get|list = $tree_model-E<gt>get ($iter, ...)>. | |
1110 | Alias for L<get|/"$tree_model-E<gt>B<get> ($iter, ...)">. | |
1111 | 1111 | =cut |
1112 | 1112 | |
1113 | 1113 | =for apidoc |
0 | 0 | /* |
1 | * Copyright (C) 2003-2005 by the gtk2-perl team (see the file AUTHORS for a | |
1 | * Copyright (C) 2003-2009 by the gtk2-perl team (see the file AUTHORS for a | |
2 | 2 | * full list) |
3 | 3 | * |
4 | 4 | * This library is free software; you can redistribute it and/or |
65 | 65 | gperl_prepend_isa ("Gtk2::TreeModelFilter", "Gtk2::TreeModel"); |
66 | 66 | |
67 | 67 | ## GtkTreeModel *gtk_tree_model_filter_new (GtkTreeModel *child_model, GtkTreePath *root); |
68 | GtkTreeModel *gtk_tree_model_filter_new (class, GtkTreeModel *child_model, GtkTreePath_ornull *root=NULL); | |
69 | C_ARGS: | |
70 | child_model, root | |
68 | ## | |
69 | ## Use GtkTreeModelFilter_noinc return to take ownership of the | |
70 | ## reference on the returned object. (GtkTreeModel is only a | |
71 | ## GInterface and the typemaps for it don't include a _noinc or _own | |
72 | ## variant.) | |
73 | ## | |
74 | GtkTreeModelFilter_noinc * | |
75 | gtk_tree_model_filter_new (class, GtkTreeModel *child_model, GtkTreePath_ornull *root=NULL); | |
76 | CODE: | |
77 | RETVAL = (GtkTreeModelFilter *) | |
78 | gtk_tree_model_filter_new(child_model, root); | |
79 | OUTPUT: | |
80 | RETVAL | |
71 | 81 | |
72 | 82 | ## void gtk_tree_model_filter_set_visible_func (GtkTreeModelFilter *filter, GtkTreeModelFilterVisibleFunc func, gpointer data, GtkDestroyNotify destroy); |
73 | 83 | void |
2 | 2 | * |
3 | 3 | * Licensed under the LGPL, see LICENSE file for more information. |
4 | 4 | * |
5 | * $Id: GtkWidget.xs 2086 2008-11-01 19:13:31Z tsch $ | |
5 | * $Id: GtkWidget.xs 2147 2009-02-22 16:12:47Z tsch $ | |
6 | 6 | */ |
7 | 7 | #include "gtk2perl.h" |
8 | 8 | |
570 | 570 | Also remember that the size request is not necessarily the size a widget will |
571 | 571 | actually be allocated. |
572 | 572 | |
573 | See also L<get_child_requisition ()|requisistion = $widget-E<gt>get_child_requisition ()> | |
573 | See also L<get_child_requisition ()|/"requisition = $widget-E<gt>B<get_child_requisition>"> | |
574 | 574 | =cut |
575 | 575 | GtkRequisition_copy * |
576 | 576 | gtk_widget_size_request (widget) |
599 | 599 | geometry instead of the widget's requisition. |
600 | 600 | |
601 | 601 | This function differs from |
602 | L<size_request()|requisition = $widget-E<gt>size_request ()> | |
602 | L<size_request()|/"requisition = $widget-E<gt>B<size_request>"> | |
603 | 603 | in that it retrieves the last size request value from |
604 | 604 | C<< $widget->requisition >>, |
605 | 605 | while C<size_request()> actually calls the C<size_request> virtual method |
787 | 787 | C<set_size_request()>. A value of -1 for I<width> or I<height> indicates |
788 | 788 | that the dimension has not been explicitly set and the natural requisition |
789 | 789 | of the widget will be used instead. |
790 | See L<set_size_request()|$widget-E<gt>set_size_request ($width-=1, $height=-1)>. | |
790 | See L<set_size_request()|/"$widget-E<gt>B<set_size_request> ($width=-1, $height=-1)">. | |
791 | 791 | To get the size a widget will actually use, call |
792 | L<size_request()|requisition = $widget-E<gt>size_request ()> instead of | |
792 | L<size_request()|/"requisition = $widget-E<gt>B<size_request>"> instead of | |
793 | 793 | this function. |
794 | 794 | =cut |
795 | 795 | void |
15 | 15 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | 16 | * Boston, MA 02111-1307 USA. |
17 | 17 | * |
18 | * $Id: GtkWindow.xs 2103 2009-01-01 21:40:13Z tsch $ | |
18 | * $Id: GtkWindow.xs 2147 2009-02-22 16:12:47Z tsch $ | |
19 | 19 | */ |
20 | 20 | |
21 | 21 | #include "gtk2perl.h" |
304 | 304 | environments may also place it in the window frame, or display it in other |
305 | 305 | contexts. |
306 | 306 | |
307 | L<set_icon_list ()|$window-E<gt>set_icon_list> allows you to pass in the same icon in several | |
308 | hand-drawn sizes. The list should contain the natural sizes your icon is | |
309 | available in; that is, don't scale the image before passing it to GTK+. | |
310 | Scaling is postponed until the last minute, when the desired final size is | |
311 | known, to allow best quality. | |
307 | L<set_icon_list ()|/"$window-E<gt>B<set_icon_list> (...)"> allows you to pass | |
308 | in the same icon in several hand-drawn sizes. The list should contain the | |
309 | natural sizes your icon is available in; that is, don't scale the image before | |
310 | passing it to GTK+. Scaling is postponed until the last minute, when the | |
311 | desired final size is known, to allow best quality. | |
312 | 312 | |
313 | 313 | By passing several sizes, you may improve the final image quality of the icon, |
314 | 314 | by reducing or eliminating automatic image scaling. |
332 | 332 | |
333 | 333 | # GList* gtk_window_get_icon_list (GtkWindow *window) |
334 | 334 | =for apidoc |
335 | Retrieves the list of icons set by L<set_icon_list ()|$window-E<gt>set_icon_list>. | |
335 | Retrieves the list of icons set by L<set_icon_list()|/"$window-E<gt>B<set_icon_list> (...)">. | |
336 | 336 | =cut |
337 | 337 | void |
338 | 338 | gtk_window_get_icon_list (window) |