From: Luis Felipe <luis.felipe.la@protonmail.com>
To: "guile-user@gnu.org" <guile-user@gnu.org>
Subject: guile-gi: Using Gtk.show_uri and application:get-active-window
Date: Fri, 11 Mar 2022 23:59:55 +0000 [thread overview]
Message-ID: <fX0sYkGVGGTqb2TbjHTkMm2whP197qGNzKDXQh2fSzmaCiME5KZLT8WVNmMZK9Isz4MXLFdIZcABEgHvnxPIkC_guHR74dhv9l2Y-wOELwA=@protonmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1900 bytes --]
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/
[-- Attachment #1.2: publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc --]
[-- Type: application/pgp-keys, Size: 1815 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 509 bytes --]
next reply other threads:[~2022-03-11 23:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-11 23:59 Luis Felipe [this message]
2022-03-13 0:50 ` guile-gi: Using Gtk.show_uri and application:get-active-window Luis Felipe
2022-03-24 12:44 ` Luis Felipe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='fX0sYkGVGGTqb2TbjHTkMm2whP197qGNzKDXQh2fSzmaCiME5KZLT8WVNmMZK9Isz4MXLFdIZcABEgHvnxPIkC_guHR74dhv9l2Y-wOELwA=@protonmail.com' \
--to=luis.felipe.la@protonmail.com \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).