summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-04-16 23:29:04 -0400
committerMatthias Clasen <mclasen@redhat.com>2022-04-16 23:29:04 -0400
commit4540dac11af4568287450125f3cd46b22496d743 (patch)
tree1836ae7898da0806671132d5888b7f1c37d1e7b8
parentda5bb6ff22f9a03fcb4c033624f0a9b4fb0eb8b1 (diff)
downloadgtk+-4540dac11af4568287450125f3cd46b22496d743.tar.gz
filechooser: Prevent random completion popups
It is very irritating when the entry completion popup appears not in response to user input in the entry. In particular, when that happens right as the dialog is shown. To prevent that, temporarily disable completion when setting the entry text programmatically.
-rw-r--r--gtk/gtkfilechooserwidget.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index a2310f35d8..f08e5ad6ea 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -4748,9 +4748,15 @@ update_chooser_entry (GtkFileChooserWidget *impl)
if (change_entry && !impl->auto_selecting_first_row)
{
+ GtkEntryCompletion *completion = gtk_entry_get_completion (GTK_ENTRY (impl->location_entry));
+
+ if (completion)
+ gtk_entry_completion_set_popup_completion (completion, FALSE);
g_signal_handlers_block_by_func (impl->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
gtk_editable_set_text (GTK_EDITABLE (impl->location_entry), impl->browse_files_last_selected_name);
g_signal_handlers_unblock_by_func (impl->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
+ if (completion)
+ gtk_entry_completion_set_popup_completion (completion, TRUE);
if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
_gtk_file_chooser_entry_select_filename (GTK_FILE_CHOOSER_ENTRY (impl->location_entry));