diff options
author | Corey Berla <corey@berla.me> | 2022-07-19 10:08:08 -0700 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-07-20 13:52:55 +0000 |
commit | 295825bb7d380e74c20b03c50d0fc826140e50de (patch) | |
tree | 3bb4807b9852eb51aa14b2dad87f290bc4a63c92 /src/nautilus-location-entry.c | |
parent | 1c0d2d188ad31ee5591462807997cd5ad6b041a2 (diff) | |
download | nautilus-295825bb7d380e74c20b03c50d0fc826140e50de.tar.gz |
location-entry: Add helper for inserting prefix into completion
Inserting a prefix calls insert-text which we have a signal
attached to. Add helper nautilus_location_entry_insert_prefix()
to temporarily block the insert-text handler while we insert
the prefix.
Diffstat (limited to 'src/nautilus-location-entry.c')
-rw-r--r-- | src/nautilus-location-entry.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c index b3d7e3b7d..8b8481aa1 100644 --- a/src/nautilus-location-entry.c +++ b/src/nautilus-location-entry.c @@ -136,6 +136,20 @@ nautilus_location_entry_set_text (NautilusLocationEntry *entry, } static void +nautilus_location_entry_insert_prefix (NautilusLocationEntry *entry, + GtkEntryCompletion *completion) +{ + GtkEditable *delegate; + + delegate = gtk_editable_get_delegate (GTK_EDITABLE (entry)); + g_signal_handlers_block_by_func (delegate, G_CALLBACK (on_after_insert_text), entry); + + gtk_entry_completion_insert_prefix (completion); + + g_signal_handlers_unblock_by_func (delegate, G_CALLBACK (on_after_insert_text), entry); +} + +static void emit_location_changed (NautilusLocationEntry *entry) { GFile *location; @@ -566,7 +580,7 @@ update_completions_store (gpointer callback_data) if (priv->idle_insert_completion) { /* insert the completion */ - gtk_entry_completion_insert_prefix (priv->completion); + nautilus_location_entry_insert_prefix (entry, priv->completion); } return FALSE; |