Commit e4be2240 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Rename the GTK_DESTROYED flag to GTK_IN_DESTRUCTION, remove the

Sun Nov 18 19:47:29 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkobject.h docs/Changes-2.0.txt: Rename the
	GTK_DESTROYED flag to GTK_IN_DESTRUCTION, remove the
	GTK_OBJECT_DESTROYED() check macro.

	* gtk/gtkbindings.c (gtk_bindings_activate): Remove
	instances of GTK_OBJECT_DESTROYED() that weren't
	needed any more.

	* gtk/gtkdialog.c: Exchange use of GTK_OBJECT_DESTROYED
	for a connection to ::destroy.
parent 3432dff2
Sun Nov 18 19:47:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h docs/Changes-2.0.txt: Rename the
GTK_DESTROYED flag to GTK_IN_DESTRUCTION, remove the
GTK_OBJECT_DESTROYED() check macro.
* gtk/gtkbindings.c (gtk_bindings_activate): Remove
instances of GTK_OBJECT_DESTROYED() that weren't
needed any more.
* gtk/gtkdialog.c: Exchange use of GTK_OBJECT_DESTROYED
for a connection to ::destroy.
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
......
Sun Nov 18 19:47:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h docs/Changes-2.0.txt: Rename the
GTK_DESTROYED flag to GTK_IN_DESTRUCTION, remove the
GTK_OBJECT_DESTROYED() check macro.
* gtk/gtkbindings.c (gtk_bindings_activate): Remove
instances of GTK_OBJECT_DESTROYED() that weren't
needed any more.
* gtk/gtkdialog.c: Exchange use of GTK_OBJECT_DESTROYED
for a connection to ::destroy.
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
......
Sun Nov 18 19:47:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h docs/Changes-2.0.txt: Rename the
GTK_DESTROYED flag to GTK_IN_DESTRUCTION, remove the
GTK_OBJECT_DESTROYED() check macro.
* gtk/gtkbindings.c (gtk_bindings_activate): Remove
instances of GTK_OBJECT_DESTROYED() that weren't
needed any more.
* gtk/gtkdialog.c: Exchange use of GTK_OBJECT_DESTROYED
for a connection to ::destroy.
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
......
Sun Nov 18 19:47:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h docs/Changes-2.0.txt: Rename the
GTK_DESTROYED flag to GTK_IN_DESTRUCTION, remove the
GTK_OBJECT_DESTROYED() check macro.
* gtk/gtkbindings.c (gtk_bindings_activate): Remove
instances of GTK_OBJECT_DESTROYED() that weren't
needed any more.
* gtk/gtkdialog.c: Exchange use of GTK_OBJECT_DESTROYED
for a connection to ::destroy.
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
......
Sun Nov 18 19:47:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h docs/Changes-2.0.txt: Rename the
GTK_DESTROYED flag to GTK_IN_DESTRUCTION, remove the
GTK_OBJECT_DESTROYED() check macro.
* gtk/gtkbindings.c (gtk_bindings_activate): Remove
instances of GTK_OBJECT_DESTROYED() that weren't
needed any more.
* gtk/gtkdialog.c: Exchange use of GTK_OBJECT_DESTROYED
for a connection to ::destroy.
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
......
Sun Nov 18 19:47:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h docs/Changes-2.0.txt: Rename the
GTK_DESTROYED flag to GTK_IN_DESTRUCTION, remove the
GTK_OBJECT_DESTROYED() check macro.
* gtk/gtkbindings.c (gtk_bindings_activate): Remove
instances of GTK_OBJECT_DESTROYED() that weren't
needed any more.
* gtk/gtkdialog.c: Exchange use of GTK_OBJECT_DESTROYED
for a connection to ::destroy.
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
......
Sun Nov 18 19:47:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkobject.h docs/Changes-2.0.txt: Rename the
GTK_DESTROYED flag to GTK_IN_DESTRUCTION, remove the
GTK_OBJECT_DESTROYED() check macro.
* gtk/gtkbindings.c (gtk_bindings_activate): Remove
instances of GTK_OBJECT_DESTROYED() that weren't
needed any more.
* gtk/gtkdialog.c: Exchange use of GTK_OBJECT_DESTROYED
for a connection to ::destroy.
Sun Nov 18 18:18:11 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfixed.c: Make a NO_WINDOW widget, as it should
......
......@@ -116,6 +116,12 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0:
have to be moved into the ::destroy implementations. The reason for doing
this is that all object reference cycles should be broken at destruction
time.
Because the ::destroy signal can be emitted multiple times, it no longer
makes sense to check if a widget has been destroyed using the
GTK_OBJECT_DESTROYED() macro, and this macro has been removed. If
catching destruction is still needed, it can be done with a signal
connection to ::destroy.
* Signal system changes:
The Gtk 2.0 signal merly proxies the GSignal system now.
......
......@@ -414,7 +414,7 @@ gtk_binding_entry_activate (GtkBindingEntry *entry,
gtk_signal_emitv (object, signal_id, params);
g_free (params);
if (GTK_OBJECT_DESTROYED (object) || entry->destroyed)
if (entry->destroyed)
break;
}
......@@ -504,15 +504,12 @@ gtk_binding_set_activate (GtkBindingSet *binding_set,
keyval = gdk_keyval_to_lower (keyval);
modifiers = modifiers & BINDING_MOD_MASK ();
if (!GTK_OBJECT_DESTROYED (object))
entry = binding_ht_lookup_entry (binding_set, keyval, modifiers);
if (entry)
{
entry = binding_ht_lookup_entry (binding_set, keyval, modifiers);
if (entry)
{
gtk_binding_entry_activate (entry, object);
return TRUE;
}
gtk_binding_entry_activate (entry, object);
return TRUE;
}
return FALSE;
......@@ -887,7 +884,7 @@ gtk_bindings_activate (GtkObject *object,
g_return_val_if_fail (object != NULL, FALSE);
g_return_val_if_fail (GTK_IS_OBJECT (object), FALSE);
if (!GTK_IS_WIDGET (object) || GTK_OBJECT_DESTROYED (object))
if (!GTK_IS_WIDGET (object))
return FALSE;
widget = GTK_WIDGET (object);
......
......@@ -770,6 +770,7 @@ typedef struct
GtkDialog *dialog;
gint response_id;
GMainLoop *loop;
gboolean destroyed;
} RunInfo;
static void
......@@ -813,6 +814,16 @@ run_delete_handler (GtkDialog *dialog,
return TRUE; /* Do not destroy */
}
static void
run_destroy_handler (GtkDialog *dialog, gpointer data)
{
RunInfo *ri = data;
/* shutdown_loop will be called by run_unmap_handler */
ri->destroyed = TRUE;
}
/**
* gtk_dialog_run:
* @dialog: a #GtkDialog
......@@ -861,6 +872,7 @@ gtk_dialog_run (GtkDialog *dialog)
RunInfo ri = { NULL, GTK_RESPONSE_NONE, NULL };
gboolean was_modal;
guint response_handler;
guint unmap_handler;
guint destroy_handler;
guint delete_handler;
......@@ -881,7 +893,7 @@ gtk_dialog_run (GtkDialog *dialog)
GTK_SIGNAL_FUNC (run_response_handler),
&ri);
destroy_handler =
unmap_handler =
gtk_signal_connect (GTK_OBJECT (dialog),
"unmap",
GTK_SIGNAL_FUNC (run_unmap_handler),
......@@ -893,6 +905,12 @@ gtk_dialog_run (GtkDialog *dialog)
GTK_SIGNAL_FUNC (run_delete_handler),
&ri);
destroy_handler =
gtk_signal_connect (GTK_OBJECT (dialog),
"destroy",
GTK_SIGNAL_FUNC (run_destroy_handler),
&ri);
ri.loop = g_main_new (FALSE);
GDK_THREADS_LEAVE ();
......@@ -902,22 +920,20 @@ gtk_dialog_run (GtkDialog *dialog)
g_main_loop_unref (ri.loop);
ri.loop = NULL;
ri.destroyed = FALSE;
if (!GTK_OBJECT_DESTROYED (dialog))
if (!ri.destroyed)
{
if (!was_modal)
gtk_window_set_modal (GTK_WINDOW(dialog), FALSE);
gtk_signal_disconnect (GTK_OBJECT (dialog), destroy_handler);
gtk_signal_disconnect (GTK_OBJECT (dialog), response_handler);
gtk_signal_disconnect (GTK_OBJECT (dialog), unmap_handler);
gtk_signal_disconnect (GTK_OBJECT (dialog), delete_handler);
gtk_signal_disconnect (GTK_OBJECT (dialog), destroy_handler);
}
gtk_object_unref (GTK_OBJECT (dialog));
return ri.response_id;
}
......@@ -354,8 +354,8 @@ gtk_object_destroy (GtkObject *object)
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
if (!GTK_OBJECT_DESTROYED (object))
g_object_run_dispose (G_OBJECT (object));
if (!(GTK_OBJECT_FLAGS (object) & GTK_IN_DESTRUCTION))
g_object_run_dispose (G_OBJECT (object));
}
static void
......@@ -366,13 +366,13 @@ gtk_object_dispose (GObject *gobject)
/* guard against reinvocations during
* destruction with the GTK_DESTROYED flag.
*/
if (!GTK_OBJECT_DESTROYED (object))
if (!(GTK_OBJECT_FLAGS (object) & GTK_IN_DESTRUCTION))
{
GTK_OBJECT_SET_FLAGS (object, GTK_DESTROYED);
GTK_OBJECT_SET_FLAGS (object, GTK_IN_DESTRUCTION);
gtk_signal_emit (object, object_signals[DESTROY]);
GTK_OBJECT_UNSET_FLAGS (object, GTK_DESTROYED);
GTK_OBJECT_UNSET_FLAGS (object, GTK_IN_DESTRUCTION);
}
G_OBJECT_CLASS (parent_class)->dispose (gobject);
......
......@@ -57,7 +57,7 @@ G_BEGIN_DECLS
*/
typedef enum
{
GTK_DESTROYED = 1 << 0,
GTK_IN_DESTRUCTION = 1 << 0, /* Used internally during dispose */
GTK_FLOATING = 1 << 1,
GTK_RESERVED_1 = 1 << 2,
GTK_RESERVED_2 = 1 << 3
......@@ -66,7 +66,6 @@ typedef enum
/* Macros for extracting the object_flags from GtkObject.
*/
#define GTK_OBJECT_FLAGS(obj) (GTK_OBJECT (obj)->flags)
#define GTK_OBJECT_DESTROYED(obj) ((GTK_OBJECT_FLAGS (obj) & GTK_DESTROYED) != 0)
#define GTK_OBJECT_FLOATING(obj) ((GTK_OBJECT_FLAGS (obj) & GTK_FLOATING) != 0)
#define GTK_OBJECT_CONNECTED(obj) ((GTK_OBJECT_FLAGS (obj) & GTK_CONNECTED) != 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment