Re: The widget that called
- From: Jan-Marek Glogowski <glogow fbihome de>
- To: Ruben Safir Secretary NYLXS <ruben mrbrklyn com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: The widget that called
- Date: Thu, 9 Sep 2004 00:38:20 +0200 (CEST)
If you dont' want to use global vars to check for the widget pointer you
can use the following method.
Every callback can pass data. If you don't already use the data field
simply use GINT_TO_POINTER and GPOINTER_TO_INT e.g.:
funtion void my_callback( GtkWidget *w, gpointer data )
{
switch( GPOINTER_TO_INT( data ) ) {
...
}
}
// 1. Widget
g_signal_connect(w, "callback", G_CALLBBACK( my_callback ),
GINT_TO_POINTER( 1 ) );
// 2. Widget
g_signal_connect(w, "callback", G_CALLBBACK( my_callback ),
GINT_TO_POINTER( 2 ) );
An other alternative is g_object_set_data / g_object_get_data - used just
like the above example
HTH
Jan-Marek
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]