[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
guile-gi: Using Gtk.show_uri and application:get-active-window
From: |
Luis Felipe |
Subject: |
guile-gi: Using Gtk.show_uri and application:get-active-window |
Date: |
Fri, 11 Mar 2022 23:59:55 +0000 |
Hi, I want to display the help of an application on Yelp when users click on
"MenuButton → Help" or when they press F1. I already have the relevant actions
connected to a procedure that looks like this:
(define (on-help action app)
#| Show application manual in Yelp. |#
(let [(window (get-active-window app))]
(show-uri window "help:geteka" CURRENT_TIME)))
This fails, however, because there is "No applicable method for generic
get-active-window", even though I have required GTK 4 and loaded GtkApplication
by name.¹ Like so:
(require "Gtk" "4.0")
(load-by-name "Gtk" "Application")
This is the backtrace:
#+begin_example
Backtrace:
In ice-9/boot-9.scm:
1752:10 10 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
9 (apply-smob/0 #<thunk 7f881c152080>)
In ice-9/boot-9.scm:
724:2 8 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
In ice-9/eval.scm:
619:8 7 (_ #(#(#<directory (guile-user) 7f881c158c80>)))
In ice-9/boot-9.scm:
2835:4 6 (save-module-excursion _)
4380:12 5 (_)
In geteka.scm:
21:8 4 (_)
In unknown file:
3 (application:run #<<GtkApplication> 7f881910d780> ("ge…"))
In geteka/views.scm:
79:16 2 (on-help _ _)
In oop/goops.scm:
1567:11 1 (cache-miss #f)
1585:2 0 (_ _ _)
oop/goops.scm:1585:2: No applicable method for #<<generic> get-active-window
(1)> in call (get-active-window #f)
#+end_example
Also, I don't know whether I'm using the CURRENT_TIME constant correctly. It is
part of GDK 4 (GDK_CURRENT_TIME),² which I also required in my module.
For what it's worth, here's the complete code:
https://gitlab.com/luis-felipe/geteka
1. https://docs.gtk.org/gtk4/method.Application.get_active_window.html
2. https://docs.gtk.org/gdk4/const.CURRENT_TIME.html
---
Luis Felipe López Acevedo
https://luis-felipe.gitlab.io/
publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc
Description: application/pgp-keys
signature.asc
Description: OpenPGP digital signature
- guile-gi: Using Gtk.show_uri and application:get-active-window,
Luis Felipe <=