[gnumeric] GUI: Make sure gtkbuilder-built dialogs get finalized.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Make sure gtkbuilder-built dialogs get finalized.
- Date: Tue, 19 Oct 2010 13:38:27 +0000 (UTC)
commit 3df444ffae4d5df8fafddee71fc93c3cfd550864
Author: Morten Welinder <terra gnome org>
Date: Tue Oct 19 09:37:49 2010 -0400
GUI: Make sure gtkbuilder-built dialogs get finalized.
ChangeLog | 6 ++++++
src/gui-util.c | 15 ++++++++++++++-
2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 681fb88..35f6d3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-10-19 Morten Welinder <terra gnome org>
+
+ * src/gui-util.c (gnumeric_keyed_dialog): When dialog is
+ destroyed, clear "state" to trigger the tear-down even if someone
+ (i.e., gtkbuilder) holds a ref.
+
2010-10-18 Morten Welinder <terra gnome org>
* src/gui-util.c (gnumeric_glade_group_value): Make this work for
diff --git a/src/gui-util.c b/src/gui-util.c
index c0b166c..c5348ad 100644
--- a/src/gui-util.c
+++ b/src/gui-util.c
@@ -200,12 +200,23 @@ cb_free_keyed_dialog_context (KeyedDialogContext *ctxt)
g_free (ctxt);
}
+static void
+cb_keyed_dialog_destroy (GtkDialog *dialog)
+{
+ /*
+ * gtk-builder likes to hold refs on objects. That interferes
+ * with the way we handle finalization of dialogs' state.
+ * Trigger this now.
+ */
+ g_object_set_data (G_OBJECT (dialog), "state", NULL);
+}
+
static gint
cb_keyed_dialog_keypress (GtkWidget *dialog, GdkEventKey *event,
G_GNUC_UNUSED gpointer user)
{
if (event->keyval == GDK_Escape) {
- gtk_object_destroy (GTK_OBJECT (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
return TRUE;
}
return FALSE;
@@ -305,6 +316,8 @@ gnumeric_keyed_dialog (WBCGtk *wbcg, GtkWindow *dialog, char const *key)
(GDestroyNotify)cb_free_keyed_dialog_context);
g_signal_connect (G_OBJECT (dialog), "key_press_event",
G_CALLBACK (cb_keyed_dialog_keypress), NULL);
+ g_signal_connect (G_OBJECT (dialog), "destroy",
+ G_CALLBACK (cb_keyed_dialog_destroy), NULL);
gnumeric_restore_window_geometry (dialog, key);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]