[nautilus] location-entry: Simplify contrived special text code



commit 3d1c13915e73dde84ecc4ac44169a573d7ac8be8
Author: António Fernandes <antoniof gnome org>
Date:   Wed Jul 20 16:03:18 2022 +0200

    location-entry: Simplify contrived special text code
    
    It's overly complicated for no reason. Also add a comment to explain
    what's the point of it all.

 src/nautilus-location-entry.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)
---
diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c
index aca4c6e1b..fa516afe7 100644
--- a/src/nautilus-location-entry.c
+++ b/src/nautilus-location-entry.c
@@ -56,8 +56,6 @@ typedef struct _NautilusLocationEntryPrivate
     GFile *last_location;
 
     gboolean has_special_text;
-    gboolean setting_special_text;
-    gchar *special_text;
     NautilusLocationEntryAction secondary_action;
 
     GtkEventController *controller;
@@ -464,11 +462,10 @@ on_has_focus_changed (GObject    *object,
     entry = NAUTILUS_LOCATION_ENTRY (object);
     priv = nautilus_location_entry_get_instance_private (entry);
 
+    /* The entry has text which is not worth preserving on focus-in. */
     if (priv->has_special_text)
     {
-        priv->setting_special_text = TRUE;
         nautilus_location_entry_set_text (entry, "");
-        priv->setting_special_text = FALSE;
     }
 }
 
@@ -480,11 +477,6 @@ nautilus_location_entry_text_changed (NautilusLocationEntry *entry,
 
     priv = nautilus_location_entry_get_instance_private (entry);
 
-    if (priv->setting_special_text)
-    {
-        return;
-    }
-
     priv->has_special_text = FALSE;
 }
 
@@ -849,12 +841,6 @@ nautilus_location_entry_set_special_text (NautilusLocationEntry *entry,
 
     priv = nautilus_location_entry_get_instance_private (entry);
 
-    priv->has_special_text = TRUE;
-
-    g_free (priv->special_text);
-    priv->special_text = g_strdup (special_text);
-
-    priv->setting_special_text = TRUE;
     nautilus_location_entry_set_text (entry, special_text);
-    priv->setting_special_text = FALSE;
+    priv->has_special_text = TRUE;
 }


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