unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* guile_gi question: gtk+ interface object?
@ 2022-06-14 18:46 Andy Tai
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Tai @ 2022-06-14 18:46 UTC (permalink / raw)
  To: guile-user

question: how to create object representing Gtk+ (version 3)
interfaces? For example.

(let (model (make <GtkTreeModel>)))

would fail  because GtkTreeModel is an interface, not class derived
from GObject.

Thanks



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

* guile_gi question: gtk+ interface object?
@ 2022-06-14 18:52 Andy Tai
  2022-06-14 19:42 ` Maxime Devos
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Tai @ 2022-06-14 18:52 UTC (permalink / raw)
  To: guile-user

question: how to create object representing Gtk+ (version 3)
interfaces? For example.

(let (model (make <GtkTreeModel>)))

would fail  because GtkTreeModel is an interface, not class derived
from GObject.

Thanks



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

* Re: guile_gi question: gtk+ interface object?
  2022-06-14 18:52 guile_gi question: gtk+ interface object? Andy Tai
@ 2022-06-14 19:42 ` Maxime Devos
  2022-06-15  4:05   ` Andy Tai
  0 siblings, 1 reply; 5+ messages in thread
From: Maxime Devos @ 2022-06-14 19:42 UTC (permalink / raw)
  To: Andy Tai, guile-user

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

Andy Tai schreef op di 14-06-2022 om 11:52 [-0700]:
> question: how to create object representing Gtk+ (version 3)
> interfaces? For example.
> 
> (let (model (make <GtkTreeModel>)))
> 
> would fail  because GtkTreeModel is an interface, not class derived
> from GObject.

By definition, you cannot instatiate interfaces, but you can
instantiate classes derived from GtkTreeModel?  Seems like you answered
the question yourself?
Maybe guile-gi even supports defining an implementation yourself in
Scheme with GOOPS ...

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* Re: guile_gi question: gtk+ interface object?
  2022-06-14 19:42 ` Maxime Devos
@ 2022-06-15  4:05   ` Andy Tai
  2022-06-15  7:48     ` Maxime Devos
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Tai @ 2022-06-15  4:05 UTC (permalink / raw)
  To: Maxime Devos; +Cc: guile-user

Hi, thanks for the reply.   The interface in GObject level does not
necessarily translate as is to GOOPS at guile level...

the context of this question is

(let ((iter (make <GtkTreeIter>))
 (model (make <GtkTreeModel>)))
(define selected (tree-selection:get-selected! selection model iter))

get_selected(GtkTreeModel out model, GtkTreeeIter out iter) has two
out parameters, model and iter, but I think GOOPS does type check on
arguments before invoking a method so  both parameters must be
initialized to the expected types.
The model parameter normally is instance of a GOBject class
"implementing" the GtkTreeModel interface (at the GOBject level), and
I cannot pass in a concrete GOBject class that implements GtkTreeModel
 as GOOPS will reject such calls--GOOPS does not understand "class
implementing an interface" at the GOBject level.  So I don't know how
to initialize the model parameter.

On Tue, Jun 14, 2022 at 12:42 PM Maxime Devos <maximedevos@telenet.be> wrote:
>
> Andy Tai schreef op di 14-06-2022 om 11:52 [-0700]:
> > question: how to create object representing Gtk+ (version 3)
> > interfaces? For example.
> >
> > (let (model (make <GtkTreeModel>)))
> >
> > would fail  because GtkTreeModel is an interface, not class derived
> > from GObject.
>
> By definition, you cannot instatiate interfaces, but you can
> instantiate classes derived from GtkTreeModel?
> Maybe guile-gi even supports defining an implementation yourself in
> Scheme with GOOPS ...
>



-- 
Andy Tai, atai@atai.org, Skype: licheng.tai, Line: andy_tai, WeChat: andytai1010
Year 2021 民國110年
自動的精神力是信仰與覺悟
自動的行為力是勞動與技能



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

* Re: guile_gi question: gtk+ interface object?
  2022-06-15  4:05   ` Andy Tai
@ 2022-06-15  7:48     ` Maxime Devos
  0 siblings, 0 replies; 5+ messages in thread
From: Maxime Devos @ 2022-06-15  7:48 UTC (permalink / raw)
  To: Andy Tai; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

Andy Tai schreef op di 14-06-2022 om 21:05 [-0700]:
> (let ((iter (make <GtkTreeIter>))
>  (model (make <GtkTreeModel>)))
> (define selected (tree-selection:get-selected! selection model iter))
> 
> get_selected(GtkTreeModel out model, GtkTreeeIter out iter) has two
> out parameters, model and iter,

Looking at 
<https://spk121.github.io/guile-gi/Function-Parameters-Arity-and-Return-Values.html>,
on the Scheme level the output parameters would be converted to return values,
so the API would be

(receive (selected iter model)
  (tree-selection:get-selected selection) ; or 
  [do things with iter and iter and model])

Doesn't seem to work though -- looking at
(generic-function-methods tree-selection:get-selected), Guile-GI incorrectly
doesn't convert it to a return value or something?

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

end of thread, other threads:[~2022-06-15  7:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14 18:52 guile_gi question: gtk+ interface object? Andy Tai
2022-06-14 19:42 ` Maxime Devos
2022-06-15  4:05   ` Andy Tai
2022-06-15  7:48     ` Maxime Devos
  -- strict thread matches above, loose matches on Subject: below --
2022-06-14 18:46 Andy Tai

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