On Mon, 2005-07-25 at 12:50 +0530, Annamalai Gurusami wrote: > Colossus <[EMAIL PROTECTED]> writes: > > > In my app I have the following: > > > > g_signal_connect ((gpointer) AddFile_button, "clicked", > > G_CALLBACK (on_add_files_activate), > > "dummy"); > > I normally write the above call like this: > > g_signal_connect( G_OBJECT(AddFile_button), "clicked", > G_CALLBACK(on_add_files_activate), "dummy"); > > Are both correct? Which is the preferred way to do it?
Unless you are programming in C++, either will work, since there is an automatic cast from any type to a void *, which is what the first argument of g_signal_connect() takes. In C++, you need the first. My preference is simply: g_signal_connect (AddFile_button, "clicked", G_CALLBACK (on_add_files_activate), "dummy"); The reason that g_signal_connect() takes a void * rather than a GObject * for the first parameter is that you could, in theory, have libgobject types not deriving from GObject that supports signals. In practice, I don't know of any uses of that. Regards, Owen
_______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list