[cells-devel] Re: [cells-gtk-devel] Re: Hacking the gtk-ffi

Ken Tilton kennytilton at optonline.net
Mon Oct 29 00:36:48 UTC 2007


Andy Chambers wrote:
> On 10/29/07, Andy Chambers <achambers.home at googlemail.com> wrote:
> 
>>Hi,
>>
>>What are all the things you need to do to add support for a property
>>on a widget.  I'm trying to add the "headers-visible" property to the
>>tree-view widget.  Here is what I did....
>>
>>  - added the symbol headers-visible to the gtk-slots list in the
>>widget specfication
>>  - added the form below to "def-gtk-lib-functions"
>>  - made an app with a listbox using that option
>>
>>(gtk-tree-view-set-headers-visible :void
>>                                     ((tree-view :pointer)
>>                                      (visible :gtk-boolean)))
>>
>>I ran the app with debug on but didn't see any calls to the c
>>function.  Is there something else you need to do?  Any general tips
>>on debugging cells/gtk apps are also welcome.
> 
> 
> OK.  I think I know why its not working.  The ffi call never gets made
> because cells only uses it if either the new or old value is not nil.

Properties are propagated from the Lisp model to Gtk by "observers" on a 
slot. Celtk and Cells-Gtk generate these observers as part of the 
macroexpansion of the def<i forget> macro to which it seems you 
correctly added the slot. It should not matter that the value (as you 
imply) never changes, because Cells understands that an initial 
propagation is necessary so observers and observed start out in synch.

You can check that you see an observer in the macroexpansion, then that 
that is being called. If not, I would have a concern that Cells-Gtk has 
not been upgraded to use the latest version of Cells, because I have a 
faint recollection that possibly older versions do not propagate a nil 
initial value. I would be shocked if it did not propagate a non-nil 
value, so one thing you might try as a sanity check is to specify a 
non-nil just to see if anything fires.

Hmmm. As I write this I find myself wondering why Cells-Gtk would know 
to call that function. I am afraid it has been years since I touched 
that code. Does the macroexpansion splice together a call by 
concatenating "GTK-TREE-VIEW-SET-" with the slot name? Again, examine 
the macroexpansion of DEFGTK (or whatever it is) of the tree-view class 
to make sure you see a call to the desired function. If not, you need to 
supply an observer on the slot yourself. I believe the method 
combination on observers has been PROGN for a while so multiples are 
fine, if not make it before or after, should not matter.

hope these avenues of investigation move you forward some.

kt



More information about the cells-devel mailing list