[nautilus] location-entry: Add helper for inserting prefix into completion
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] location-entry: Add helper for inserting prefix into completion
- Date: Wed, 20 Jul 2022 14:11:00 +0000 (UTC)
commit 295825bb7d380e74c20b03c50d0fc826140e50de
Author: Corey Berla <corey berla me>
Date: Tue Jul 19 10:08:08 2022 -0700
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.
src/nautilus-location-entry.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
---
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
@@ -135,6 +135,20 @@ nautilus_location_entry_set_text (NautilusLocationEntry *entry,
g_signal_handlers_unblock_by_func (delegate, G_CALLBACK (on_after_delete_text), 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)
{
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]