[maemo-users] problem on gsinal

From: Dave Neary dneary at maemo.org
Date: Wed Jul 16 12:58:32 EEST 2008
Hi,

Zhenghe Zhang wrote:
> I am sorry to obtrude you, but i have been graveled for long time, can
> you give me some advises.
> 
> Text Box: button = gtk_dialog_add_button(GTK_DIALOG(dialog), "More",
> GTK_RESPONSE_ACCEPT); g_signal_connect(G_OBJECT(button),
> "clicked",G_CALLBACK(callback_file_more_button),button);

I thought a little more, here's my suggestion.

const gint RESPONSE_MORE = 1;

button = gtk_dialog_add_button(GTK_DIALOG(dialog), "More", RESPONSE_MORE);

g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(callback_file_more_button), button);

Or...

g_signal_connect(G_OBJECT(button), "response",
G_CALLBACK(callback_file_more_button), button);

and in callback_file_more_button, check that response_id is 1.

That way, your callback *is* the default handler.

Cheers,
Dave.
-- 
maemo.org docsmaster
Email: dneary at maemo.org
Jabber: bolsh at jabber.org


More information about the maemo-users mailing list