GNOME Bugzilla – Bug 734878
add API to find locations that match search terms
Last modified: 2021-06-09 21:06:56 UTC
Both Weather and Clocks have to manually implement a function that takes a bunch of terms and matches them against the location name, country name, etc in order to implement their SearchProviders. The code is not only duplicated, but also incomplete, since from the application it is only possible to match against the translated names, while LocationEntry also matches again english names. Such function is also needed if one wants to implement searching without using search entry, e.g. to have a GtkSearchBar and a GtkListView that shows the matches The API needs a bit of thinking, I see the following possibilities: 1) a plain location_matches(char **terms) and document that the terms should be normalized and casefolded before beeing passed in (I do not want to normalize and casefold the terms for every location) 2) a pair of functions: location_create_serch(terms) that returns an opaque "search" struct and then a location_matches(search). This would hide the normalization and casefolding giving us more freedom of changing the implementation 3) go all the way and create a LocationMatcher object with add(terms) and find and find_async methods in GIO style. This would be nice since it could probably factor out a good part of the Weather and Clocks search providers
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/libgweather/-/issues/128.