guile-gtk-general
[Top][All Lists]
Advanced

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

Re: Roadmap to 2.8 platform bindings


From: Andy Wingo
Subject: Re: Roadmap to 2.8 platform bindings
Date: Tue, 18 May 2004 10:11:16 +0100
User-agent: Mutt/1.5.4i

Hi Patrick,

On Mon, 17 May 2004, Patrick Bernaud wrote:

> Now that I succesfully built guile-gnome I think I can contribute to
> this translation of the demo from C to guile in order to learn more of
> the project and be able to use it my own.

Wonderful.

>   - how the top part (not the action_area) of a GtkDialog can be
>     accessed? one of this dialog is used in this demo. Widgets had to
>     be added to this part through the vbox member of the object;

The C API for GtkDialog is broken, requiring direct access to struct
members. As Andreas mentioned, we need to provide accessor functions for
this. That means that you need to add an entry to
defs/gnome/defs/gtk-overrides.defs, and then implement the function in
gtk/gnome/gw/gtk-support.[ch].

>   - what is the guile-gnome syntax to 'OR' flags (if possible at all)?
>     For example, how does the following C code translates to guile:
>     "GTK_FILL | GTK_EXPAND" (this code is used in the attach options);

Generally, where an enum is required, you can pass either the symbol
corresponding to the value, a string, or the numerical value. You can
get a list from (genum-class->value-table <type>).

Flags are the same as enums, except that in general there can be more
than one option. If it's just one option, you can do it the same as
enums, but in general you will be passing a list. In this case, you will
probably be calling
  (gtk-container-frob container widget '(fill expand)).

>   - gtk_dialog_add_button() takes a const pointer on a string as
>     parameter 2 and a response id as parameter 3. How does this piece
>     of C translate to guile :
>       widget = gtk_dialog_add_button(
>                       dialog,
>                       GTK_STOCK_CLOSE,
>                       GTK_RESPONSE_NONE);
>     This one works fine but does not use the macros and flags:
>       (gtk-dialog-add-button dialog "gtk-close" -1)

I'm not sure how this should work. It's a tricky function, because the
text can be a label or the name of a stock button, and the response can
be a GtkResponseType (which are all negative) or a user-defined positive
integer. I think that this function should have a custom wrapper, where
if the second arg is a symbol, it somehow tries to make a stock name out
of the symbol, passing the arg through if it's a string. Likewise for
the third arg: if it's a symbol, try to find the number from
(genum->value (make <gtk-response-type> #:value resp-id)), otherwise
passing through the value. You also have to fix gtk-dialog-run if you
fix this.

FWIW, I hate this part of Gtk's API ;) I did a lot of hacks to get a
working GtkMessageDialog in gtk.scm. It requires a lot of hand-tuning.

Regards,

Wingo.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]