typecasting -- GtkItemFactoryEntry->callback_action



I am using ItemFactory to build a menu system and it is working great, I
just have a question about the "proper" way to do something?

I wish for the activated menu item to call a function with a pointer
as a variable not a guint like the ItemFactory structure wants.  

void function(GtkWidget *widget, gpointer data);    NOT
void function(GtkWidget *widget, guint data);

The GtkItemFactoryEntry->callback_action is a guint so I have been
typecasting a gpointer to guint when initializing the GtkItemFactoryEntry
and then typecasting back to gpointer in the callback function.  This is
working because (void *) and guint are the same size. I can't help but
think there is a better [and less likly to break :-] way to do this. 

Does anyone have any suggestions?  I am not subscribed to the list so
please respond to this e-mail address.

Thanks in advance,
Russell Francis 





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]