Re: what's the best way to handle variables and objects?
- From: Tristan Van Berkom <tristan van berkom gmail com>
- To: Andreas Kotowicz <kotoml mynetix de>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: what's the best way to handle variables and objects?
- Date: Wed, 15 Mar 2006 18:50:38 -0500
Andreas Kotowicz wrote:
Hi Tristan,
[...]
do you know maybe a relatively simple gnome app which uses this concept,
so I could have a look at the source code and see how all the
interaction works?
Well, how about I just type away from memory... after writing that
I notice that its probably not something one would do... but it should
give you some good ideas ;-)
Cheers,
-Tristan
typedef struct {
GtkWidget *prog;
gint a;
gchar *str;
} MyStruct;
/*
.
.
.
*/
static void
my_destroy (MyStruct *my)
{
if (my->str) g_free (my->str);
g_free (my);
}
/*
.
.
.
*/
MyStruct * my = g_new0 (MyStruct, 1);
<http://developer.gnome.org/doc/API/2.0/glib/glib-Datasets.html#GDestroyNotify>g_signal_connect_data
(G_OBJECT(adj), "value-changed",
G_CALLBACK (progress_callback), my,
(GDestroyNotify)my_destroy, 0);
/*
.
.
.
*/
static void
progress_callback (GtkWidget *button, MyStruct *my)
{
/* do something rediculous like set the progress bar percentage
* to match the adjustment.
*/
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]