Re: Correct widget to report results to the user
- From: Soeren Sandmann <sandmann daimi au dk>
- To: Roger Leigh <roger whinlatter uklinux net>
- Cc: gtk-list gnome org
- Subject: Re: Correct widget to report results to the user
- Date: 05 Jan 2003 02:16:35 +0100
Roger Leigh <roger whinlatter uklinux net> writes:
> Also, I was forced to use global variables due to needing to pass
> several widgets to the calculation function. Is there any way to
> avoid this cleanly (i.e. pass them somehow through the callback)?
The standard way to do this is to allocate a block of memory and pass
a pointer to that block though the "data" parameter.
typedef struct DataForCalculation DataForCalculation;
struct DataForCalculation {
...;
};
DataForCalculation *data = g_new (DataForCalculation, 1);
data->... = ...;
g_signal_connect (..., data);
and then free the block in the callback.
Søren
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]