
;; Copyright (C) 2026 Tommi Höynälänmaa

;; Distributed under GNU Lesser General Public License.


(define-proper-program (intr-dbus-examples introspect2 main)
  
  
  (import (standard-library core)
          (standard-library list-utilities)
          (standard-library console-io))
  

  (import (theme-d-intr base variant)
          (theme-d-intr dbus connection)
          (intr-dbus-examples introspect2 org_freedesktop_DBus_Introspectable))


  (define-simple-method introspect
      (((conn <g-dbus-connection>)
        (str-service <string>)
        (str-object <string>))
       <string> nonpure)
    (org_freedesktop_DBus_Introspectable:Introspect
     conn
     str-service
     str-object
     '()
     -1
     #f))


  (define-main-proc (((l-args (:uniform-list <string>))) <none> nonpure)
    (let* ((conn
            (g-bus-get-sync 'session #f))
           (str-service (uniform-list-ref l-args 1))
           (str-object (uniform-list-ref l-args 2))
           (str-intr (introspect conn str-service str-object)))
      (console-display-line str-intr))))


