[Glade-users] data in g_signal_connect

Hello again:
This is a follow-up of a previous thread I started in early Nov.
I appreciate the help I got from the list, but I am still having difficulty.
Someone suggested I use a different prototype, but I got the same (wrong)results:
   void slectActionBin (GtkWidget     *widget,
                        GdkEvenButton *event,
                        MY_DATA       *data)

The problem is the data is not being printed out in the callback routine.
You can see, at the bottom of this post, that there is
nothing in data and the address is diff :(

Can someone help get my data so it is visable/correct in the called cb
I think (maybe) I am not casting it properly or something, but when I
called the callback routine directly (commented out the g_connect_signal)
the data was correct....hmmmm

Here is the code that does not work:
struct MY_DATA {
   char bin[1000];
   char doc[1000];
struct MY_DATA mydata;

void selectActionBin(GtkWidget      *button,
                     struct MY_DATA *data)
  /* This is the code that does not work */
  printf("In call back, data = <%s>\n",data->bin);
  printf("In call back, data = <%s>\n",data->doc);
  printf("In call back, data is at %p\n", data);
  printf("In call back, &data is at %p\n", &data);
-- This is where I set up my callback/data 
extern struct MY_DATA mydata;
int doQuery(char *sqlStr)
  strcpy(mydata.bin,"Test data");
  strcpy(mydata.doc,"Test data");
  printf("Data is <%s> before callback\n",mydata.bin);
  printf("Data is <%s> before callback\n", mydata.doc);
  printf("Data is at %p before callback\n", mydata);
  printf(" &data is at %p before callback\n", &mydata);
  g_signal_connect(G_OBJECT (butWidget),
                   G_CALLBACK (selectActionBin),
output: (as you can see the callback is called but nothing is
         in the data and the address are diff) :(

Data is <Test data> before callback
Data is <Test data> before callback
Data is at 0x74736554 before callback
&data is at 0x80513a0 before callback

In call back, data = <>
In call back, data = <>
In call back, data is at 0x8a3e6e0
In call back, &data is at 0xbfffd944


Concerned about your privacy? Follow this link to get
FREE encrypted email: https://www.hushmail.com/?l=2

Free, ultra-private instant messaging with Hush Messenger

Promote security and make money with the Hushmail Affiliate Program: 

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