RE: How do you develop you GTK code?
- From: "Maida, James C. (JSC-SF3)" <james c maida nasa gov>
- To: "Tristan Van Berkom" <tvb gnome org>, "Richard Boaz" <riboaz xs4all nl>
- Cc: GTK dev list <gtk-list gnome org>
- Subject: RE: How do you develop you GTK code?
- Date: Mon, 16 Apr 2007 17:33:44 -0500
I have responsed to some this before, but here goes.
1. Use Glade to create and maintain the XML GUI interface descriptions.
2. Use libglade to parse and create the interface at run-time and you
take care of writing/maintaining your event handlers and other such
stuff.
This process keeps the GTK Gui stuff cleanly interfaced to and separated
from the rest of the code (the really difficult parts of a project)which
you or someone else MUST write and maintain. This formula is almost
bullet proof when jumping from Windows to Linux or back.
-----Original Message-----
From: gtk-list-bounces gnome org [mailto:gtk-list-bounces gnome org] On
Behalf Of Tristan Van Berkom
Sent: Saturday, April 14, 2007 9:58 AM
To: Richard Boaz
Cc: GTK dev list
Subject: Re: How do you develop you GTK code?
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
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]