(let* ((args (parse-closure-arguments count-of-args args))
(function-id (foreign-slot-value closure 'lisp-closure :function-id))
(return-type (and (not (null-pointer-p return-value))
- (gvalue-type return-value)))
+ (g-value-type return-value)))
(fn (get-stable-pointer-value function-id))
(fn-result (call-with-restarts fn args)))
(when return-type
(defun parse-closure-arguments (count-of-args args)
(loop
for i from 0 below count-of-args
- collect (parse-gvalue (mem-aref args 'g-value i))))
+ collect (parse-g-value (mem-aref args 'g-value i))))
(defun create-g-closure (fn)
(let ((function-id (allocate-stable-pointer fn))
(t (g-value-take-boxed gvalue (g-boxed->cstruct value :alloc-type :boxed)))))
(g-value-set-boxed gvalue (null-pointer))))
-(defun parse-gvalue-boxed (gvalue)
- (let* ((g-type (gvalue-type gvalue))
+(defun parse-g-value-boxed (gvalue)
+ (let* ((g-type (g-value-type gvalue))
(type-name (g-type-name g-type))
(boxed-type (get-registered-boxed-type type-name)))
(unless boxed-type
(warn "Type ~A is a not registered GBoxed~%" type-name)
- (return-from parse-gvalue-boxed nil))
+ (return-from parse-g-value-boxed nil))
(unless (null-pointer-p (g-value-get-boxed gvalue))
(cond
((subtypep boxed-type 'g-boxed-ref) (convert-g-boxed-ref-from-pointer (g-value-get-boxed gvalue) boxed-type (make-instance 'g-boxed-ref-type :class-name boxed-type :owner :foreign)))
(t (parse-g-boxed (g-value-get-boxed gvalue) boxed-type))))))
-(defmethod parse-gvalue-for-type (gvalue-ptr (type-numeric (eql +g-type-boxed+)))
- (if (= (g-type-numeric (gvalue-type gvalue-ptr)) type-numeric)
+(defmethod parse-g-value-for-type (gvalue-ptr (type-numeric (eql +g-type-boxed+)))
+ (if (= (g-type-numeric (g-value-type gvalue-ptr)) type-numeric)
(convert-from-foreign (g-value-get-boxed gvalue-ptr) '(glib:gstrv :free-from-foreign nil))
- (parse-gvalue-boxed gvalue-ptr)))
+ (parse-g-value-boxed gvalue-ptr)))
(defmethod set-gvalue-for-type (gvalue-ptr (type-numeric (eql +g-type-boxed+)) value)
- (if (= (g-type-numeric (gvalue-type gvalue-ptr)) type-numeric)
+ (if (= (g-type-numeric (g-value-type gvalue-ptr)) type-numeric)
(g-value-set-boxed gvalue-ptr (convert-to-foreign value '(glib:gstrv :free-from-foreign nil)))
(set-gvalue-boxed gvalue-ptr value)))
(+g-type-string+ (g-param-spec-string property-name property-name property-name "" flags))
(+g-type-pointer+ (g-param-spec-pointer property-name property-name property-name flags))
(+g-type-boxed+ (g-param-spec-boxed property-name property-name property-name property-g-type flags))
- ;(+g-type-param+ (parse-gvalue-param gvalue))
+ ;(+g-type-param+ (parse-g-value-param gvalue))
(+g-type-object+ (g-param-spec-object property-name property-name property-name property-g-type flags))
;(+g-type-interface+ )
(t (error "Unknown type: ~A (~A)" property-g-type (g-type-name property-g-type)))))))
(lisp-type-info (gethash type-name *registered-types*))
(property-info (find property-name (object-type-properties lisp-type-info) :test 'string= :key 'first))
(property-set-fn (fifth property-info))
- (new-value (parse-gvalue value)))
+ (new-value (parse-g-value value)))
(debugf "set(~A,'~A',~A)~%" lisp-object property-name new-value)
(restart-case
(funcall property-set-fn new-value lisp-object)
for i from 0 below (foreign-type-size 'g-value)
do (setf (mem-ref g-value :uchar i) 0)))
-(defun gvalue-type (gvalue)
+(defun g-value-type (gvalue)
(foreign-slot-value gvalue 'g-value :type))
(defmacro ev-case (keyform &body clauses)
`(t ,@forms)
`((equalp ,key ,value) ,@forms)))))))
-(defgeneric parse-gvalue-for-type (gvalue-ptr type-numeric))
+(defgeneric parse-g-value-for-type (gvalue-ptr type-numeric))
-(defmethod parse-gvalue-for-type (gvalue-ptr type-numeric)
+(defmethod parse-g-value-for-type (gvalue-ptr type-numeric)
(if (= type-numeric (g-type-numeric (g-type-fundamental type-numeric)))
(call-next-method)
- (parse-gvalue-for-type gvalue-ptr (g-type-numeric (g-type-fundamental type-numeric)))))
+ (parse-g-value-for-type gvalue-ptr (g-type-numeric (g-type-fundamental type-numeric)))))
-(defun parse-gvalue (gvalue)
+(defun parse-g-value (gvalue)
"Parses the GValue structure and returns the corresponding Lisp object.
@arg[value]{a C pointer to the GValue structure}
@return{value contained in the GValue structure. Type of value depends on GValue type}"
- (let* ((type (g-type-numeric (gvalue-type gvalue)))
+ (let* ((type (g-type-numeric (g-value-type gvalue)))
(fundamental-type (g-type-numeric (g-type-fundamental type))))
(ev-case fundamental-type
(+g-type-invalid+ (error "GValue is of invalid type (~A)" (g-type-name type)))
(+g-type-ulong+ (g-value-get-ulong gvalue))
(+g-type-int64+ (g-value-get-int64 gvalue))
(+g-type-uint64+ (g-value-get-uint64 gvalue))
- (+g-type-enum+ (parse-gvalue-enum gvalue))
- (+g-type-flags+ (parse-gvalue-flags gvalue))
+ (+g-type-enum+ (parse-g-value-enum gvalue))
+ (+g-type-flags+ (parse-g-value-flags gvalue))
(+g-type-float+ (g-value-get-float gvalue))
(+g-type-double+ (g-value-get-double gvalue))
(+g-type-string+ (g-value-get-string gvalue))
- (t (parse-gvalue-for-type gvalue type)))))
+ (t (parse-g-value-for-type gvalue type)))))
-(defmethod parse-gvalue-for-type (gvalue-ptr (type-numeric (eql +g-type-pointer+)))
+(defmethod parse-g-value-for-type (gvalue-ptr (type-numeric (eql +g-type-pointer+)))
(g-value-get-pointer gvalue-ptr))
-(defmethod parse-gvalue-for-type (gvalue-ptr (type-numeric (eql +g-type-param+)))
+(defmethod parse-g-value-for-type (gvalue-ptr (type-numeric (eql +g-type-param+)))
(parse-g-param-spec (g-value-get-param gvalue-ptr)))
(defgeneric set-gvalue-for-type (gvalue-ptr type-numeric value))
(defun registered-enum-type (name)
(gethash name *registered-enum-types*))
-(defun parse-gvalue-enum (gvalue)
- (let* ((g-type (gvalue-type gvalue))
+(defun parse-g-value-enum (gvalue)
+ (let* ((g-type (g-value-type gvalue))
(type-name (g-type-name g-type))
(enum-type (registered-enum-type type-name)))
(unless enum-type
(convert-from-foreign (g-value-get-enum gvalue) enum-type)))
(defun set-gvalue-enum (gvalue value)
- (let* ((g-type (gvalue-type gvalue))
+ (let* ((g-type (g-value-type gvalue))
(type-name (g-type-name g-type))
(enum-type (registered-enum-type type-name)))
(unless enum-type
(defun registered-flags-type (name)
(gethash name *registered-flags-types*))
-(defun parse-gvalue-flags (gvalue)
- (let* ((g-type (gvalue-type gvalue))
+(defun parse-g-value-flags (gvalue)
+ (let* ((g-type (g-value-type gvalue))
(type-name (g-type-name g-type))
(flags-type (registered-flags-type type-name)))
(unless flags-type
(convert-from-foreign (g-value-get-flags gvalue) flags-type)))
(defun set-gvalue-flags (gvalue value)
- (let* ((g-type (gvalue-type gvalue))
+ (let* ((g-type (g-value-type gvalue))
(type-name (g-type-name g-type))
(flags-type (registered-flags-type type-name)))
(unless flags-type
(etypecase object
(g-object (pointer object)))))
-(defun parse-gvalue-object (gvalue)
+(defun parse-g-value-object (gvalue)
(get-g-object-for-pointer (g-value-get-object gvalue)))
(defun set-gvalue-object (gvalue value)
(g-value-set-object gvalue (if value (pointer value) (null-pointer))))
-(defmethod parse-gvalue-for-type (gvalue-ptr (type-numeric (eql +g-type-object+)))
- (parse-gvalue-object gvalue-ptr))
+(defmethod parse-g-value-for-type (gvalue-ptr (type-numeric (eql +g-type-object+)))
+ (parse-g-value-object gvalue-ptr))
-(defmethod parse-gvalue-for-type (gvalue-ptr (type-numeric (eql +g-type-interface+)))
- (parse-gvalue-object gvalue-ptr))
+(defmethod parse-g-value-for-type (gvalue-ptr (type-numeric (eql +g-type-interface+)))
+ (parse-g-value-object gvalue-ptr))
(defmethod set-gvalue-for-type (gvalue-ptr (type-numeric (eql +g-type-object+)) value)
(set-gvalue-object gvalue-ptr value))
(with-foreign-object (return-value 'g-value)
(g-value-zero return-value)
(g-value-init return-value (signal-info-return-type signal-info))
- (prog1 (parse-gvalue return-value)
+ (prog1 (parse-g-value return-value)
(g-value-unset return-value))))
(iter (for i from 0 below (1+ params-count))
(g-value-unset (mem-aref params 'g-value i))))))))
(g-value-init value property-type)
(g-object-get-property object-ptr property-name value)
(unwind-protect
- (parse-gvalue value)
+ (parse-g-value value)
(g-value-unset value))))
(defun g-object-call-set-property (object-ptr property-name new-value
(defpackage :gobject
(:use :cl :glib :cffi :tg :bordeaux-threads :iter :closer-mop :gobject.ffi)
(:export #:g-type
+ #:g-type-string
+ #:g-type-numeric
#:g-type-children
#:g-type-parent
#:g-type-designator
#:define-vtable
#:g-type
#:set-g-value
- #:parse-gvalue
+ #:parse-g-value
#:emit-signal
#:g-value-unset
#:g-value-zero
#:flags-item-value
#:flags-item-nick
#:get-flags-items
- #:stable-pointer-value)
+ #:stable-pointer-value
+ #:g-value-type)
(:documentation
"CL-GTK2-GOBJECT is a binding to GObject type system.
For information on GObject, see its @a[http://library.gnome.org/devel/gobject/stable/]{documentation}.
(g-value-unset gvalue)
(g-value-init gvalue (ensure-g-type type))
(gtk-container-child-get-property container child property-name gvalue)
- (prog1 (parse-gvalue gvalue)
+ (prog1 (parse-g-value gvalue)
(g-value-unset gvalue))))
(defun container-call-set-property (container child property-name new-value type)
(with-foreign-object (v 'g-value)
(g-value-zero v)
(gtk-tree-model-get-value tree-model iter column v)
- (prog1 (parse-gvalue v)
+ (prog1 (parse-g-value v)
(g-value-unset v))))
(export 'tree-model-value)