X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/clg/blobdiff_plain/d53cf0ec9ee3dc48b13ff1048953d6d365fc3203..9cbf385857b0d6f4d41d374e0b1673293eee59a0:/gtk/gtktree.lisp diff --git a/gtk/gtktree.lisp b/gtk/gtktree.lisp index 8469b04..4d11b83 100644 --- a/gtk/gtktree.lisp +++ b/gtk/gtktree.lisp @@ -20,7 +20,7 @@ ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -;; $Id: gtktree.lisp,v 1.28 2007-08-20 10:33:05 espen Exp $ +;; $Id: gtktree.lisp,v 1.34 2008-04-11 20:53:32 espen Exp $ (in-package "GTK") @@ -255,11 +255,12 @@ (defun %make-tree-path (path) location)) (defun %tree-path-to-vector (location) - (let ((indices (%tree-path-get-indices location)) - (depth (%tree-path-get-depth location))) - (if (null-pointer-p indices) - #() - (map-c-vector 'vector #'identity indices 'int depth)))) + (unless (null-pointer-p location) + (let ((indices (%tree-path-get-indices location)) + (depth (%tree-path-get-depth location))) + (if (null-pointer-p indices) + #() + (map-c-vector 'vector #'identity indices 'int depth))))) (defmacro %with-tree-path ((var path) &body body) (let* ((pointer-offset (adjust-offset (size-of 'int) 'pointer)) @@ -368,7 +369,7 @@ (defbinding %tree-row-reference-new () pointer (defmethod allocate-foreign ((reference tree-row-reference) &key model path) (%tree-row-reference-new model path)) -(defbinding tree-row-reference-get-path () tree-path +(defbinding tree-row-reference-get-path () (or null tree-path) (reference tree-row-reference)) (defbinding (tree-row-reference-valid-p "gtk_tree_row_reference_valid") () boolean @@ -383,6 +384,12 @@ (defbinding tree-model-get-iter (model path &optional (iter (make-instance 'tree (model tree-model) (iter tree-iter :in/return) (path tree-path)) + +#?(pkg-exists-p "gtk+-2.0" :atleast-version "2.12.0") +(defmethod allocate-foreign ((tree-iter tree-iter) &rest initargs) + (declare (ignore initargs)) + (let ((size (foreign-size (class-of tree-iter)))) + (slice-alloc size))) (defun ensure-tree-iter (model row) (etypecase row @@ -417,7 +424,7 @@ (defmethod tree-model-row-data ((model tree-model) row) (coerce (loop with iter = (ensure-tree-iter model row) - for index from 0 to (tree-model-n-columns model) + for index from 0 below (tree-model-n-columns model) collect (tree-model-value model iter index)) 'vector)) @@ -568,15 +575,15 @@ (defbinding %tree-selection-path-is-selected () boolean (defbinding %tree-selection-select-iter () nil (tree-selection tree-selection) - (tree-path tree-path)) + (tree-iter tree-iter)) (defbinding %tree-selection-unselect-iter () nil (tree-selection tree-selection) - (tree-path tree-path)) + (tree-iter tree-iter)) (defbinding %tree-selection-iter-is-selected () boolean (tree-selection tree-selection) - (tree-path tree-path)) + (tree-iter tree-iter)) (defun tree-selection-select (selection row) (etypecase row