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

Peter Hildebrandt peter.hildebrandt at gmail.com
Mon Oct 29 14:32:14 UTC 2007


On Mon, 29 Oct 2007 00:50:19 +0100, Andy Chambers  
<achambers.home at googlemail.com> wrote:
> Looking further into it, the editable slot on the entry widget seems
> to have the same problem.  Does anyone successfully make entry widgets
> non-editable?

Yep, did that a few months ago.  However, I decided to bind the property  
to the individual columns, hence I extended the columns-def structure s.t.  
(fourth (columns-def self)) refers to the editable property.

I addedd the following to def-c-output columns ((self tree-view)).  It  
looks pretty messy, but I have other things to worry about right now


(def-c-output columns ((self tree-view))

...

         for renderer = (case col-type
                          (:boolean (gtk-cell-renderer-toggle-new))
                          (:icon (gtk-cell-renderer-pixbuf-new))
                          (t (gtk-cell-renderer-text-new))) do

           ;; --- support editable columns ---
           (when-bind (editable (fourth (nth pos (columns-def self))))
             ;; make the column editable by modifying the renderer
             (gtk-object-set-property renderer "editable" 'boolean editable)
             (when-bind (on-edit (on-edited self))
               (register-renderer-for-tree-view renderer self pos col-type)
               ;; when an on-edited func is specified, register a callback  
that will funcall on-edited
               (gtk-signal-connect renderer "edited"
                                   (cffi:get-callback (case col-type
                                                        (:boolean  
'tree-view-edit-cell-callback-boolean)
                                                        (t  
'tree-view-edit-cell-callback-string))))))
           ;; --- that's it ---

...



More information about the cells-gtk-devel mailing list