Package: glib

Type glib:strv-t

Details

The g:strv-t type specifier performs automatic conversion between a list of Lisp strings and an array of C strings of the CFFI :string type.

Examples

Convert a list of strings to and from a C array of strings.
(setq str (cffi:convert-to-foreign (list "Hello" "World") 'g:strv-t))
=> #.(SB-SYS:INT-SAP #X01541998)
(cffi:convert-from-foreign str 'g:strv-t)
=> ("Hello" "World")    
The names property of the g:themed-icon class is an example for the use of the g:strv-t type specifier. The g:themed-icon-new-from-names function creates a themed icon from strings. The accessor for the names property returns the names of the themed icon as a list of strings. Internally, the list list of strings is converted to and from a C array of strings via the g:strv-t type specifier.
(let ((icon (g:themed-icon-new-from-names "gnome-dev-cdrom-audio"
                                          "gnome-dev-cdrom"
                                          "gnome-dev"
                                          "gnome")))
  (g:themed-icon-names icon))
=> ("gnome-dev-cdrom-audio" "gnome-dev-cdrom" "gnome-dev" "gnome")    
 

See also

2025-05-19