[Glade-users] The best way to use Glade generated code : suggestions to newbies from a newbie



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
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
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)
Regards
Manish

In a world without fences, limits, boundaries and walls,
Who needs windows and gates??






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