Re: strangeness of g_signal_connect
- From: "David Necas (Yeti)" <yeti physics muni cz>
- To: Colossus <colossus 3000 it>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: strangeness of g_signal_connect
- Date: Mon, 25 Jul 2005 09:27:29 +0200
On Mon, Jul 25, 2005 at 09:18:57AM -0700, Colossus wrote:
g_signal_connect ((gpointer) AddFile_button, "clicked",
G_CALLBACK (on_add_files_activate),
"dummy");
I have noticed that if the function "on_add_files_activate" is
declared with only one parameter, gpointer data , I never receive the
word dummy. Instead if the same function is declared with two parameters:
void on_add_files_activate ( GtkWidget *useless , gpointer data);
I can successfull print the value "dummy" pointed by data.
Could gtk developers explain this strange behaviour please ?
There's nothing strange about this behaviour.
The first argument of signal handlers is alwasy the object that
emitted the signal, user_data is the last. If you want
user_data as the first argument, use g_signal_connect_swapped().
Please read the Gtk+ tutorial.
The fact C functions may be called with more arguments than
declared (though it's still error in ANSI C if you do that
without typecast) is just a side-effect of C calling
convention.
Yeti
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]