entry: Consider input hints for Emoji support

Don't show "insert emoji" in the context menu if input
hints indicate that Emoji input is not useful.
This commit is contained in:
Matthias Clasen 2017-09-02 08:42:52 -04:00
parent 774499e10e
commit 3694104f67

View File

@ -8501,14 +8501,18 @@ popup_targets_received (GtkClipboard *clipboard,
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
menuitem = gtk_menu_item_new_with_mnemonic (_("Insert _Emoji"));
gtk_widget_set_sensitive (menuitem,
mode == DISPLAY_NORMAL &&
info_entry_priv->editable);
g_signal_connect_swapped (menuitem, "activate",
G_CALLBACK (gtk_entry_choose_emoji), entry);
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
if (info_entry_priv->show_emoji_icon ||
(gtk_entry_get_input_hints (entry) & GTK_INPUT_HINT_NO_EMOJI) == 0)
{
menuitem = gtk_menu_item_new_with_mnemonic (_("Insert _Emoji"));
gtk_widget_set_sensitive (menuitem,
mode == DISPLAY_NORMAL &&
info_entry_priv->editable);
g_signal_connect_swapped (menuitem, "activate",
G_CALLBACK (gtk_entry_choose_emoji), entry);
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
}
g_signal_emit (entry, signals[POPULATE_POPUP], 0, menu);