From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brett Viren To: guile-gtk@sourceware.cygnus.com Subject: Access a GtkWidget in C from guile? Date: Sat, 03 Jun 2000 15:27:00 -0000 Message-id: <14649.32585.297873.456090@bamboo.physics.sunysb.edu> X-SW-Source: 2000-q2/msg00050.html Hello, >From guile, I want to access a GnomeCanvas which has been created in (non guile-gtk) C code. To explain, here are some details: - I have a C structure which holds my app's data, including a pointer to a GnomeCanvas widget. As a simplified example: typedef struct _my_app_data { int blah; GnomeCanvas *canvas; } my_app_data; - I have a function which allocates memory and sets up things, including the canvas and various GnomeCanvasItems: my_app_data *init_my_app_data (); - I wrap `my_app_data' as a guile SMOB and also package any functions which operate on `my_app_data' into a dynamically linked lib (following Guile's data-rep.info as well as ``Dynamic Linking and Compiled Code Modules'' in the guile-ref info page). This lib is at `my/libapp.so' in my GUILE_LOAD_PATH. One of the functions I wrapped is `init_my_app_data'. So, after I do: (use-modules (my app)) in guile then I can see the function `init-my-app-data' which is the scheme equiv to `init_my_app_data'. - Now comes the problem: In scheme I need to do something like: (use-modules (my app) (gnome gnome) (gtk gtk) (gtk gdk)) ;; ... (let ((window (gtk-window-new 'toplevel)) (mad (init-my-app-data some args))) (gtk-container-add window (give-me-a-canvas mad)) ...) Where `(give-me-a-canvas mad)' needs to return a guile-ified version of my C-land GnomeCanvas. Any pointers (pun intended) would be appreciated. Thanks, -Brett.