Passing data to menu callback
- From: halfline <halfline hawaii rr com>
- To: gnome-devel-list gnome org
- Subject: Passing data to menu callback
- Date: Sat, 31 Jul 1999 19:11:57 -1000
I'm trying to pass an integer through the user data field of the
GNOMEUIINFO_ITEM_DATA
macro. I pass it by casting it (gpointer) &var, but when i try to re case it
back as integer it
gives me some junk number.. y?
Here are the functions that pertain to it
GtkWidget* licq_plugin_mode_status_menu_create( )
{
licq_plugin_mode_status_menu_callback( (gpointer) &ICQ_STATUS_ONLINE );
/* Borrowed from menu.cpp */
GnomeUIInfo StatusMenu[] = {
GNOMEUIINFO_ITEM_DATA( "_Online", "Online Status",
licq_plugin_mode_status_menu_callback,
( gpointer) &ICQ_STATUS_ONLINE,
NULL ),
GNOMEUIINFO_ITEM_DATA( "_Away", "Away Status",
licq_plugin_mode_status_menu_callback,
( gpointer ) &ICQ_STATUS_AWAY,
NULL ),
GNOMEUIINFO_ITEM_DATA( "_Not Available", "Not Available Status",
licq_plugin_mode_status_menu_callback,
( gpointer ) &ICQ_STATUS_NA,
NULL ),
GNOMEUIINFO_ITEM_DATA( "O_ccupied", "Occupied Status",
licq_plugin_mode_status_menu_callback,
( gpointer )&ICQ_STATUS_OCCUPIED,
NULL ),
GNOMEUIINFO_ITEM_DATA( "_Do Not Disturb", "Do Not Disturb Status",
licq_plugin_mode_status_menu_callback,
( gpointer ) &ICQ_STATUS_DND,
NULL ),
GNOMEUIINFO_ITEM_DATA( "Free for C_hat", "Free For Chat Status",
licq_plugin_mode_status_menu_callback,
( gpointer )&ICQ_STATUS_FREEFORCHAT,
NULL ),
GNOMEUIINFO_ITEM_DATA( "O_ffline", "Offline Status",
licq_plugin_mode_status_menu_callback,
( gpointer )&ICQ_STATUS_OFFLINE,
NULL ),
/*GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_TOGGLEITEM( "_Invisible", "Invisible Status",
licq_plugin_mode_status_menu_callback,
,
NULL ),*/
GNOMEUIINFO_END
};
return gnome_popup_menu_new( StatusMenu );
}
void licq_plugin_mode_status_menu_callback( gpointer user_data )
{
unsigned short int* NewStatus = ( short unsigned int* ) user_data;
licq_plugin_mode_status_set( *NewStatus );
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]