unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Guile-GI: <GSimpleAction>: Setting parameter type to None or NULL
@ 2021-04-25 19:36 Luis Felipe
  2021-04-25 20:44 ` Mike Gran
  0 siblings, 1 reply; 5+ messages in thread
From: Luis Felipe @ 2021-04-25 19:36 UTC (permalink / raw)
  To: guile-user@gnu.org

Hello again,

I want to add actions to an application but I can't seem to find the correct value to indicate that no parameter should be passed to a handler.

In Python, for example, I do this:

  action = Gio.SimpleAction.new("about", None)

In Guile, I'm doing it like this for now:

  (let [(action (make «GSimpleAction» #:name "about"))
        ...]

    ...)

But what I need to indicate is:

  (make «GSimpleAction» #:name "about" #:parameter-type None)

So what's the equivalent to None in Guile?


Any help is very welcome,


---
Luis Felipe López Acevedo
https://luis-felipe.gitlab.io/



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

* Re: Guile-GI: <GSimpleAction>: Setting parameter type to None or NULL
  2021-04-25 19:36 Guile-GI: <GSimpleAction>: Setting parameter type to None or NULL Luis Felipe
@ 2021-04-25 20:44 ` Mike Gran
  2021-04-25 21:47   ` Luis Felipe
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Gran @ 2021-04-25 20:44 UTC (permalink / raw)
  To: Luis Felipe; +Cc: guile-user@gnu.org

On Sun, Apr 25, 2021 at 07:36:04PM +0000, Luis Felipe wrote:
> Hello again,
> 
> I want to add actions to an application but I can't seem to find the correct value to indicate that no parameter should be passed to a handler.
> 
> In Python, for example, I do this:
> 
>   action = Gio.SimpleAction.new("about", None)

The guile-gi equivalent would be

  (set! action (simple-action:new "about"))
or
  (set! action (simple-action:new "about" #f))

> 
> In Guile, I'm doing it like this for now:
> 
>   (let [(action (make ??GSimpleAction?? #:name "about"))
>         ...]
> 
>     ...)
> 
> But what I need to indicate is:
> 
>   (make ??GSimpleAction?? #:name "about" #:parameter-type None)
> 
> So what's the equivalent to None in Guile?

In this form, you'd do the following. Leaving out the #:parameter-type
from the constructor sets it to to its default of what Python would
call None.

   (make <GSimpleAction> #:name "about")

Regards,
Mike

> 
> 
> Any help is very welcome,
> 
> 
> ---
> Luis Felipe L??pez Acevedo
> https://luis-felipe.gitlab.io/
> 



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

* Re: Guile-GI: <GSimpleAction>: Setting parameter type to None or NULL
  2021-04-25 20:44 ` Mike Gran
@ 2021-04-25 21:47   ` Luis Felipe
  2021-04-26  0:16     ` Mike Gran
  0 siblings, 1 reply; 5+ messages in thread
From: Luis Felipe @ 2021-04-25 21:47 UTC (permalink / raw)
  To: Mike Gran; +Cc: guile-user@gnu.org

On Sunday, April 25, 2021 8:44 PM, Mike Gran <spk121@yahoo.com> wrote:

