summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-11-19 01:08:51 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-11-19 01:08:51 +0000
commite4be2240b7a9709919c6e417a8b31b28014e3233 (patch)
tree3ddb33f39e79a893ac5ba6f62cb921605964b81f /gtk
parent3432dff2e0c21fa693d41e3950ee19624c03f58c (diff)
downloadgtk+-e4be2240b7a9709919c6e417a8b31b28014e3233.tar.gz
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.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkbindings.c17
-rw-r--r--gtk/gtkdialog.c30
-rw-r--r--gtk/gtkobject.c10
-rw-r--r--gtk/gtkobject.h3
4 files changed, 36 insertions, 24 deletions
diff --git a/gtk/gtkbindings.c b/gtk/gtkbindings.c
index 902410e119..30cb56d28e 100644
--- a/gtk/gtkbindings.c
+++ b/gtk/gtkbindings.c
@@ -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);
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
index b914211f3a..3e32c44431 100644
--- a/gtk/gtkdialog.c
+++ b/gtk/gtkdialog.c
@@ -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;
}
-
-
-
-
diff --git a/gtk/gtkobject.c b/gtk/gtkobject.c
index 483a00e95c..0c47368369 100644
--- a/gtk/gtkobject.c
+++ b/gtk/gtkobject.c
@@ -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);
diff --git a/gtk/gtkobject.h b/gtk/gtkobject.h
index 9f1ce10180..f025a4d41d 100644
--- a/gtk/gtkobject.h
+++ b/gtk/gtkobject.h
@@ -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)