Re: The best way to use Glade generated code : suggestions to newbies from a newbie



El dom, 22 de 02 de 2004 a las 09:01, Manish Chakravarty escribiÃ:
Hi all fellow newbies,

Just discovered a method which takes care of all those variabe problems in
Glade and makes coding hassle free:
First let me describe a typical problem newbies face in programming with
Glade/GTK for the first time:
You design two windows, A & B
A is the window to be shown initially when the program starts
When the user presses "OK", window A disappears and wnidow B is shown
typically what Glade will put in main() is :
GtkWidget *window1;
blah, blah blah
..................
.......................
then we have
window1 = new GtkWidget (....);
gtk_widget_show(window1);

then, in callbacks. we will have
_on_button_OK_clicked(){
....................
}
functions

this causes the pointer passing and manipulation problems

Sorry, but ... what problems ?

In the other hand, I've never seen glade starting a function name with
_on_ but on_ , may be a typo ?

I WOULOD RECOMMEND THE FOLLOWING SOLN TO ALL SUCH PROBLEMS FOR NEWBIES::
1) Make your UI in glade as you normally would.
2) Generate the source files
(the first two steps are common with the established procedure)
3) APPEND callbacks.c to main.c
4) include "callbacks.h" in main.c after all other files have been included
5) Remove all references to callbacks.c in your makefile, but DO NOT delete

You need to clean your Makefile.am not your Makefile. If you don't clean
the Makefile.am, the next ./configure in other user's machine will
remake the Makefiles with the erased files referenced.

it or move it from its original location
6) Now edit the funcitons like on _button_ok_clicked_() to you heart's
content..

PROS KINDLY NOTE: i dont write code from scratch.. i use the following
approach and my work gets done quickly and effecdiently.

Hackers and Experts, please comment... and Newbies like me... this is one
way to go (i guess)

I'm not sure I reach the groups you mention (pros, hacker or experts)
but I don't know what the "the pointer passing and manipulation
problems" is, and I'm not a newbie.

You can tweak the generated sources from glade, and I'm sure most coders
do it, but there's no problems in those sources, and can be used exactly
as Glade produce it.

There's not an *obligation* to tweak them to make them work.

I'd like to know what problems you're facing that binds you to change
Glade generated sources, but it's not in Glade.

If you can't use those sources when generated, there's something you are
not making properly.

So my suggestion to newbies is, try to use the glade generated files.
There's no need to change them.


Regards
-- 
Iago Rubio                http://www.iagorubio.com          
GPGkey pgp.rediris.es id 0x909BD4DD  fingerprint =
D18A B950 5F03 BB9A DD89  AA75 FEDF 1978 909B D4DD
********** iago.rubio(AT)hispalinux.es  **********     
--------------------------------------------------

Attachment: signature.asc
Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente



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