This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository enlightenment-module-forecasts.

View the commit online.

commit 0e67d6ba8e563acb0d8af676a8dcb895259a3415
Author: Alastair Poole <[email protected]>
AuthorDate: Mon May 25 21:17:31 2026 +0100

    forecasts: fix forecasts place search genlist item class
---
 src/e_mod_config.c    | 46 +++++++++++++++++++++++++++++-----------------
 src/forecast_places.c |  6 ++++--
 2 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/src/e_mod_config.c b/src/e_mod_config.c
index a9be0f5..b95a5ff 100644
--- a/src/e_mod_config.c
+++ b/src/e_mod_config.c
@@ -30,6 +30,8 @@ static void         _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata);
 static void         _location_select(E_Config_Dialog_Data *cfdata, Places_Location *location);
 static void         _current_location_show(E_Config_Dialog_Data *cfdata);
 static Eina_Bool    _search_timer_cb(void *data);
+static Elm_Genlist_Item_Class *
+_location_item_class_get(void);
 
 void
 _config_forecasts_module(Config_Item *ci)
@@ -191,6 +193,22 @@ _search_selected_cb(void *data, Evas_Object *obj EINA_UNUSED,
    _location_select(cfdata, location);
 }
 
+static Elm_Genlist_Item_Class *
+_location_item_class_get(void)
+{
+   static Elm_Genlist_Item_Class itc;
+
+   if (!itc.version)
+     {
+        itc.version = ELM_GENLIST_ITEM_CLASS_VERSION;
+        itc.item_style = "no_icon";
+        itc.func.text_get = _text_search_location_get;
+        itc.func.del = _item_location_del;
+     }
+
+   return &itc;
+}
+
 static void
 _search_changed_cb(void *data, Evas_Object *obj,
                    void *event_info EINA_UNUSED)
@@ -233,7 +251,6 @@ _current_location_show(E_Config_Dialog_Data *cfdata)
 {
    Places_Location *location;
    Elm_Object_Item *it;
-   static Elm_Genlist_Item_Class itc;
 
    if (!cfdata || !cfdata->o_search_results) return;
 
@@ -241,17 +258,14 @@ _current_location_show(E_Config_Dialog_Data *cfdata)
    location = _current_location_new(cfdata);
    if (!location) return;
 
-   itc.item_style = "no_icon";
-   itc.func.content_get = NULL;
-   itc.func.text_get = _text_search_location_get;
-   itc.func.filter_get = NULL;
-   itc.func.del = _item_location_del;
-
-   it = elm_genlist_item_append(cfdata->o_search_results, &itc, location,
+   it = elm_genlist_item_append(cfdata->o_search_results,
+                                _location_item_class_get(), location,
                                 NULL, ELM_GENLIST_ITEM_NONE,
                                 _search_selected_cb, cfdata);
    if (it)
      elm_genlist_item_selected_set(it, EINA_TRUE);
+   else
+     free(location);
 }
 
 static Eina_Bool
@@ -261,7 +275,6 @@ _search_timer_cb(void *data)
    Eina_List *list;
    Places_Location *location;
    const char *query;
-   static Elm_Genlist_Item_Class itc;
 
    cfdata->search_timer = NULL;
    query = cfdata->search_query;
@@ -272,16 +285,15 @@ _search_timer_cb(void *data)
         return ECORE_CALLBACK_CANCEL;
      }
 
-   itc.item_style = "no_icon";
-   itc.func.content_get = NULL;
-   itc.func.text_get = _text_search_location_get;
-   itc.func.filter_get = NULL;
-   itc.func.del = _item_location_del;
-
    list = forecast_places_search(query, 50);
    EINA_LIST_FREE(list, location)
-     elm_genlist_item_append(cfdata->o_search_results, &itc, location, NULL,
-                             ELM_GENLIST_ITEM_NONE, _search_selected_cb, cfdata);
+     {
+        if (!elm_genlist_item_append(cfdata->o_search_results,
+                                     _location_item_class_get(), location,
+                                     NULL, ELM_GENLIST_ITEM_NONE,
+                                     _search_selected_cb, cfdata))
+          free(location);
+     }
 
    return ECORE_CALLBACK_CANCEL;
 }
diff --git a/src/forecast_places.c b/src/forecast_places.c
index 533937e..4befe96 100644
--- a/src/forecast_places.c
+++ b/src/forecast_places.c
@@ -357,14 +357,16 @@ forecast_places_search(const char *query, int limit)
         locations = forecast_places_by_category(cat->id);
         EINA_LIST_FOREACH(locations, ll, loc)
           {
-             int score = _location_score(loc, q);
+             int score;
+
+             snprintf(loc->country, sizeof(loc->country), "%s", cat->name);
+             score = _location_score(loc, q);
 
              if (score > 0)
                {
                   Search_Result *result = calloc(1, sizeof(Search_Result));
                   if (result)
                     {
-                       snprintf(loc->country, sizeof(loc->country), "%s", cat->name);
                        result->location = loc;
                        result->score = score;
                        _search_result_insert(&results, result, 0);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to