Re: Resent: Creating bindings for GtkImageViewer

On 12/18/00 dov imagic weizmann ac il wrote:
I have tried to create Perl/Gtk bindings for the Widget GtkImageViewer
that I have created. Here is a synopsis of what I did:

* Added the following line to pkg.defs :

  (define-object GtkImageViewer (GtkWidget) (cast GTK_IMAGE_VIEWER))

* Created Makefile.PL based on other Makefile.PL's .

I just commited to cvs a few changes that should make creating
sub-modules easier, please check it out.
Now Makefile.PLs should be a lot more readable and dependency
is largely handled automatically by the new module.
Note that you'll need to depend on the new Gtk module for it
to build, but I hope to release 0.7005 this week.

* Created a file xs/GtkImageViewer.xs based on other files that among
  other things contains the following declaration:

    gtk_image_viewer_new (Class, image)
          SV      *Class
          Gtk::Gdk::Pixbuf image
          RETVAL = GTK_IMAGE_VIEWER(gtk_image_viewer_new (image));

* Created a file that contains the following line:

   $image = Gtk::ImageViewer->new($pixbuf);

Everything compiles just fine, but when I try to run the test program
it dies with the error:

   unable to convert GtkObject 0x1f7328 of type 44565 (GtkImageViewer) 
   into a Perl/Gtk type at ./ line 30.

What went wrong?

You need to call GtkImageViewer_InstallTypedefs() and 
GtkImageViewerInstallObjects() in an init() function (or maybe also
in the new method so it's simpler for the end user).
Check GtkHTM/xs/GtkHTML.xs:init() for an example.


lupus debian org                                     debian/rules
lupus helixcode com                          Monkeys do it better

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