Added finalizing of all gtk+ classes at the end of compilation
[cl-gtk2.git] / glib / glib.string.lisp
blobb2b6c81d1a300fdcc8453c332496956c4e1fad76
1 (in-package :glib)
3 ;; A type that it almost like :string but uses g_malloc and g_free
5 (define-foreign-type g-string-type ()
6 ((free-from-foreign :initarg :fff :reader g-string-type-fff :initform nil)
7 (free-to-foreign :initarg :ftf :reader g-string-type-ftf :initform t))
8 (:actual-type :pointer))
10 (define-parse-method g-string (&key (free-from-foreign nil) (free-to-foreign t))
11 (make-instance 'g-string-type :fff free-from-foreign :ftf free-to-foreign))
13 (defmethod translate-to-foreign (value (type g-string-type))
14 (g-strdup value))
16 (defmethod translate-from-foreign (value (type g-string-type))
17 (prog1
18 (convert-from-foreign value '(:string :free-from-foreign nil))
19 (when (g-string-type-fff type)
20 (g-free value))))