> In this form, you'd do the following. Leaving out the #:parameter-type
> from the constructor sets it to to its default of what Python would
> call None.
>
> (make <GSimpleAction> #:name "about")

Thanks for checking, Mike. I'm actually doing this (omitting #:parameter-type), but then, when I run the application and interact with something in the GUI that should trigger an action, I get the following error, and the appropriate callbacks are never run:

Backtrace:
In ice-9/boot-9.scm:
  1736:10  7 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
           6 (apply-smob/0 #<thunk 7f367913fd20>)
In ice-9/boot-9.scm:
    718:2  5 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
In ice-9/eval.scm:
    619:8  4 (_ #(#(#<directory (guile-user) 7f3679139c80>)))
In ice-9/boot-9.scm:
   2806:4  3 (save-module-excursion _)
  4351:12  2 (_)
In geteka.scm:
    153:8  1 (_)
In unknown file:
           0 (application:run #<<GtkApplication> 7f367819b5e0> ("ge…"))

ERROR: In procedure application:run:
In procedure gig_value_to_scm: unknown type "GVariant"


I thought that maybe this could be related to not specifying #:paramenter-type... So I don't understand what I'm doing wrong. This is the application I'm trying to write:

https://gitlab.com/luis-felipe/geteka/-/blob/master/geteka.scm

The actions and connections are defined in the "app:activate" and "app:startup" procedures.



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

* Re: Guile-GI: <GSimpleAction>: Setting parameter type to None or NULL
  2021-04-25 21:47   ` Luis Felipe
@ 2021-04-26  0:16     ` Mike Gran
  2021-04-26  1:40       ` Luis Felipe
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Gran @ 2021-04-26  0:16 UTC (permalink / raw)
  To: Luis Felipe; +Cc: guile-user@gnu.org

On Sun, Apr 25, 2021 at 09:47:58PM +0000, Luis Felipe wrote:
> On Sunday, April 25, 2021 8:44 PM, Mike Gran <spk121@yahoo.com> wrote:
> 
> > In this form, you'd do the following. Leaving out the #:parameter-type
> > from the constructor sets it to to its default of what Python would
> > call None.
> >
> > (make <GSimpleAction> #:name "about")
> 
> Thanks for checking, Mike. I'm actually doing this (omitting #:parameter-type), but then, when I run the application and interact with something in the GUI that should trigger an action, I get the following error, and the appropriate callbacks are never run:
> 
> Backtrace:
> In ice-9/boot-9.scm:
>   1736:10  7 (with-exception-handler _ _ #:unwind? _ # _)
> In unknown file:
>            6 (apply-smob/0 #<thunk 7f367913fd20>)
> In ice-9/boot-9.scm:
>     718:2  5 (call-with-prompt _ _ #<procedure default-prompt-handle???>)
> In ice-9/eval.scm:
>     619:8  4 (_ #(#(#<directory (guile-user) 7f3679139c80>)))
> In ice-9/boot-9.scm:
>    2806:4  3 (save-module-excursion _)
>   4351:12  2 (_)
> In geteka.scm:
>     153:8  1 (_)
> In unknown file:
>            0 (application:run #<<GtkApplication> 7f367819b5e0> ("ge???"))
> 
> ERROR: In procedure application:run:
> In procedure gig_value_to_scm: unknown type "GVariant"

Well, um, the truth is that the conversion of values of type GVariant
to SCM was never implemented. I went ahead and made that fix and
pushed it into guile-gi master branch. With the fix (and after
importing TextBuffer and TextView) clicking on "Say hello!" does set
the main window to "hello" which I believe is what is intended.

Unforunately it may take time to write the unit test and then get a
new guile-gi release over to Guix.

Apologies,
Mike



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

* Re: Guile-GI: <GSimpleAction>: Setting parameter type to None or NULL
  2021-04-26  0:16     ` Mike Gran
@ 2021-04-26  1:40       ` Luis Felipe
  0 siblings, 0 replies; 5+ messages in thread
From: Luis Felipe @ 2021-04-26  1:40 UTC (permalink / raw)
  To: Mike Gran; +Cc: guile-user@gnu.org

On Monday, April 26, 2021 12:16 AM, Mike Gran <spk121@yahoo.com> wrote:

> Well, um, the truth is that the conversion of values of type GVariant
> to SCM was never implemented. I went ahead and made that fix and
> pushed it into guile-gi master branch. With the fix (and after
> importing TextBuffer and TextView) clicking on "Say hello!" does set
> the main window to "hello" which I believe is what is intended.
>
> Unforunately it may take time to write the unit test and then get a
> new guile-gi release over to Guix.
>
> Apologies,

No problem, Mike, thanks for working on it.




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

end of thread, other threads:[~2021-04-26  1:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-25 19:36 Guile-GI: <GSimpleAction>: Setting parameter type to None or NULL Luis Felipe
2021-04-25 20:44 ` Mike Gran
2021-04-25 21:47   ` Luis Felipe
2021-04-26  0:16     ` Mike Gran
2021-04-26  1:40       ` 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).