summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2020-04-30 11:22:56 +0200
committerBastien Nocera <hadess@hadess.net>2021-01-11 20:31:52 +0100
commita446007d4f40ac6b4628a298bf5a74bcbf5597d5 (patch)
tree7c20668303d7654786a0a3f1f6ba7d79e57a0815
parentec0a2d5f7413b4a29f77107b294959be1ff8ae54 (diff)
downloadlibgweather-a446007d4f40ac6b4628a298bf5a74bcbf5597d5.tar.gz
location-entry: Use a list store instead of a tree store
It looks like at one point the idea was to use a hierarchical structure for the entries. However, it really is a flat list, so there is no need to use a tree store for it.
-rw-r--r--libgweather/gweather-location-entry.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libgweather/gweather-location-entry.c b/libgweather/gweather-location-entry.c
index 6eecfd6..f8071aa 100644
--- a/libgweather/gweather-location-entry.c
+++ b/libgweather/gweather-location-entry.c
@@ -68,7 +68,7 @@ static void set_location_internal (GWeatherLocationEntry *entry,
GtkTreeIter *iter,
GWeatherLocation *loc);
static void
-fill_location_entry_model (GtkTreeStore *store, GWeatherLocation *loc,
+fill_location_entry_model (GtkListStore *store, GWeatherLocation *loc,
const char *parent_display_name,
const char *parent_compare_local_name,
const char *parent_compare_english_name,
@@ -169,7 +169,7 @@ static void
constructed (GObject *object)
{
GWeatherLocationEntry *entry;
- GtkTreeStore *store = NULL;
+ GtkListStore *store = NULL;
GtkEntryCompletion *completion;
entry = GWEATHER_LOCATION_ENTRY (object);
@@ -177,7 +177,7 @@ constructed (GObject *object)
if (!entry->priv->top)
entry->priv->top = gweather_location_get_world ();
- store = gtk_tree_store_new (4, G_TYPE_STRING, GWEATHER_TYPE_LOCATION, G_TYPE_STRING, G_TYPE_STRING);
+ store = gtk_list_store_new (4, G_TYPE_STRING, GWEATHER_TYPE_LOCATION, G_TYPE_STRING, G_TYPE_STRING);
fill_location_entry_model (store, entry->priv->top, NULL, NULL, NULL, entry->priv->show_named_timezones);
entry->priv->model = GTK_TREE_MODEL (store);
@@ -483,7 +483,7 @@ gweather_location_entry_set_city (GWeatherLocationEntry *entry,
}
static void
-fill_location_entry_model (GtkTreeStore *store, GWeatherLocation *loc,
+fill_location_entry_model (GtkListStore *store, GWeatherLocation *loc,
const char *parent_display_name,
const char *parent_compare_local_name,
const char *parent_compare_english_name,
@@ -556,7 +556,7 @@ fill_location_entry_model (GtkTreeStore *store, GWeatherLocation *loc,
english_compare_name = g_strdup_printf ("%s, %s",
gweather_location_get_english_sort_name (loc), parent_compare_english_name);
- gtk_tree_store_insert_with_values (store, NULL, NULL, -1,
+ gtk_list_store_insert_with_values (store, NULL, -1,
LOC_GWEATHER_LOCATION_ENTRY_COL_LOCATION, loc,
LOC_GWEATHER_LOCATION_ENTRY_COL_DISPLAY_NAME, display_name,
LOC_GWEATHER_LOCATION_ENTRY_COL_LOCAL_COMPARE_NAME, local_compare_name,
@@ -570,7 +570,7 @@ fill_location_entry_model (GtkTreeStore *store, GWeatherLocation *loc,
case GWEATHER_LOCATION_NAMED_TIMEZONE:
if (show_named_timezones) {
- gtk_tree_store_insert_with_values (store, NULL, NULL, -1,
+ gtk_list_store_insert_with_values (store, NULL, -1,
LOC_GWEATHER_LOCATION_ENTRY_COL_LOCATION, loc,
LOC_GWEATHER_LOCATION_ENTRY_COL_DISPLAY_NAME, gweather_location_get_name (loc),
LOC_GWEATHER_LOCATION_ENTRY_COL_LOCAL_COMPARE_NAME, gweather_location_get_sort_name (loc),
@@ -754,7 +754,7 @@ fill_store (gpointer data, gpointer user_data)
normalized = g_utf8_normalize (display_name, -1, G_NORMALIZE_ALL);
compare_name = g_utf8_casefold (normalized, -1);
- gtk_tree_store_insert_with_values (user_data, NULL, NULL, -1,
+ gtk_list_store_insert_with_values (user_data, NULL, -1,
PLACE_GWEATHER_LOCATION_ENTRY_COL_PLACE, place,
PLACE_GWEATHER_LOCATION_ENTRY_COL_DISPLAY_NAME, display_name,
PLACE_GWEATHER_LOCATION_ENTRY_COL_LOCAL_COMPARE_NAME, compare_name,
@@ -772,7 +772,7 @@ _got_places (GObject *source_object,
GList *places;
GWeatherLocationEntry *self = user_data;
GError *error = NULL;
- GtkTreeStore *store = NULL;
+ GtkListStore *store = NULL;
GtkEntryCompletion *completion;
places = geocode_forward_search_finish (GEOCODE_FORWARD (source_object), result, &error);
@@ -791,7 +791,7 @@ _got_places (GObject *source_object,
}
completion = gtk_entry_get_completion (user_data);
- store = gtk_tree_store_new (4, G_TYPE_STRING, GEOCODE_TYPE_PLACE, G_TYPE_STRING, G_TYPE_STRING);
+ store = gtk_list_store_new (4, G_TYPE_STRING, GEOCODE_TYPE_PLACE, G_TYPE_STRING, G_TYPE_STRING);
g_list_foreach (places, fill_store, store);
g_list_free (places);
gtk_entry_completion_set_match_func (completion, new_matcher, NULL, NULL);