Re: $widget->get_name() and gtk2-perl 1.220+
- From: "Martin Schlemmer" <Martin Schlemmer nwu ac za>
- To: "Ian Chapman" <packages amiga-hardware com>, <gtk-perl-list gnome org>
- Subject: Re: $widget->get_name() and gtk2-perl 1.220+
- Date: Tue, 18 May 2010 17:22:58 +0200
On 2010/05/18 at 04:38 PM, Ian Chapman <packages amiga-hardware com> wrote:
Hi,
I have a program using gtkbuilder and Glade3 which takes the names of
the widgets (as seen in Glade) and builds a hash, with each key
referencing the corresponding widget, ie
foreach ($builder->get_objects) {
my $name;
eval{ $name = $_->get_name(); };
$gui{$name} = $_ if ($name);
}
This works as I expected (rightly or wrongly) with v1.203, however for
v1.220+ the behaviour of $widget->get_name() has been intentionally
changed and it no longer returns the name of the widget (according to
Glade), except bizarrely, liststores and a few others. Is there
equivalent an way of achieving this with V1.220+ without having to
significantly rewrite my program? In other words, is there another
method I can use which does much as the same as the old behaviour of
$widget->get_name(). Thanks.
Few possible reasons:
- if gtk+-2.16, then Gtk2::AboutDialog have get_name() overridden.
- if gtk+-2.18 or 2.20 (can't remember), then its a gtk+ and not gtk2-perl issue.
You can use:
$widget->get('name')
in general to make sure you get the widget name property, but for builder objects with later gtk+ versions,
its not really a Gtk2::Widgets, and the name property usually returns an empty string, so you need to use:
$builder_object->Gtk2::Buildable::get_name
Hope that helps.
Regards,
Martin
Vrywaringsklousule / Disclaimer: http://www.nwu.ac.za/it/gov-man/disclaimer.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]