public inbox for guile-gtk@sourceware.org
 help / color / mirror / Atom feed
From: Brett Viren <bviren@superk.physics.sunysb.edu>
To: guile-gtk@sourceware.cygnus.com
Subject: Access a GtkWidget in C from guile?
Date: Sat, 03 Jun 2000 15:27:00 -0000	[thread overview]
Message-ID: <14649.32585.297873.456090@bamboo.physics.sunysb.edu> (raw)

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.

             reply	other threads:[~2000-06-03 15:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-03 15:27 Brett Viren [this message]
2000-06-24 15:44 ` Marius Vollmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14649.32585.297873.456090@bamboo.physics.sunysb.edu \
    --to=bviren@superk.physics.sunysb.edu \
    --cc=guile-gtk@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).