Re: Gnome2::IconList bug



On Thursday, January 29, 2004, at 10:16 AM, Ross McFarland wrote:

"Cristóvão B. B. Dalla Costa" said:
Further investigation with the debugger, using the 'm' command to list
its methods, revealed that the Gnome2::IconList class inherits from
none. I worked around the problem by inserting the following line in my
startup code:

@Gnome2::IconList::ISA = ('Gtk2::Widget');

you solution, of course, is a temporary workaround.

i can confirm the problem, looking at the pod of Gnome2::IconList doesn't show
any heirarchy.

from the looks of it (icon list header file) GnomeIconList is a GnomeCanvas which would mean that Gnome2 probably needs to depend on Gnome2::Canvas, in fact if i add 'use Gnome2::Canvas;' to Gnome2.pm the problem goes away and the pod now shows the hierarchy. (note that the real solution will involve more
than just adding the use statement.)

the reason for this, of course, is that gperl_register_object() can only set the parent in @ISA if the parent has been registered, since we go by class names. since GnomeIconList inherits from GnomeCanvas, but GnomeCanvas has not yet been registered with the bindings, the GnomeIconList => Gnome2::IconList mapping sits in a queue held statically inside gperl_register_object().

simply adding "use Gnome2::Canvas" anywhere in the program should cause it to work.

but, yes, this appears to be a dependency problem. it looks like Gnome2 will have to depend on Gnome2::Canvas as well as Gnome2::VFS... *or* have Gnome2's boot code register a type mapping for GnomeCanvas.

this trick will actually work, i think; multiple mapping registrations are fine, especially for GObjects, because it's just GType to name. (for boxed types it's dangerous to lose the wrapper class, but GObjects don't have that problem.) so in Gnome2::IconList's BOOT section you should be able to get away with

        gperl_register_object (GNOME_TYPE_CANVAS, "Gnome2::Canvas");

libgnomeui depends on libgnomecanvas, so GNOME_TYPE_CANVAS should be available. no typemaps are strictly needed, because gperl_get_object() does all the work from GTypes.


--
"that's it! you're a genius!" "yes. that's what i think. do you think i deserve a raise?"
        - dialogue from 'Godzilla versus Mothra', 1964




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]