Re: How do you develop you GTK code?
- From: Tristan Van Berkom <tvb gnome org>
- To: Richard Boaz <riboaz xs4all nl>
- Cc: GTK dev list <gtk-list gnome org>
- Subject: Re: How do you develop you GTK code?
- Date: Sat, 14 Apr 2007 10:57:35 -0400
On Sat, 2007-04-14 at 15:00 +0200, Richard Boaz wrote:
> Hi,
>
>
> Like the others posting so far, I do not use any IDE to program my gtk
> + app. I had a quick look once upon a time, but quickly determined
> that if you want or require to change the code that is automatically
> generated, you might as well just write your own instead of trying to
> get in the deep-end of someone else's ideas about how this should be
> done.
Right, first of all I dont think its correct to suppose that generated
code is anyone's idea of "how it should be done", generated code is
a mechanical spew of "code that works" and should NEVER be used as
an example or reference implementation.
My opinions about glade are biased because I maintain glade, but my
opinion anyway: glade is not an IDE, its a user interface designer -
adding application data and modeling of that data is not a desirable
thing, you want to keep your user interface in one corner and your
data in another - not mix them up in one big pot of spaghetti code.
If you have concerns about dynamic portions of your interface, I agree
they should mostly be done by hand, but wait - glade can still help you
here, say you have a hbox with a label and an entry as was previously
described, you can always put one instance of that in your glade file
and loop like so:
for (i to ... dataentries) {
xml = glade_xml_new (..."dataentryitem"...);
widget = glade_xml_get_widget (xml, "dataentryitem");
/* ... pack into your program somewhere by hand ... */
g_object_unref (xml);
}
This might or might not make sence depending on the application, but
it does have the advantage of keeping your UI dynamic, if you need to
add an item/label/separator or whatever to that subhierarchy than you
dont need to edit or compile code to update your interface.
I also believe that following a template design might be good
for a dumb little CLI wrapper in a GUI - but if you are really
developing an industry grade application then please use your
brain and understand the code - using libglade for your interface
is a good thing because it defers all the repetitive rigid GUI
building code to a library that takes care of it for you - it
also allows you to use YOUR OWN design that is appropriate for
your own application, either by loading dialogs on the fly or
at initialization time - keeping pointers around for the widgets that
you need referenced by name, or by using lookup_widget() types of
paradigms - point being - you are the author of your application
and the sources are in your hands, you should be able to organize
your code in a way that suits the application at hand.
For a good reference implementation - I've repeatedly been pointing
people in the direction of the DevHelp sources, since IMO they use
a sound OO design and a very practical use of libglade (its also
very simple code to understand).
Just my 2 cents, cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]