Re: strangeness of g_signal_connect



Colossus <colossus 3000 it> writes:

Annamalai Gurusami wrote:

g_signal_connect( G_OBJECT(AddFile_button), "clicked",
                  G_CALLBACK(on_add_files_activate), "dummy");
The actual parameters of the callback function is determined by the
event and the widget handling the event.  Here you are handling the
"clicked" event for a GtkButton.  And for this event, the prototype of
the callback handler is

I just tried to replace gpointer with G_OBJECT but nothing to do, the
value dummy is never received by the function. I must use two
parameters and get rid of the first one to receive the value dummy.

You took two *separate* comments, joined it together, and now
complaining that my "suggestion" didn't work!!  Funny!  :-D

What I was suggesting is that

g_signal_connect( G_OBJECT(AddFile_button), "clicked",
                  G_CALLBACK(on_add_files_activate), "dummy");

is better than

g_signal_connect( (gpointer)AddFile_button, "clicked",
                  G_CALLBACK(on_add_files_activate), "dummy");

because G_OBJECT does some type checking.  This has nothing to do with
the semantics of callback functions.

Rgds,
anna

-- 

Open Movie: Not only will the project be realized with Open
Source/Free Software, but also the resulting movie will be published
under an open public license. This makes it an exciting premiere as
first ever "Open Movie" project!  [ http://orange.blender.org ]



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