In order to be able to parse GValues and set them, it is necessary for GValue binding to know type mapping between GObject types and Lisp types. Type registration serves to this purpose.
GEnum and GFlags are mapped to CFFI defcenum
and defbitfield
types. Functions register-enum-type
and register-flags-type
add the type to the mapping.
(register-enum-type name type)
Registers the type
to be used for passing value of GEnum type name
between GObject and Lisp.
Example:
(defcenum text-direction :none :ltr :rtl) (register-enum-type "GtkTextDirection" 'text-direction)
(register-flags-type name type)
Registers the type
to be used for passing value of GFlags type name
between GObject and Lisp.
Example:
(defcenum state-type :normal :active :prelight :selected :insensitive) (register-enum-type "GtkStateType" 'state-type)