Parse GParam with parse-g-param-spec in GValue
[cl-gtk2.git] / glib / gobject.gvalue-parser.lisp
index 212992f..fc4767d 100644 (file)
@@ -1,7 +1,7 @@
 (in-package :gobject)
 
 (defun gvalue-type (gvalue)
-  (foreign-slot-value gvalue 'g-value 'type))
+  (foreign-slot-value gvalue 'g-value :type))
 
 (defmacro ev-case (keyform &body clauses)
   "Macro that is an analogue of CASE except that it evaluates keyforms"
 
 @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 (gvalue-type gvalue))
-         (fundamental-type (g-type-fundamental type)))
+  (let* ((type (ensure-g-type (gvalue-type gvalue)))
+         (fundamental-type (ensure-g-type (g-type-fundamental type))))
     (cond
-      ((= type (g-strv-get-type)) (convert-from-foreign (g-value-get-boxed gvalue) '(glib:gstrv :free-from-foreign nil)))
+      ((= type (ensure-g-type (g-strv-get-type))) (convert-from-foreign (g-value-get-boxed gvalue) '(glib:gstrv :free-from-foreign nil)))
       (t (ev-case fundamental-type
            (+g-type-invalid+ (error "GValue is of invalid type (~A)" (g-type-name type)))
            (+g-type-void+ nil)
@@ -43,7 +43,7 @@
            (+g-type-string+ (g-value-get-string gvalue))
            (+g-type-pointer+ (g-value-get-pointer gvalue))
            (+g-type-boxed+ (parse-gvalue-boxed gvalue))
-                                        ;(+g-type-param+ (parse-gvalue-param gvalue))
+           (+g-type-param+ (parse-g-param-spec (g-value-get-param gvalue)))
            (+g-type-object+ (parse-gvalue-object gvalue))
            (+g-type-interface+ (parse-gvalue-object gvalue))
            (t (error "Unknown type: ~A (~A)" type (g-type-name type))))))))
 @arg[zero-g-value]{a boolean specifying whether GValue should be zero-initialized before assigning. See @fun{g-value-zero}}
 @arg[unset-g-value]{a boolean specifying whether GValue should be \"unset\" before assigning. See @fun{g-value-unset}. The \"true\" value should not be passed to both @code{zero-g-value} and @code{unset-g-value} arguments}
 @arg[g-value-init]{a boolean specifying where GValue should be initialized}"
+  (setf type (ensure-g-type type))
   (cond
     (zero-g-value (g-value-zero gvalue))
     (unset-g-value (g-value-unset gvalue)))
   (when g-value-init (g-value-init gvalue type))
-  (let ((fundamental-type (g-type-fundamental type)))
+  (let ((fundamental-type (ensure-g-type (g-type-fundamental type))))
     (cond
-      ((= type (g-strv-get-type)) (g-value-set-boxed gvalue (convert-to-foreign value 'glib:gstrv)))
+      ((= type (ensure-g-type (g-strv-get-type))) (g-value-set-boxed gvalue (convert-to-foreign value 'glib:gstrv)))
       (t (ev-case fundamental-type
            (+g-type-invalid+ (error "Invalid type (~A)" type))
            (+g-type-void+ nil)