[nautilus/wip/corey/query-editor: 2/3] query-editor: Stop blocking expected "changed" emmission




commit 5e5e5598d997ca5d7a33e8473e0dc95c8f513f88
Author: Corey Berla <corey berla me>
Date:   Fri Sep 30 09:13:04 2022 -0700

    query-editor: Stop blocking expected "changed" emmission
    
    In nautilus_query_editor_set_query(), the change_frozen flag is set
    which makes the entry_changed_cb() return early.  This causes text to be
    shown in the query editor without the search actually occuring.
    This flag has been around "forever" and probably originally had a
    purpose, but now, it seems to just be preventing expected behavior.
    
    This issue wasn't present in 42 because we were using GtkSearchEntry,
    which has the ::search-changed signal.  The ::search-changed signal
    (unlike the ::changed signal for an editable) has a 150ms delay which
    would have bypassed the change_frozen flag.
    
    Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2518

 src/nautilus-query-editor.c | 15 ---------------
 1 file changed, 15 deletions(-)
---
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index 7ea3919a1..f93b05e87 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -50,7 +50,6 @@ struct _NautilusQueryEditor
     GtkWidget *date_range_tag;
 
     guint search_changed_timeout_id;
-    gboolean change_frozen;
 
     GFile *location;
 
@@ -403,11 +402,6 @@ static void
 entry_changed_cb (GtkWidget           *entry,
                   NautilusQueryEditor *editor)
 {
-    if (editor->change_frozen)
-    {
-        return;
-    }
-
     g_clear_handle_id (&editor->search_changed_timeout_id, g_source_remove);
     editor->search_changed_timeout_id = g_timeout_add (SEARCH_CHANGED_TIMEOUT,
                                                        G_SOURCE_FUNC (entry_changed_internal),
@@ -673,11 +667,6 @@ nautilus_query_editor_init (NautilusQueryEditor *editor)
 static void
 nautilus_query_editor_changed (NautilusQueryEditor *editor)
 {
-    if (editor->change_frozen)
-    {
-        return;
-    }
-
     g_signal_emit (editor, signals[CHANGED], 0, editor->query, TRUE);
 }
 
@@ -762,8 +751,6 @@ nautilus_query_editor_set_query (NautilusQueryEditor *self,
         text = g_strdup ("");
     }
 
-    self->change_frozen = TRUE;
-
     current_text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (self->text)));
     current_text = g_strstrip (current_text);
     if (!g_str_equal (current_text, text))
@@ -775,8 +762,6 @@ nautilus_query_editor_set_query (NautilusQueryEditor *self,
     {
         g_object_notify (G_OBJECT (self), "query");
     }
-
-    self->change_frozen = FALSE;
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]