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 Depends.pm 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::ImageViewer_Sink
    gtk_image_viewer_new (Class, image)
          SV      *Class
          Gtk::Gdk::Pixbuf image
          CODE:
          RETVAL = GTK_IMAGE_VIEWER(gtk_image_viewer_new (image));
          OUTPUT:
          RETVAL

* Created a test.pl 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 ./test.pl 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

-- 
-----------------------------------------------------------------
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]