unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* guile-gi: Using Gtk.show_uri and application:get-active-window
@ 2022-03-11 23:59 Luis Felipe
  2022-03-13  0:50 ` Luis Felipe
  2022-03-24 12:44 ` Luis Felipe
  0 siblings, 2 replies; 3+ messages in thread
From: Luis Felipe @ 2022-03-11 23:59 UTC (permalink / raw)
  To: guile-user@gnu.org


[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-24 12:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-11 23:59 guile-gi: Using Gtk.show_uri and application:get-active-window Luis Felipe
2022-03-13  0:50 ` Luis Felipe
2022-03-24 12:44 ` Luis Felipe

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).