Hi,
I asked this question on Guile's mailing list, but I thought I might have better luck here.
In summary, I haven't been able to figure out how to call functions, like Gtk's show_uri, or use constants, like Gdk's CURRENT_TIME.
Take this application for example:
(use-modules (gi) (gi repository))
(require "Gio" "2.0")
(require "Gtk" "4.0")
(load-by-name "Gio" "Application") ;; activate, run
(load-by-name "Gtk" "Application")
(load-by-name "Gtk" "ApplicationWindow")
(load-by-name "Gtk" "Button")
(load-by-name "Gtk" "Window")
(define (on-activate app)
(let* ((window (make <GtkApplicationWindow>
#:application app
#:default-height 200
#:default-width 200
#:title "Window"))
(button (make <GtkButton> #:label "Help")))
(set-child window button)
(connect button clicked (lambda _ (show-uri window "help:gedit" CURRENT_TIME)))
(present window)))
(define (main)
(let ((app (make <GtkApplication> #:application-id "org.gtk.example")))
(connect app activate on-activate)
(run app (command-line))))
(main)
When I click the Help button, the application shuts down and says that show-uri is unbound.
$ guile gtk-functions.scm
WARNING: (guile-user): imported module (gi) overrides core binding `quit'
WARNING: (guile-user): imported module (gi) overrides core binding `command-line'
WARNING: (guile-user): imported module (gi) overrides core binding `shutdown'
WARNING: (guile-user): imported module (gi) overrides core binding `connect'
Backtrace:
In ice-9/boot-9.scm:
1752:10 7 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
6 (apply-smob/0 #<thunk 7f33c1417080>)
In ice-9/boot-9.scm:
724:2 5 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
In ice-9/eval.scm:
619:8 4 (_ #(#(#<directory (guile-user) 7f33c141dc80>)))
In ice-9/boot-9.scm:
2835:4 3 (save-module-excursion _)
4380:12 2 (_)
In unknown file:
1 (application:run #<<GtkApplication> 7f33c04782a0> ("gt…"))
In /home/yo/Descargas/gtk-functions.scm:
22:39 0 (_ . _)
/home/yo/Descargas/gtk-functions.scm:22:39: Unbound variable: show-uri
If you use Guix, you can run the example above in Guix shell using the following manifest:
#| GNU Guix manifest.
guix 579e9e9
repository URL: https://git.savannah.gnu.org/git/guix.git
branch: master
commit: 579e9e9509f45fdc8543323b3c9f662b53dbfc6d |#
(use-modules (gnu packages))
(specifications->manifest
(list ;; "gnome@41.0" ; For containerized environment only.
"gobject-introspection@1.66.1"
"gtk@4.4.1"
"guile@3.0.7"
"guile-gi@0.3.2"))
Hi,
I asked this question on Guile's mailing list, but I thought I might have better luck here.
In summary, I haven't been able to figure out how to call functions, like Gtk's show_uri, or use constants, like Gdk's CURRENT_TIME.
Take this application for example:
When I click the Help button, the application shuts down and says that
show-uriis unbound.If you use Guix, you can run the example above in Guix shell using the following manifest: