diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-06-26 22:13:12 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-06-26 22:13:12 -0400 |
commit | c20a966f06256b1e8b8cc7663151a0a9760a0265 (patch) | |
tree | 7ee7d0d86e716aedbc4e91ef4059de30701641d7 | |
parent | 64db05d3dd6adcb5b01389634185fb7dee7b621f (diff) | |
download | gtk+-c20a966f06256b1e8b8cc7663151a0a9760a0265.tar.gz |
text: Update action enabled state correctly
Take the editable property into account when updating
the emoji.insert action state, and update the action
when it changes.
Fixes: #2897
-rw-r--r-- | gtk/gtktext.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gtk/gtktext.c b/gtk/gtktext.c index ff6fde8e5b..1ba21144c1 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -2627,6 +2627,7 @@ gtk_text_do_popup (GtkText *self, GtkTextPrivate *priv = gtk_text_get_instance_private (self); gtk_text_update_clipboard_actions (self); + gtk_text_update_emoji_action (self); if (!priv->popup_menu) { @@ -5397,6 +5398,9 @@ gtk_text_set_editable (GtkText *self, gtk_event_controller_key_set_im_context (GTK_EVENT_CONTROLLER_KEY (priv->key_controller), is_editable ? priv->im_context : NULL); + gtk_text_update_clipboard_actions (self); + gtk_text_update_emoji_action (self); + g_object_notify (G_OBJECT (self), "editable"); } } @@ -5909,7 +5913,10 @@ gtk_text_update_clipboard_actions (GtkText *self) static void gtk_text_update_emoji_action (GtkText *self) { + GtkTextPrivate *priv = gtk_text_get_instance_private (self); + gtk_widget_action_set_enabled (GTK_WIDGET (self), "misc.insert-emoji", + priv->editable && (gtk_text_get_input_hints (self) & GTK_INPUT_HINT_NO_EMOJI) == 0); } |