Re: using keys and storing data with a GObject
- From: Tristan Van Berkom <vantr touchtunes com>
- To: marisa dinf ne jp
- Cc: gtk-app-devel-list gnome org
- Subject: Re: using keys and storing data with a GObject
- Date: Tue, 06 Apr 2004 15:27:58 -0400
Marisa DeMeglio wrote:
[snip]
Right now I'm just testing with simple string data,
but if anyone has any examples of how to store a
collection of data with a widget (like a struct), I
would love to see it.
Ummm, you mean like this:
=======================================================
typedef _mystruct mystruct;
/* ... */
{
mystruct *mine = g_new(mystruct, 1);
/* init my struct */
/* ... */
/* Set my struct */
g_object_set_data(G_OBJECT(widget), "that struct", mine);
}
/* ... */
{
mystruct *mine;
/* Do I have "that struct" on this widget ? */
if ((mine = g_object_get_data(G_OBJECT(widget), "that struct")) != NULL) {
/* Use my struct */
}
}
=======================================================
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]