After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 677268 - Utilities for timezone lookup
Utilities for timezone lookup
Status: RESOLVED FIXED
Product: libgweather
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: future
Assigned To: libgweather-maint
libgweather-maint
Depends on:
Blocks:
 
 
Reported: 2012-06-01 12:56 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2014-02-18 23:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
location: Make the distance calculation function public (3.57 KB, patch)
2012-06-01 12:56 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
location: Add a utility function to find the nearest city to a coordinate (2.91 KB, patch)
2012-06-01 12:56 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
location: Add a utility function to find the nearest city to a coordinate (4.32 KB, patch)
2012-06-11 20:35 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review

Description Jasper St. Pierre (not reading bugmail) 2012-06-01 12:56:37 UTC
While trying to add geoclue integration to find the nearest timezone
to a user, I found I couldn't easily do what I wanted to do without
hacking up libgweather itself, so here we are...

Maybe I missed something entirely.
Comment 1 Jasper St. Pierre (not reading bugmail) 2012-06-01 12:56:38 UTC
Created attachment 215406 [details] [review]
location: Make the distance calculation function public

Sometimes it might be necessary to get the distances between two
locations, or between a GWeatherLocation and a latitude/longitude
coordinate pair.
Comment 2 Jasper St. Pierre (not reading bugmail) 2012-06-01 12:56:41 UTC
Created attachment 215407 [details] [review]
location: Add a utility function to find the nearest city to a coordinate
Comment 3 Matthias Clasen 2012-06-10 04:36:20 UTC
Review of attachment 215407 [details] [review]:

::: libgweather/gweather-location.c
@@ +515,3 @@
+
+    append_cities (world, &cities);
+

Hmm, does gweather_location_new_world parse the xml database every time ?
Might be nicer to pass that in, so that the caller can hold onto it instead of
recreating it every single time ?

Also, you could do a foreach_location() with a callback, instead of allocating the list of cities just to iterate over it.

@@ +537,3 @@
+    gweather_location_ref (min_loc);
+    gweather_location_unref (world);
+

Looks like you are leaking the list of cities here ?
Comment 4 Matthias Clasen 2012-06-10 04:36:59 UTC
Review of attachment 215406 [details] [review]:

Do you actually need this as public API ? The gnome-initial-setup code only seems to use the find_nearest api in the next patch...
Comment 5 Jasper St. Pierre (not reading bugmail) 2012-06-11 20:35:15 UTC
Created attachment 216150 [details] [review]
location: Add a utility function to find the nearest city to a coordinate

Yeah, we don't need the public distance function.
Comment 6 Giovanni Campagna 2014-02-18 23:48:15 UTC
Seems you forgot to close the bug.