refreshing the GUI

Dave Peticolas
Wed, 29 Nov 2000 11:11:33 -0800

James LewisMoss writes:
> >>>>> On Wed, 29 Nov 2000 01:59:22 -0800, Dave Peticolas <> sa
> id:
>  Dave> Design ------
>  Dave> The refresh mechanism will be designed in two parts, an engine
>  Dave> component and a GUI component. The engine component will be a
>  Dave> simple change callback mechanism, while the GUI component will
>  Dave> be a GUI entity manager that includes refresh management, as
>  Dave> well as other functionality.
> So a change to data occurs.  The engine has a registered listener in
> the GUI Component Manager that it calls to say something has changed.
> What happens then?

Refreshing is controlled by gnc_suspend_gui_refresh()
gnc_resume_gui_refresh(), and gnc_gui_refresh_all().

The first two are used as a pair:

gnc_suspend_gui_refresh ()

... perform some changes, edit accounts, transactions, etc. ...
... no refresh callbacks occur during this period ...

gnc_resume_gui_refresh () /* This causes the refresh callbacks to
                             be invoked for all the registered
                             components with the changes that
                             ocurred above. */

The last is used when doing very large amounts of changes, for
which it would just be simpler to refresh everything:

gnc_engine_suspend_change_callbacks () /* turn off engine callbacks */

... destroy all entities ...
... load new ones from file ...

gnc_engine_resume_change_callbaks ()

gnc_gui_refresh_all () /* force all components to refresh unconditionally */

> I'm trying to figure out what the close, find and iteration callbacks
> are meant to do and who registers with who.

The close callback is for closing the gui component. The CM is meant to
be more than just a refresh manager.

The find callback is so components can find related components in the
same class (for example, if the user opens and already open account,
the existing window should be raised instead of opening a new one).

The iteration is to aid component management. Right now, it will mainly
be used in conjunction with the close operation, but there could be
additional uses in the future.