Package: gobject
Function gobject:object-data
Lambda Listgobject:object-data (object key) SyntaxArgumentsDetails
Each object carries around a table of associations from strings to pointers. The g:object-data function gets a named field from the objects table of associations. The (setf g:object-data) function sets an association. If the
object already had an association with that name, the old association will be
destroyed. Examples
(defvar item (make-instance 'g:menu-item)) => ITEM
;; Set an integer
(setf (g:object-data item "prop") 123) => 123
(g:object-data item "prop") => 123
;; Set a Lisp list
(setf (g:object-data item "prop") '(a b c)) => (A B C)
(g:object-data item "prop") => (A B C)
;; Set a GObject
(setf (g:object-data item "prop") (make-instance 'g:menu-item))
=> #<GIO:MENU-ITEM {1001AAA263}>
(g:object-data item "prop")
=> #<GIO:MENU-ITEM {1001AAA263}>
;; Clear the association
(setf (g:object-data item "prop") nil) => nil
(g:object-data item "prop") => nil | See also |
2025-06-21