services: lightdm: Do not use GOOPS.

There's an unwritten policy to not use GOOPS in Guix.

* gnu/services/lightdm.scm (strip-class-name-brackets): Rename to...
(strip-record-type-name-brackets): ... this.
(config->name): Adjust accordingly and use 'record-type-name' instead of
'class-name'.
(list-of-greeter-configurations?): Likewise.
This commit is contained in:
Ludovic Courtès 2022-11-19 17:04:46 +01:00
parent 85f4d87b81
commit 50c17ddd9e
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -40,7 +40,6 @@ (define-module (gnu services lightdm)
#:use-module (guix records)
#:use-module (ice-9 format)
#:use-module (ice-9 match)
#:use-module (oop goops)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (lightdm-seat-configuration
@ -177,17 +176,18 @@ (define-configuration lightdm-gtk-greeter-configuration
"Extra configuration values to append to the LightDM GTK Greeter
configuration file."))
(define (strip-class-name-brackets name)
"Remove the '<<' and '>>' brackets from NAME, a symbol."
(let ((name* (symbol->string name)))
(if (and (string-prefix? "<<" name*)
(string-suffix? ">>" name*))
(string->symbol (string-drop (string-drop-right name* 2) 2))
(error "unexpected class name" name*))))
(define (strip-record-type-name-brackets name)
"Remove the '<' and '>' brackets from NAME, a symbol."
(let ((name (symbol->string name)))
(if (and (string-prefix? "<" name)
(string-suffix? ">" name))
(string->symbol (string-drop (string-drop-right name 1) 1))
(error "unexpected record type name" name))))
(define (config->name config)
"Return the constructor name (a symbol) from CONFIG."
(strip-class-name-brackets (class-name (class-of config))))
(strip-record-type-name-brackets
(record-type-name (struct-vtable config))))
(define (greeter-configuration->greeter-fields config)
"Return the fields of CONFIG, a greeter configuration."
@ -323,7 +323,7 @@ (define (greeter-configuration? config)
(define (list-of-greeter-configurations? greeter-configs)
(and ((list-of greeter-configuration?) greeter-configs)
;; Greeter configurations must also not be provided more than once.
(let* ((types (map (cut (compose class-name class-of) <>)
(let* ((types (map (compose record-type-name struct-vtable)
greeter-configs))
(dupes (filter (lambda (type)
(< 1 (count (cut eq? type <>) types)))