Re: gtk custom widgets
- From: Paul Pogonyshev <pogonyshev gmx net>
- To: gtk-app-devel-list gnome org
- Subject: Re: gtk custom widgets
- Date: Thu, 21 Oct 2004 13:28:31 +0300
Daniel Piccoli wrote:
If I don't create a
composite widget, this struct data will be lost once the signal handler
function which creates it completes.
Does this sound reasonable?
You can simply do
extra_data = g_malloc (sizeof (DataStructure));
extra_data->... = ...;
...
g_signal_connect (widget, "some-signal",
G_CALLBACK (some_callback), extra_data);
g_signal_connect_swapped (widget, "destrory",
G_CALLBACK (g_free), extra_data);
If you data is statically scoped, you don't even need to hook up the
g_free() call. I typically go onto subclassing when the required
functionality is complicated enough to justify breaking it out into
a separate file.
Paul
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]