Make the reference to the mnemonic widget weak. (#93334, Murray Cumming)

Mon Sep 30 15:45:49 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtklabel.c (gtk_label_set_mnemonic_widget):
        Make the reference to the mnemonic widget weak.
        (#93334, Murray Cumming)
This commit is contained in:
Owen Taylor 2002-09-30 20:02:00 +00:00 committed by Owen Taylor
parent ee6acce769
commit d1d235adcb
7 changed files with 51 additions and 2 deletions

View File

@ -1,3 +1,9 @@
Mon Sep 30 15:45:49 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c (gtk_label_set_mnemonic_widget):
Make the reference to the mnemonic widget weak.
(#93334, Murray Cumming)
Mon Sep 30 15:38:53 2002 Owen Taylor <otaylor@redhat.com> Mon Sep 30 15:38:53 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h: Remove a duplicate definition * gdk/gdkwindow.h: Remove a duplicate definition

View File

@ -1,3 +1,9 @@
Mon Sep 30 15:45:49 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c (gtk_label_set_mnemonic_widget):
Make the reference to the mnemonic widget weak.
(#93334, Murray Cumming)
Mon Sep 30 15:38:53 2002 Owen Taylor <otaylor@redhat.com> Mon Sep 30 15:38:53 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h: Remove a duplicate definition * gdk/gdkwindow.h: Remove a duplicate definition

View File

@ -1,3 +1,9 @@
Mon Sep 30 15:45:49 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c (gtk_label_set_mnemonic_widget):
Make the reference to the mnemonic widget weak.
(#93334, Murray Cumming)
Mon Sep 30 15:38:53 2002 Owen Taylor <otaylor@redhat.com> Mon Sep 30 15:38:53 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h: Remove a duplicate definition * gdk/gdkwindow.h: Remove a duplicate definition

View File

@ -1,3 +1,9 @@
Mon Sep 30 15:45:49 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c (gtk_label_set_mnemonic_widget):
Make the reference to the mnemonic widget weak.
(#93334, Murray Cumming)
Mon Sep 30 15:38:53 2002 Owen Taylor <otaylor@redhat.com> Mon Sep 30 15:38:53 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h: Remove a duplicate definition * gdk/gdkwindow.h: Remove a duplicate definition

View File

@ -1,3 +1,9 @@
Mon Sep 30 15:45:49 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c (gtk_label_set_mnemonic_widget):
Make the reference to the mnemonic widget weak.
(#93334, Murray Cumming)
Mon Sep 30 15:38:53 2002 Owen Taylor <otaylor@redhat.com> Mon Sep 30 15:38:53 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h: Remove a duplicate definition * gdk/gdkwindow.h: Remove a duplicate definition

View File

@ -1,3 +1,9 @@
Mon Sep 30 15:45:49 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c (gtk_label_set_mnemonic_widget):
Make the reference to the mnemonic widget weak.
(#93334, Murray Cumming)
Mon Sep 30 15:38:53 2002 Owen Taylor <otaylor@redhat.com> Mon Sep 30 15:38:53 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.h: Remove a duplicate definition * gdk/gdkwindow.h: Remove a duplicate definition

View File

@ -718,6 +718,15 @@ gtk_label_hierarchy_changed (GtkWidget *widget,
gtk_label_setup_mnemonic (label, label->mnemonic_keyval); gtk_label_setup_mnemonic (label, label->mnemonic_keyval);
} }
static void
label_mnemonic_widget_weak_notify (gpointer data,
GObject *where_the_object_was)
{
GtkLabel *label = data;
label->mnemonic_widget = NULL;
g_object_notify (G_OBJECT (label), "mnemonic_widget");
}
/** /**
* gtk_label_set_mnemonic_widget: * gtk_label_set_mnemonic_widget:
@ -747,10 +756,14 @@ gtk_label_set_mnemonic_widget (GtkLabel *label,
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
if (label->mnemonic_widget) if (label->mnemonic_widget)
gtk_widget_unref (label->mnemonic_widget); g_object_weak_unref (label->mnemonic_widget,
label_mnemonic_widget_weak_notify,
label);
label->mnemonic_widget = widget; label->mnemonic_widget = widget;
if (label->mnemonic_widget) if (label->mnemonic_widget)
gtk_widget_ref (label->mnemonic_widget); g_object_weak_ref (label->mnemonic_widget,
label_mnemonic_widget_weak_notify,
label);
g_object_notify (G_OBJECT (label), "mnemonic_widget"); g_object_notify (G_OBJECT (label), "mnemonic_widget");
} }