[gtk/wip/matthiasc/popup4: 26/57] entry: Adapt to new popover lifecycle
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/popup4: 26/57] entry: Adapt to new popover lifecycle
- Date: Fri, 19 Apr 2019 19:20:22 +0000 (UTC)
commit a91014a336df9b6056e2a6d8178af24cb6850745
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Mar 21 22:12:22 2019 -0400
entry: Adapt to new popover lifecycle
We need to unparent popovers in dispose.
gtk/gtkentry.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index eb48816b39..9ba71932fd 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -159,6 +159,7 @@ struct _GtkEntryPrivate
GtkWidget *text;
GtkWidget *progress_widget;
+ GtkWidget *emoji_chooser;
guint show_emoji_icon : 1;
guint editing_canceled : 1; /* Only used by GtkCellRendererText */
@@ -1289,6 +1290,8 @@ gtk_entry_dispose (GObject *object)
}
g_clear_pointer (&priv->text, gtk_widget_unparent);
+ g_clear_pointer (&priv->emoji_chooser, gtk_widget_unparent);
+
gtk_entry_set_icon_from_paintable (entry, GTK_ENTRY_ICON_PRIMARY, NULL);
gtk_entry_set_icon_tooltip_markup (entry, GTK_ENTRY_ICON_PRIMARY, NULL);
gtk_entry_set_icon_from_paintable (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
@@ -3449,28 +3452,27 @@ static void
gtk_entry_insert_emoji (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
- GtkWidget *chooser;
- GdkRectangle rect;
if (gtk_widget_get_ancestor (GTK_WIDGET (entry), GTK_TYPE_EMOJI_CHOOSER) != NULL)
return;
- chooser = GTK_WIDGET (g_object_get_data (G_OBJECT (entry), "gtk-emoji-chooser"));
- if (!chooser)
+ if (!priv->emoji_chooser)
{
- chooser = gtk_emoji_chooser_new ();
- g_object_set_data (G_OBJECT (entry), "gtk-emoji-chooser", chooser);
+ GdkRectangle rect;
+
+ priv->emoji_chooser = gtk_emoji_chooser_new ();
- gtk_popover_set_relative_to (GTK_POPOVER (chooser), GTK_WIDGET (entry));
+ gtk_popover_set_relative_to (GTK_POPOVER (priv->emoji_chooser), GTK_WIDGET (entry));
if (priv->show_emoji_icon)
{
gtk_entry_get_icon_area (entry, GTK_ENTRY_ICON_SECONDARY, &rect);
- gtk_popover_set_pointing_to (GTK_POPOVER (chooser), &rect);
+ gtk_popover_set_pointing_to (GTK_POPOVER (priv->emoji_chooser), &rect);
}
- g_signal_connect_swapped (chooser, "emoji-picked", G_CALLBACK (gtk_entry_enter_text), entry);
+ g_signal_connect_swapped (priv->emoji_chooser, "emoji-picked",
+ G_CALLBACK (gtk_entry_enter_text), entry);
}
- gtk_popover_popup (GTK_POPOVER (chooser));
+ gtk_popover_popup (GTK_POPOVER (priv->emoji_chooser));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]