Project directory structure

Dirk Hohndel dirk at hohndel.org
Wed Apr 3 10:31:50 PDT 2013


Tomaz Canabrava <tcanabrava at kde.org> writes:
>> Seriously, though...
>>
>> If I think about the way the current Gtk code works, I think I have an
>> idea of what you might be talking about.
>>
>> Today the UI code calls into the subsurface logic to get things
>> done. Everything is run from the UI main event loop. Is that what you
>> mean by "subsurface is a library that is called from the UI"?
>>
>
> Dirk, yes, it is.
>
> But if you see the GTK code, GtkInterface has a callback, that calls a
> bunch of methods ( that are not related to the UI ), and this methods call
> methods ( that are related to the UI )
>
> for instance,
>
> void parse_file(const char *filename, GError **error, gboolean
> possible_default_filename) updates the UI.
>
> Parse file is 'logic', shouldn't call 'interface',
>
> Interface calls Logic,
> Interface gets the results
> Interface Updates Interface.
>
> this is good for instance if you want to replace Qt for GTK 3 in the future
> :P
> since the UI is not coupled, it's easy to replace.

Oh, good. So you are saying "be more conscious and careful when
separating logic and UI. Logic never calls UI, UI calls logic and acts
on the responses.

As a theory I like this. I have some concerns about the practical
implication: it could be, for example, that the program logic determines
that it needs information and therefore wants to open a dialog....

Think "end of program". It's the logic that determines that the open
file has been modified and that therefore we need to ask the user if she
wants to save the data, right?

(simplistic example to make the point...)

/D


More information about the subsurface mailing list