[Glade-users] Newbie: Generated code differ with those in tutorial
- From: damon karuna uklinux net (Damon Chaplin)
- Subject: [Glade-users] Newbie: Generated code differ with those in tutorial
- Date: Fri, 04 Feb 2005 11:45:42 +0000
On Thu, 2005-02-03 at 21:31, Neo Anderson wrote:
Below is the code based on the tutorial on gtk.org:
gint main_window_delete_event(GtkWidget* widget, GdkEvent* event,
gpointer callback_data)
{
g_print("main_window_delete_event\n");
return false;
}
void main_window_destroy(GtkWidget* widget, gpointer callback_data)
{
g_print("main_window_destroy\n");
gtk_main_quit();
}
And here is the code generated by glade-2 (2.6.8):
gboolean
on_window1_delete_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
gtk_main_quit();
return FALSE;
}
gboolean
on_window1_destroy_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
return FALSE;
}
And the code to setup signal:
g_signal_connect(G_OBJECT(window), "destroy",
G_CALLBACK(main_window_destroy), NULL);
I am very confused. The destroy handlers are not the same in prototype.
What's the deal?
Does anyone know something like a FAQ on delete and destroy events? I
don't understand when and in what sequence are these two events are raised.
You are confusing the "destroy_event" and "destroy" signals.
"destroy_event" occurs when a GdkWindow is destroyed, but it isn't very
useful so forget about it. (I've never used it.)
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-destroy-event
"delete_event" occurs when the "x" close button on the top of the window
is clicked. Fairly simple.
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-delete-event
"destroy" is used to tell other objects to release any references they
hold to an object. Basically you assume that the object is about to be
destroyed/freed.
http://developer.gnome.org/doc/API/2.0/gtk/GtkObject.html#GtkObject-destroy
Damon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]