[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling object communication in GOOPS

From: Zelphir Kaltstahl
Subject: Re: Handling object communication in GOOPS
Date: Fri, 17 Jul 2020 13:26:31 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.8.0

Hello Jan,

to me this sounds like you need to implement perhaps 2 things:

1. a setter for the <address-bar>, which takes care of updating things,
when a completely new <address-bar> is added.

2. some kind of observer pattern, where the <file-manager> registers
itself as a listener to changes in the <address-bar>. Probably a method
at the <address-bar>, something like `register-change-listener`, which
adds the argument it takes to a list or a set of listeners. Then you
need to take care, that on relevant updates all registered listeners are
notified of the change.

Furthermore you can register the <file-manager> as a listener at the
<address-bar> when the <address-bar> is set using the setter and
unregister as listener at the previously set <address-bar> (which is now
replaced by the new one).

I have not worked with GOOPS yet, so my answer is not GOOPS specific and
perhaps there are better ways, but I think this is the classic approach
to the problem.


On 17.07.20 01:24, Jan Wielkiewicz wrote:
> Hello,
> I would like make objects of two different classes communicate, but I'm
> not sure how to implement it or if there already exists something for
> the purpose.
> Say I have two classes: <file-manager> and <address-bar>.
> During initialization of an <file-manager> object, it creates a slot
> containing <address-bar> object.
> I would like to make the <file-manager> object to know when address in
> the address bar is changed, for example (set-address address-bar1
> "/home/user").
> Any suggestions? Thanks in advance.
> Jan Wielkiewicz

reply via email to

[Prev in Thread] Current Thread [Next in Thread]