Re: Gtk2-perl shell (problem with GLib-GObject)
- From: muppet <scott asofyet org>
- To: Remco Wouts <remco wouts mpibp-frankfurt mpg de>
- Cc: gtk-perl-list gnome org
- Subject: Re: Gtk2-perl shell (problem with GLib-GObject)
- Date: Mon, 17 Jan 2005 08:21:16 -0500
On Jan 11, 2005, at 7:40 AM, Remco Wouts wrote:
I wrote a small Gtk2 shell. The attached code is the gist of it[1].
You can do things like:
gish> Gtk2::Window->new->add(Gtk2::Button->new('foobar'))->show_all
nice choice of name. :-)
have you seen
http://asofyet.org/muppet/software/gtk2-perl/gish.html
or
http://asofyet.org/muppet/software/gtk2-perl/gws.html
?
In gws, you can make perl refresh the implementation of a subroutine by
highlighting the sub and hitting KPEnter, and ignoring the "subroutine
redefined" message.
This is handy enough. The main problem is that objects that have been
Glib::Object::Subclass'ed don't work very well.
1) You cannot reread such a package. Eg 'do LabelledButton.pm' gives:
GLib-GObject-WARNING **: cannot register existing type
`LabelledButton' at
/usr/lib/perl5/site_perl/5.8.3/i686-linux/Glib/Object/Subclass.pm line
225.
This warning comes from glib's type system, not from the bindings.
It's in the private helper function check_type_name_I(), called by
g_type_register_fundamental(), g_type_register_static() and
g_type_register_dynamic() (the functions that register new GTypes).
The basic problem here is that when you register a type with glib, it
remembers that type information until the program exits. The type
names must be unique, and you get this error if they aren't.
The workaround for this would be to use different type names every
time. It would be conceivable to have the bindings generate a new C
type name for each package, but this is not desirable for several
reasons:
a) you can't unregister GType types, so the old types would still be
there, just waiting to cause problems.
b) mapping names names like Some::Package to Some-Package-4162 isn't
very friendly, especially when you start getting error messages.
2) The subclassed widget itself does not work correctly ie. after the
first 'do' it loads but does not display correctly. It does display
correctly when you load modify 'gish' to load the package at startup.
What do you mean by "does not display correctly"?
What version of Glib are you using? There's a bugfix in 1.060 related
to late loading of Glib::Object::Subclass.
[1] I abbrev'ed. it for clarity.
Could you send the whole thing? The LabelledButton example worked fine
in my version of gish-0.2, using Glib 1.061.
--
I don't have a drinking problem,
'cept when i can't get drink.
-- Tom Waits
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]