Re: Destroy signal not working on GtkMenuItem?
- From: Henri Torgemane <henrit yahoo-inc com>
- To: learfox furry ao net
- Cc: Manuel Menal <mmenal ifrance com>, GTK Application Development List <gtk-app-devel-list gnome org>
- Subject: Re: Destroy signal not working on GtkMenuItem?
- Date: Fri, 10 Nov 2000 15:45:37 -0800
I believe gtk_signal_connect() sends arguments to the signal function in the
(GtkWidget* widget, gpointer data) order, while gtk_signal_connect_object() sends
them in the (gpointer data, GtkWidget* widget) order, which allows to plug directly
into some functions without having to write a middle-man function that only
re-arrange the order.
Since the handler gets cast, if you use the wrong function prototype, you don't get
any advance warning until it crashes.
Henri
learfox furry ao net wrote:
lfan> I tried to use the "destroy" signal handling in the same situation for a
lfan> GtkMenuItem, however it segfaults and gdb seems to show the inputs are no
lfan> the same to the signal handler function.
That's a strange behaviour. Here is an example which shows that
the "destroy" signal is sent to the GtkMenuItem when you
gtk_widget_destroy it:
# include <gtk/gtk.h>
void warn (GtkWidget *);
int
main (int argc, char **argv)
{
GtkWidget *win, *menubar, *file;
gtk_init (&argc, &argv);
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
menubar = gtk_menu_bar_new ();
file = gtk_menu_item_new_with_label ("File");
gtk_signal_connect (GTK_OBJECT (file),
"destroy",
GTK_SIGNAL_FUNC (warn),
NULL);
gtk_signal_connect_object (GTK_OBJECT (win),
"delete_event",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (file));
Here's something interesting, what's the difference between
gtk_signal_connect() and gtk_signal_connect_object()? Which one should I
use under what circumstances?
I think the problem is that I was using gtk_signal_connect_object()
for the "destroy" event.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]