Re: Large GTK Application design tips

2008/9/12 Paul Stuart <Paul_Stuart seektech com>:
> I'm curious; a number of people have recommended to "make your own widget". Is this recommendation purely to give one's application a unique feel, or is there an efficiency gain to be had in creating a custom widget?

The suggestion is to use gtk's object system to wrap up collections of
widgets as new widgets. If you have a set of widgets you find yourself
commonly using together, make a new widget that encapsulates them as a
single thing. Now you can use the usual gtk api to manipulate them and
you gain regularity in your app's structure.

I'd also suggest a complete model/view split (sorry of this is
obvious). It depends on the application of course, but commonly the
model part of the app consists of a large set of objects of a variety
of types, all linked together. You can often:

* implement the model's types with gobject (ie. subclass gobject and
to make non-gui gobjects)
* make a parallel widget for each type which draws the view for that
part of the model
* have a 'changed' signal from your model objects which puts the
matching view on a 'to be refreshed' list
* on idle, refresh any view widgets that need updating

It's all part of breaking the app up into mostly independent chunks of code.


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