-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I use Gtk, Gdk, etc., functions and constants? #122
Comments
The following works for me:
Using:
and It's possible that |
Apropos doesn't seem to help either:
|
@lshoravi thanks for commenting :) I can confirm that using But here is a modified version of the initial example, anyway, doing what it was expected to do: (use-modules (gi) (gi repository))
(use-typelibs ("Gdk" "4.0") ; CURRENT_TIME
("Gtk" "4.0")
("Gio" "2.0")) ; XXX: MUST BE HERE
(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) Note that I added
Something unexpected here is that placing
Another unexpected thing, although Guix-related, is that the application fails to run if I put the inputs in a manifest instead of passing them directly to Manifest: (use-modules (gnu packages))
(specifications->manifest
(list "gtk"
"guile"
"guile-gi")) Then:
Results in critical errors:
|
I had these issues as well, including #120. The reason for this is that guix "grafts" packages, resulting in guile-gi being built for one version of Gtk but guix is using a slightly different version. Hence the reason for entering the development shell with There's ongoing discussion about this in #96. |
As for what to give load-by-name, I have no idea. |
For completeness, |
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-uri
is unbound.If you use Guix, you can run the example above in Guix shell using the following manifest:
The text was updated successfully, but these errors were encountered: