emoji chooser: Don't use entry api on search entries

Use editable api, and cut through to the text widget
where necessary.
This commit is contained in:
Matthias Clasen 2019-02-20 10:32:12 -05:00
parent b303c20570
commit eb8b1095c8
2 changed files with 8 additions and 3 deletions

View File

@ -33,6 +33,8 @@
#include "gtkscrolledwindow.h"
#include "gtkintl.h"
#include "gtkprivate.h"
#include "gtksearchentryprivate.h"
#include "gtktext.h"
#define BOX_SPACE 6
@ -503,7 +505,7 @@ filter_func (GtkFlowBoxChild *child,
res = TRUE;
chooser = GTK_EMOJI_CHOOSER (gtk_widget_get_ancestor (GTK_WIDGET (child), GTK_TYPE_EMOJI_CHOOSER));
text = gtk_entry_get_text (GTK_ENTRY (chooser->search_entry));
text = gtk_editable_get_text (GTK_EDITABLE (chooser->search_entry));
emoji_data = (GVariant *) g_object_get_data (G_OBJECT (child), "emoji-data");
if (text[0] == 0)
@ -604,11 +606,15 @@ static void
gtk_emoji_chooser_init (GtkEmojiChooser *chooser)
{
GtkAdjustment *adj;
GtkText *text;
chooser->settings = g_settings_new ("org.gtk.Settings.EmojiChooser");
gtk_widget_init_template (GTK_WIDGET (chooser));
text = gtk_search_entry_get_text_widget (GTK_SEARCH_ENTRY (chooser->search_entry));
gtk_text_set_input_hints (text, GTK_INPUT_HINT_NO_EMOJI);
/* Get a reasonable maximum width for an emoji. We do this to
* skip overly wide fallback rendering for certain emojis the
* font does not contain and therefore end up being rendered
@ -662,7 +668,7 @@ gtk_emoji_chooser_show (GtkWidget *widget)
adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (chooser->scrolled_window));
gtk_adjustment_set_value (adj, 0);
gtk_entry_set_text (GTK_ENTRY (chooser->search_entry), "");
gtk_editable_set_text (GTK_EDITABLE (chooser->search_entry), "");
}
static void

View File

@ -8,7 +8,6 @@
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchEntry" id="search_entry">
<property name="input-hints">no-emoji</property>
<signal name="search-changed" handler="search_changed"/>
</object>
</child>