[gnome-initial-setup/gbsneto/timezone-regressions: 2/4] timezone: Remove custom text handling




commit 962aa6cba6d7328cad451392ca5d7f0375d177f4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Aug 15 10:49:47 2022 -0300

    timezone: Remove custom text handling
    
    Initial Setup does not use this field for anything, and it just
    complicates the code. Remove it.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-initial-setup/-/merge_requests/157>

 .../pages/timezone/gis-location-entry.c            | 28 +---------------------
 .../pages/timezone/gis-location-entry.h            |  1 -
 2 files changed, 1 insertion(+), 28 deletions(-)
---
diff --git a/gnome-initial-setup/pages/timezone/gis-location-entry.c 
b/gnome-initial-setup/pages/timezone/gis-location-entry.c
index 46b889aa..7aec073f 100644
--- a/gnome-initial-setup/pages/timezone/gis-location-entry.c
+++ b/gnome-initial-setup/pages/timezone/gis-location-entry.c
@@ -26,7 +26,6 @@ struct _GisLocationEntryPrivate {
     GWeatherLocation *location;
     GWeatherLocation *top;
     gboolean          show_named_timezones;
-    gboolean          custom_text;
     GCancellable     *cancellable;
     GtkTreeModel     *model;
 };
@@ -134,7 +133,6 @@ gis_location_entry_init (GisLocationEntry *entry)
     gtk_entry_set_completion (GTK_ENTRY (entry->priv->entry), completion);
     g_object_unref (completion);
 
-    priv->custom_text = FALSE;
     g_signal_connect (entry, "changed",
                       G_CALLBACK (entry_changed), NULL);
 }
@@ -327,9 +325,7 @@ entry_changed (GisLocationEntry *entry)
 
     text = gtk_editable_get_text (GTK_EDITABLE (entry));
 
-    if (text && *text)
-        entry->priv->custom_text = TRUE;
-    else
+    if (!text || *text == '\0')
         set_location_internal (entry, NULL, NULL, NULL);
 }
 
@@ -364,16 +360,13 @@ set_location_internal (GisLocationEntry *entry,
                             LOC_GIS_LOCATION_ENTRY_COL_LOCATION, &priv->location,
                             -1);
         set_entry_text (entry, name);
-        priv->custom_text = FALSE;
         g_free (name);
     } else if (loc) {
         priv->location = g_object_ref (loc);
         set_entry_text (entry, gweather_location_get_name (loc));
-        priv->custom_text = FALSE;
     } else {
         priv->location = NULL;
         set_entry_text (entry, "");
-        priv->custom_text = TRUE;
     }
 
     gtk_editable_set_position (GTK_EDITABLE (entry), -1);
@@ -448,25 +441,6 @@ gis_location_entry_get_location (GisLocationEntry *entry)
         return NULL;
 }
 
-/**
- * gis_location_entry_has_custom_text:
- * @entry: a #GisLocationEntry
- *
- * Checks whether or not @entry's text has been modified by the user.
- * Note that this does not mean that no location is associated with @entry.
- * gis_location_entry_get_location() should be used for this.
- *
- * Return value: %TRUE if @entry's text was modified by the user, or %FALSE if
- * it's set to the default text of a location.
- **/
-gboolean
-gis_location_entry_has_custom_text (GisLocationEntry *entry)
-{
-    g_return_val_if_fail (GIS_IS_LOCATION_ENTRY (entry), FALSE);
-
-    return entry->priv->custom_text;
-}
-
 /**
  * gis_location_entry_set_city:
  * @entry: a #GisLocationEntry
diff --git a/gnome-initial-setup/pages/timezone/gis-location-entry.h 
b/gnome-initial-setup/pages/timezone/gis-location-entry.h
index 98a76127..ebd114fe 100644
--- a/gnome-initial-setup/pages/timezone/gis-location-entry.h
+++ b/gnome-initial-setup/pages/timezone/gis-location-entry.h
@@ -39,7 +39,6 @@ GtkWidget *             gis_location_entry_new             (GWeatherLocation *to
 void                    gis_location_entry_set_location    (GisLocationEntry *entry,
                                                             GWeatherLocation *loc);
 GWeatherLocation *      gis_location_entry_get_location    (GisLocationEntry *entry);
-gboolean                gis_location_entry_has_custom_text (GisLocationEntry *entry);
 gboolean                gis_location_entry_set_city        (GisLocationEntry *entry,
                                                             const char       *city_name,
                                                             const char       *code);


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