Re: Passing structure with a callback



It occurs to me that the problem here may be that all roads lead to gtk_main().

If my current theory is correct, then by creating the emailshare structure in
the MainMenu function that structure is not available in main(), and hence is
not being passed to the Clear function when the clear icon is clicked. In other
words, I'm passing garbage data to Clear because the emailshare structure is
local to MainMenu.

I'm not entirely sure of how the flow of a GTK program actually works, but I am
under the impression that a running program just sits in gtk_main() and waits
for something to happen, when something happens it executes the appropriate
callback, and then returns to gtk_main() and waits again. If this flow is
accurate, then since the widgetshare structure in my little program is created
in main(), it is available to everything that's being called by gtk_main(),
which is why passing a pointer to that structure works but passing a pointer to
emailshare doesn't. Under this scenario the Clear function is being called from
main() and not from MainMenu.

Is my understanding of how this actually works correct? If so, what is the
recommended way to deal with structures like this? Set up everything in main()?
Use global structs? If I set up everything in main() then things could get
really complicated when dealing with nested containers.

-- 
MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com
www.creekfm.com - FIFTY THOUSAND WATTS of POW WOW POWER!



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