[gtk/emoji-chooser-fixes: 3/3] entry: Drop our own Emoji chooser



commit 44b0a893fcfe9da97849ff0544742751a903d963
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 4 18:51:27 2019 +0000

    entry: Drop our own Emoji chooser
    
    We were using one Emoji chooser when triggered
    via the context menu, and another one when
    triggered via the icon.
    
    Change things to always use the same Emoji
    chooser instance.

 gtk/gtkentry.c | 33 +++++----------------------------
 1 file changed, 5 insertions(+), 28 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 9015c1fb66..1193d3e8df 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -3448,41 +3448,18 @@ gtk_entry_enter_text (GtkEntry *entry,
 }
 
 static void
-gtk_entry_insert_emoji (GtkEntry *entry)
+pick_emoji (GtkEntry *entry,
+            int       icon,
+            GdkEvent *event,
+            gpointer  data)
 {
   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)
-    {
-      chooser = gtk_emoji_chooser_new ();
-      g_object_set_data (G_OBJECT (entry), "gtk-emoji-chooser", chooser);
-
-      gtk_popover_set_relative_to (GTK_POPOVER (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);
-        }
-      g_signal_connect_swapped (chooser, "emoji-picked", G_CALLBACK (gtk_entry_enter_text), entry);
-    }
-
-  gtk_popover_popup (GTK_POPOVER (chooser));
-}
-
-static void
-pick_emoji (GtkEntry *entry,
-            int       icon,
-            GdkEvent *event,
-            gpointer  data)
-{
   if (icon == GTK_ENTRY_ICON_SECONDARY)
-    gtk_entry_insert_emoji (entry);
+    g_signal_emit_by_name (priv->text, "insert-emoji");
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]