Gtk2
view release on metacpan or search on metacpan
ChangeLog.pre-git view on Meta::CPAN
* t/PangoLayout.t: Fix test failure on newer pango versions.
2008-05-04 Torsten Schoenfeld <kaffeetisch@gmx.de>
* xs/GtkTreeView.xs: Describe the return values of
get_visible_range and get_tooltip_context. Patch by Kevin Ryde.
* xs/GtkTreeModel.xs: In the POD section about tree iterators, add
a paragraph explaining how data put into iterators needs to be
kept alive by the model. Patch by Kevin Ryde.
2008-04-20 Torsten Schoenfeld <kaffeetisch@gmx.de>
* t/GdkDisplay.t
* xs/GdkDisplay.xs: Allow undef for the display name parameter of
Gtk2::Gdk::Display::open. Patch by Kevin Ryde.
2008-03-30 Torsten Schoenfeld <kaffeetisch@gmx.de>
* Gtk2.pm
ChangeLog.pre-git view on Meta::CPAN
* t/GtkButton.t: sprintf the values returned by get_alignment to
avoid precision mismatch problems
* t/GtkIconTheme.t: implement some tests
* t/GtkItemFactory.t: don't forget to return a string from the
translation func
* xs/GtkItemFactory.xs: keep the value returned from the perl
callback alive long enough to be used by the caller.
2004/01/24 21:44 (-0500) rwmcfa1
* Makefile.PL: removed runtime_reqs stuff, replaced by the pkg-config
trick
* perl-Gtk2.spec.in: use pkg-config for Requires version
2004/01/22 15:28 (-0500) muppetman
Gtk2::MICRO_VERSION, Gtk2::major_version, Gtk2::minor_version,
Gtk2::micro_version. Change Gtk2::Pango::check_version to
Gtk2::Pango::CHECK_VERSION. [Ross, muppet]
* New functions, tracking HEAD:
Gtk2::FileChooserDialog::new_with_backend.
Gtk2::RadioMenuItem::new_from_widget
Gtk2::RadioMenuItem::new_with_mnemonic_from_widget
Gtk2::RadioMenuItem::new_with_label_from_widget
* Added to parse_maps the ability to generate error domain registrations;
use that for Gtk2's own error domains. [muppet]
* Use a weakref rather than object data to keep Tooltips objects alive.
[muppet, implementing yosh's suggestion]
* Pod fixes and enhancements. [Ross]
* Fix up the license notifications in source files. [Torsten]
* Minor bugfixes, corrections, and cleanups. [Torsten, Ross, muppet, Marc
Brockschmidt]
* As always, more tests. [Torsten]
Overview of Changes in Gtk2 1.036
=================================
lib/Gtk2/api.pod view on Meta::CPAN
mechanism described above; you just specify the string, e.g.,
GTK_STOCK_OK => 'gtk-ok'. The full list of stock items can be found at
http://developer.gnome.org/doc/API/2.0/gtk/gtk-Stock-Items.html
=head2 Memory Handling
The functions for ref'ing and unref'ing objects and free'ing boxed structures
are not even mapped to perl, because it's all handled automagically by the
bindings. I could write a treatise on how we're handling reference counts and
object lifetimes, but all you need to know as perl developer is that it's
handled for you, and the object will be alive so long as you have a perl scalar
pointing to it or the object is referenced in another way, e.g. from a container.
The only thing you have to be careful about is the lifespan of non
reference counted structures, which means most things derived from
C<Glib::Boxed>. If it comes from a signal callback it might be good
only until you return, or if it's the insides of another object then
it might be good only while that object lives. If in doubt you can
C<copy>. Structs from C<copy> or C<new> are yours and live as long as
referred to from Perl.
t/GtkLinkButton.t view on Meta::CPAN
}
{ my $userdata = [ 'something' ];
sub hook3 {
$_[-1] = undef;
}
$button->set_uri_hook (\&hook3, $userdata);
require Scalar::Util;
Scalar::Util::weaken ($userdata);
is_deeply ($userdata, [ 'something' ],
'still alive when first weakened');
$button->clicked;
is ($userdata, undef, 'then gone when hook zaps its last arg');
$button->set_uri_hook (undef);
}
{ my $saw_data;
sub hook4 {
$button->set_uri_hook (undef);
$saw_data = $_[-1];
xs/GdkImage.xs view on Meta::CPAN
## This is a copy similar to the way C<Gtk2::Gdk::Pixbuf> C<get_pixels>
## copies. Perhaps in the future some sort of C<get_pixels_substr> could
## get just part of it, or C<put_bytes> or 4-arg substr write to part of it,
## as an alternative to individual C<get_pixel> / C<put_pixel>.
##
## A magic sv which could be read and written to modify the image data
## might be cute, but is probably more trouble than its worth. substr
## fetch/store funcs would make it clearer what's being done.
##
## If a magic scalar held a reference then there's a gremlin in Perl
## 5.10 lvalue C<substr> where such an sv gets kept alive in the
## function scratchpad, risking the underlying GdkImage kept alive
## longer than it should be. Or if it didn't hold a reference you'd
## have to rely on the application to keep the GdkImage alive while
## the raw memory was being manipulated.
##
SV *
gdk_image_get_pixels (image)
GdkImage *image
CODE:
/* Crib note: memory block size is "bytes_per_line * height" per the
shmget() or malloc() in _gdk_image_new_for_depth() of
gdkimage-x11.c */
RETVAL = newSVpv ((char *) image->mem, image->bpl * image->height);
xs/GtkBuildable.xs view on Meta::CPAN
GET_METHOD (buildable, "GET_NAME");
if (METHOD_EXISTS) {
SV * sv;
PREP (buildable);
CALL_SCALAR (sv);
/*
* the interface wants us to return a const pointer, which
* means this needs to stay alive. Unfortunately, we can't
* guarantee that the scalar will still be around by the
* time the string is used. My first thought here was to
* use gperl_alloc_temp(), but that suffered the same
* lifetime issue, because the string was immediately
* returned to perl code, which meant that the temp was
* cleaned up an reused before the string was read.
* So, we'll go a little nuts and store a malloc'd copy
* of the string until the next call. In theory, some
* code might be crazy enough to return a different name
* on the second call, so we won't bother with real caching.
xs/GtkCellRenderer.xs view on Meta::CPAN
CODE:
PERL_UNUSED_VAR (ix);
gtype = gperl_object_type_from_package (package);
if (!gtype)
croak ("package '%s' is not registered with Gtk2-Perl",
package);
if (! g_type_is_a (gtype, GTK_TYPE_CELL_RENDERER))
croak ("%s(%s) is not a GtkCellRenderer",
package, g_type_name (gtype));
/* peek should suffice, as the bindings should keep this class
* alive for us. */
class = g_type_class_peek (gtype);
if (! class)
croak ("internal problem: can't peek at type class for %s(%d)",
g_type_name (gtype), gtype);
gtk2perl_cell_renderer_class_init (class);
##
## here we provide a hokey way to chain up from one of the overrides we
## installed above. since the class of an object is determined by looking
xs/GtkContainer.xs view on Meta::CPAN
name = SvGChar (ST (1));
break;
default: /* ix==1 */
if (items != 1)
croak ("Usage: Gtk2::Container::list_child_properties (class)");
break;
}
if (! g_type_is_a (type, GTK_TYPE_CONTAINER))
croak ("Not a Gtk2::Container");
/* classes registered by perl are kept alive by the bindings.
* those coming straight from C are not. if we had an actual
* object, the class will be alive, but if we just had a
* package, the class may not exist yet. thus, we'll have to
* do an honest ref here, rather than a peek.
*/
object_class = g_type_class_ref (type);
if (ix == 0) {
GParamSpec *pspec
= gtk_container_class_find_child_property
(object_class, name);
XPUSHs (pspec
xs/GtkIMContextSimple.xs view on Meta::CPAN
*/
#include "gtk2perl.h"
MODULE = Gtk2::IMContextSimple PACKAGE = Gtk2::IMContextSimple PREFIX = gtk_im_context_simple_
GtkIMContext_noinc * gtk_im_context_simple_new (class)
C_ARGS:
/*void*/
### This just copies the pointer value, so we'd have to keep that memory alive;
### likely attached to the object.
##void gtk_im_context_simple_add_table (GtkIMContextSimple *context_simple,
## guint16 *data,
## gint max_seq_len,
## gint n_seqs);
xs/GtkTooltips.xs view on Meta::CPAN
SV * tip_private
PREINIT:
const gchar * real_tip_private = NULL;
CODE:
if (gperl_sv_is_defined (tip_private))
real_tip_private = SvGChar (tip_private);
gtk_tooltips_set_tip (tooltips, widget, tip_text, real_tip_private);
/* gtk+'s widgets do not hold a reference on the tooltips object,
* as you might expect; in fact, it's the other way around.
* let's use a weakref on the widget to keep the tooltips object
* alive as long as the widget is alive. */
g_object_ref (G_OBJECT (tooltips));
g_object_weak_ref (G_OBJECT (widget),
(GWeakNotify)g_object_unref, tooltips);
## GtkTooltipsData* gtk_tooltips_data_get (GtkWidget *widget)
=for apidoc
=for signature hash_ref = $tooltips->data_get ($widget)
Returns a hash reference with the keys: tooptips, widget, tip_text, and
tip_private.
xs/GtkTreeModel.xs view on Meta::CPAN
An arbitrary reference. Will not persist. May be undef.
=item o user_data3 (scalar)
An arbitrary reference. Will not persist. May be undef.
=back
The two references, if used, will generally be to data within the model,
like a row array, or a node object in a tree or linked list. Keeping the
things referred to alive is the model's responsibility. An iter doesn't
make them persist, and if the things are destroyed then any iters still
containing them will become invalid (and result in memory corruption if
used). An iter only has to remain valid until the model contents change, so
generally anything internal to the model is fine.
=head2 VIRTUAL METHODS
An implementation of
=over
xs/GtkWidget.xs view on Meta::CPAN
name = SvGChar (ST (1));
break;
default: /* ix==1 */
if (items != 1)
croak ("Usage: Gtk2::Widget::list_style_properties (class)");
break;
}
if (! g_type_is_a (type, GTK_TYPE_WIDGET))
croak ("Not a Gtk2::Widget");
/* classes registered by perl are kept alive by the bindings.
* those coming straight from C are not. if we had an actual
* widget, the class will be alive, but if we just had a
* package, the class may not exist yet. thus, we'll have to
* do an honest ref here, rather than a peek.
*/
widget_class = g_type_class_ref (type);
if (ix == 0) {
GParamSpec *pspec
= gtk_widget_class_find_style_property
(widget_class, name);
XPUSHs (pspec
( run in 1.523 second using v1.01-cache-2.11-cpan-39bf76dae61 )