Index: configure.in
===================================================================
--- configure.in	(revision 10983)
+++ configure.in	(working copy)
@@ -115,9 +115,6 @@
 AC_SUBST(CLOCK_CFLAGS)
 AC_SUBST(CLOCK_LIBS)
 
-LIBGWEATHER_LOCATIONS=`pkg-config --variable=locations_file gweather`
-AC_SUBST(LIBGWEATHER_LOCATIONS)
-
 dnl Hmm, we already checked for these above.  Is there a way to avoid checking twice?
 PKG_CHECK_MODULES(CLOCK_MECHANISM, [ gthread-2.0 dbus-glib-1 ])
 AC_SUBST(CLOCK_MECHANISM_CFLAGS)
Index: applets/clock/ChangeLog
===================================================================
--- applets/clock/ChangeLog	(revision 10983)
+++ applets/clock/ChangeLog	(working copy)
@@ -1,3 +1,17 @@
+2008-04-04  Dan Winship  <danw@gnome.org>
+
+	* gweather-xml.c: gone, moved to libgweather
+
+	* clock.c: #include <libgweather/gweather-xml.h> rather than
+	"gweather-xml.h"
+	(find_timezone): if the weather station has a country code
+	associated with it, only return timezones that are also located in
+	that country.
+	(update_timezone): Use the tz-hint and iso-code from the location
+	data to more reliably pick a timezone. #519823.
+	(find_weather_code): Moved here from gweather-xml.c and updated to
+	look for a matching country code as well.
+
 2008-04-03  Vincent Untz  <vuntz@gnome.org>
 
 	Fix initial visibility of the appointments to actually follow the state
Index: applets/clock/Makefile.am
===================================================================
--- applets/clock/Makefile.am	(revision 10983)
+++ applets/clock/Makefile.am	(working copy)
@@ -20,7 +20,6 @@
 	-DCLOCK_TIME_UTILITY="\"$(CLOCK_TIME_UTILITY)\""	\
 	-DEVOLUTION_TEXTDOMAIN=\"evolution-2.12\"		\
 	-DSYSTEM_ZONEINFODIR=\"/usr/share/zoneinfo\"		\
-	-DGWEATHER_XML_LOCATION=\"$(LIBGWEATHER_LOCATIONS)\"	\
 	-DGWEATHER_I_KNOW_THIS_IS_UNSTABLE
 
 if HAVE_LIBECAL
@@ -67,8 +66,6 @@
 	clock-zoneinfo.h	\
 	clock-zonetable.c	\
 	clock-zonetable.h	\
-	gweather-xml.c		\
-	gweather-xml.h		\
 	$(BUILT_SOURCES)	\
 	$(CALENDAR_SOURCES)	\
 	$(SETTIME_SOURCES)
Index: applets/clock/clock.c
===================================================================
--- applets/clock/clock.c	(revision 10983)
+++ applets/clock/clock.c	(working copy)
@@ -50,6 +50,7 @@
 
 #include <glade/glade.h>
 #include <libgweather/gweather-prefs.h>
+#include <libgweather/gweather-xml.h>
 
 #include "clock.h"
 
@@ -59,7 +60,6 @@
 #include "clock-map.h"
 #include "clock-utils.h"
 #include "clock-zonetable.h"
-#include "gweather-xml.h"
 #include "obox.h"
 #include "set-timezone.h"
 
@@ -3190,19 +3190,28 @@
 }
 
 static gchar *
-find_timezone (ClockData *cd, const char *name, gfloat lat, gfloat lon)
+find_timezone (ClockData *cd, const char *name, const char *iso_code,
+               gfloat lat, gfloat lon)
 {
         ClockZoneTable *zonetab = cd->zones;
 	GList *zones, *l;
 	double dist, d;
 	gfloat zlat, zlon;
 	ClockZoneInfo *best;
+        const char *country;
 
 	dist = 1e6;
 	best = NULL;
 	zones = clock_zonetable_get_zones (zonetab);
 	for (l = zones; l; l = l->next) {
 		ClockZoneInfo *info = l->data;
+
+                if (iso_code) {
+                        country = clock_zoneinfo_get_country (info);
+                        if (!country || g_ascii_strcasecmp (iso_code, country) != 0)
+                                continue;
+                }
+
 		clock_zoneinfo_get_coords (info, &zlat, &zlon);
 
 		d = distance (lat, lon, zlat*M_PI/180.0, zlon*M_PI/180.0);
@@ -3213,13 +3222,16 @@
 		}
 	}
 
-	clock_zoneinfo_get_coords (best, &zlat, &zlon);
-
-	return g_strdup (clock_zoneinfo_get_name (best));
+        if (best)
+                return g_strdup (clock_zoneinfo_get_name (best));
+        else
+                return NULL;
 }
 
 static void
-update_timezone (ClockData *cd, const char *name, gboolean valid, gfloat lat, gfloat lon)
+update_timezone (ClockData *cd, const char *name,
+                 const char *country_code, const char *tz_hint,
+                 gboolean valid, gfloat lat, gfloat lon)
 {
         GtkWidget *zone_combo = glade_xml_get_widget (cd->glade_xml, "edit-location-timezone-combo");
 	gchar *timezone;
@@ -3239,7 +3251,14 @@
 	prefs.temperature_unit = cd->temperature_unit;
 	prefs.speed_unit = cd->speed_unit;
 
-	timezone = find_timezone (cd, name, lat, lon);
+        if (tz_hint)
+                timezone = g_strdup (tz_hint);
+        else {
+                timezone = find_timezone (cd, name, country_code, lat, lon);
+                if (!timezone)
+                        return;
+        }
+
 	loc = clock_location_new (name, timezone, lat*180.0/M_PI, lon*180.0/M_PI, NULL, &prefs);
 
 	g_signal_handler_block (zone_combo, cd->zone_combo_changed);
@@ -3279,10 +3298,8 @@
 
 	update_coords (cd, loc->latlon_valid, loc->latitude*180.0/M_PI, loc->longitude*180.0/M_PI);
 
-	/* FIXME: loc->zone can gives us the timezone. For Bristol, it's
-	 * :westcountry. No idea how to map this to a real timezone, though. */
-	update_timezone (cd, loc->name, loc->latlon_valid,
-			 loc->latitude, loc->longitude);
+	update_timezone (cd, loc->name, loc->country_code, loc->tz_hint,
+                         loc->latlon_valid, loc->latitude, loc->longitude);
 
 	find_hide (NULL, cd);
 }
@@ -3309,9 +3326,6 @@
 	if (gtk_tree_view_get_model (tree) != NULL)
 		return;
 
-	model = (GtkTreeModel*) gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
-	gtk_tree_view_set_model (tree, model);
-
 	cell = gtk_cell_renderer_text_new ();
 	column = gtk_tree_view_column_new_with_attributes ("not used", cell,
 							   "text", GWEATHER_XML_COL_LOC, NULL);
@@ -3321,7 +3335,9 @@
 	g_signal_connect (tree, "row-activated",
                           G_CALLBACK (location_row_activated), cd);
 
-	gweather_xml_load_locations (tree);
+	model = gweather_xml_load_locations ();
+	gtk_tree_view_set_model (tree, model);
+        g_object_unref (model);
 }
 
 static void
@@ -3564,6 +3580,70 @@
         return TRUE;
 }
 
+typedef struct {
+  const gchar *name;
+  const gchar *country_code;
+  gdouble latitude;
+  gdouble longitude;
+  gdouble distance;
+  WeatherLocation *location;
+} SearchData;
+  
+static gboolean
+compare_location (GtkTreeModel *model,
+                  GtkTreePath  *path,
+                  GtkTreeIter  *iter,
+                  gpointer      user_data)
+{
+  SearchData *data = user_data;
+  WeatherLocation *loc;
+  gdouble d;
+   
+  gtk_tree_model_get (model, iter, GWEATHER_XML_COL_POINTER, &loc, -1);
+
+  if (!loc)
+    return FALSE;
+  if (loc->country_code && data->country_code &&
+      g_ascii_strcasecmp (loc->country_code, data->country_code) != 0)
+    return FALSE;
+
+  d = distance (data->latitude, data->longitude, loc->latitude, loc->longitude);
+
+  if (d < data->distance) {
+    data->distance = d;
+    data->location = loc;
+  }
+
+  return FALSE;
+}
+
+static gchar *
+find_weather_code (GtkTreeModel *model,
+		   const gchar  *name,
+		   const gchar  *iso_code,
+                   gdouble       lat, 
+                   gdouble       lon)
+{
+  SearchData data;
+  gchar *code;
+
+  data.name = name;
+  data.country_code = iso_code;
+  data.latitude = lat;
+  data.longitude = lon;
+  data.distance = 1e6;
+  data.location = NULL;
+
+  gtk_tree_model_foreach (GTK_TREE_MODEL (model), compare_location, &data);
+
+  if (data.location)
+    code = g_strdup (data.location->code);
+  else
+    code = g_strdup ("-");
+
+  return code;
+}
+
 static void
 zone_combo_changed (GtkComboBox *widget, ClockData *cd)
 {
@@ -3619,7 +3699,8 @@
 
 	fill_location_tree (cd);
 	model = gtk_tree_view_get_model (GTK_TREE_VIEW (cd->location_tree));
-	weather_code = find_weather_code (model, city, lat * M_PI/180.0, lon * M_PI/180.0);
+	weather_code = find_weather_code (model, city, clock_zoneinfo_get_country (info),
+                                          lat * M_PI/180.0, lon * M_PI/180.0);
 	g_object_set_data_full (G_OBJECT (edit_window), "weather-code", weather_code, g_free);
 }
 
Index: applets/clock/clock-location.c
===================================================================
--- applets/clock/clock-location.c	(revision 10983)
+++ applets/clock/clock-location.c	(working copy)
@@ -26,7 +26,6 @@
 #include "clock-location.h"
 #include "clock-marshallers.h"
 #include "set-timezone.h"
-#include "gweather-xml.h"
 
 G_DEFINE_TYPE (ClockLocation, clock_location, G_TYPE_OBJECT)
 
@@ -983,7 +982,7 @@
 
 	dms = rad2dms (priv->latitude, priv->longitude);
 	wl = weather_location_new (priv->name, priv->weather_code,
-				   NULL, NULL, dms);
+				   NULL, NULL, dms, NULL, NULL);
 
 	priv->weather_info =
 		weather_info_new (wl, &prefs, weather_info_updated, loc);
Index: applets/clock/gweather-xml.c
===================================================================
--- applets/clock/gweather-xml.c	(revision 10983)
+++ applets/clock/gweather-xml.c	(working copy)
@@ -1,483 +0,0 @@
-/* gweather-xml.c - Locations.xml parsing code
- *
- * Copyright (C) 2005 Ryan Lortie, 2004 Gareth Owen
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-/* There is very little error checking in the parsing code below, it relies 
- * heavily on the locations file being in the correct format.  If you have
- * <name> elements within a parent element, they must come first and be
- * grouped together.
- * The format is as follows: 
- * 
- * <gweather format="1.0">
- * <region>
- *  <name>Name of the region</name>
- *  <name xml:lang="xx">Translated Name</name>
- *  <name xml:lang="zz">Another Translated Name</name>
- *  <country>
- *   <name>Name of the country</name>
- *   <location>
- *    <name>Name of the location</name>
- *    <code>IWIN code</code>
- *    <zone>Forecast code (North America, Australia, UK only)</zone>
- *    <radar>Weather.com radar map code (North America only)</radar>
- *    <coordinates>Latitude and longitude as DD-MM[-SS][H] pair</coordinates>
- *   </location>
- *   <state>
- *     <location>
- *       ....
- *     </location>
- *     <city>
- *      <name>Name of city with multiple locations</city>
- *      <zone>Forecast code</zone>
- *      <radar>Radar Map code</radar>
- *      <location>
- *        ...
- *      </location>
- *     </city>
- *   </state>
- *  </country>
- * </region>
- * <gweather>
- *
- * The thing to note is that each country can either contain different locations
- * or be split into "states" which in turn contain a list of locations.
- *
- */
-
-#include <string.h>
-#include <math.h>
-#include <locale.h>
-#include <gtk/gtk.h>
-#include <libxml/xmlreader.h>
-
-#include "gweather-xml.h"
-
-static gint
-gweather_xml_location_sort_func( GtkTreeModel *model, GtkTreeIter *a,
-                                 GtkTreeIter *b, gpointer user_data )
-{
-    gint res;
-    gchar *name_a, *name_b;
-    gchar *fold_a, *fold_b;
-        
-    gtk_tree_model_get (model, a, GWEATHER_XML_COL_LOC, &name_a, -1);
-    gtk_tree_model_get (model, b, GWEATHER_XML_COL_LOC, &name_b, -1);
-        
-    fold_a = g_utf8_casefold(name_a, -1);
-    fold_b = g_utf8_casefold(name_b, -1);
-        
-    res = g_utf8_collate(fold_a, fold_b);
-    
-    g_free(name_a);
-    g_free(name_b);
-    g_free(fold_a);
-    g_free(fold_b);
-    
-    return res;
-}
- 
-static char*
-gweather_xml_get_value( xmlTextReaderPtr xml )
-{
-  char* value;
-
-  /* check for null node */
-  if ( xmlTextReaderIsEmptyElement( xml ) )
-    return NULL;
-    
-  /* the next "node" is the text node containing the value we want to get */
-  if( xmlTextReaderRead( xml ) != 1 )
-    return NULL;
-
-  value = (char *) xmlTextReaderValue( xml );
-
-  /* move on to the end of this node */
-  while( xmlTextReaderNodeType( xml ) != XML_READER_TYPE_END_ELEMENT )
-    if( xmlTextReaderRead( xml ) != 1 )
-    {
-      xmlFree( value );
-      return NULL;
-    }
-
-  /* consume the end element too */
-  if( xmlTextReaderRead( xml ) != 1 )
-  {
-    xmlFree( value );
-    return NULL;
-  }
-    
-  return value;
-}
-
-static char *
-gweather_xml_parse_name( xmlTextReaderPtr xml )
-{
-  const char * const *locales;
-  const char *this_language;
-  int best_match = INT_MAX;
-  char *lang, *tagname;
-  gboolean keep_going;
-  char *name = NULL;
-  int i;
-
-  locales = g_get_language_names();
-
-  do
-  {
-    /* First let's get the language */
-    lang = (char *) xmlTextReaderXmlLang( xml );
-
-    if( lang == NULL )
-      this_language = "C";
-    else
-      this_language = lang;
-
-    /* the next "node" is text node containing the actual name */
-    if( xmlTextReaderRead( xml ) != 1 )
-    {
-      xmlFree( lang );
-      return NULL;
-    }
-
-    for( i = 0; locales[i] && i < best_match; i++ )
-      if( !strcmp( locales[i], this_language ) )
-      {
-        /* if we've already encounted a less accurate
-           translation, then free it */
-        xmlFree( name );
-
-        name = (char *) xmlTextReaderValue( xml );
-        best_match = i;
-
-        break;
-      }
-
-    xmlFree( lang );
-
-    while( xmlTextReaderNodeType( xml ) != XML_READER_TYPE_ELEMENT )
-      if( xmlTextReaderRead( xml ) != 1 )
-      {
-        xmlFree( name );
-        return NULL;
-      }
-
-    /* if the next tag is another <name> then keep going */
-    tagname = (char *) xmlTextReaderName( xml );
-    keep_going = !strcmp( tagname, "name" );
-    xmlFree( tagname );
-
-  } while( keep_going );
-
-  return name;
-}
-
-static int
-gweather_xml_parse_node (GtkTreeStore *store, GtkTreeIter *parent,
-                         xmlTextReaderPtr xml, 
-                         const char *dflt_radar, const char *dflt_zone,
-                         const char *cityname)
-{
-  char *name, *code, *zone, *radar, *coordinates;
-  char **city, *nocity = NULL;
-  GtkTreeIter iter, *self;
-  gboolean is_location;
-  char *tagname;
-  int ret = -1;
-  int tagtype;
-
-  if( (tagname = (char *) xmlTextReaderName( xml )) == NULL )
-    return -1;
-
-  if( !strcmp( tagname, "city" ) )
-    city = &name;
-  else
-    city = &nocity;
-
-  is_location = !strcmp( tagname, "location" );
-
-  /* if we're processing the top-level, then don't create a new iter */
-  if( !strcmp( tagname, "gweather" ) )
-    self = NULL;
-  else
-  {
-    self = &iter;
-    /* insert this node into the tree */
-    gtk_tree_store_append( store, self, parent );
-  }
-
-  xmlFree( tagname );
-
-  coordinates = NULL;
-  radar = NULL;
-  zone = NULL;
-  code = NULL;
-  name = NULL;
-
-  /* absorb the start tag */
-  if( xmlTextReaderRead( xml ) != 1 )
-    goto error_out;
-
-  /* start parsing the actual contents of the node */
-  while( (tagtype = xmlTextReaderNodeType( xml )) !=
-         XML_READER_TYPE_END_ELEMENT )
-  {
-
-    /* skip non-element types */
-    if( tagtype != XML_READER_TYPE_ELEMENT )
-    {
-      if( xmlTextReaderRead( xml ) != 1 )
-        goto error_out;
-
-      continue;
-    }
-    
-    tagname = (char *) xmlTextReaderName( xml );
-
-    if( !strcmp( tagname, "region" ) || !strcmp( tagname, "country" ) ||
-        !strcmp( tagname, "state" ) || !strcmp( tagname, "city" ) ||
-        !strcmp( tagname, "location" ) )
-    {
-      /* recursively handle sub-sections */
-      if( gweather_xml_parse_node( store, self, xml, 
-                                   radar, zone, *city ) )
-        goto error_out;
-    }
-    else if ( !strcmp( tagname, "name" ) )
-    {
-      xmlFree( name );
-      if( (name = gweather_xml_parse_name( xml )) == NULL )
-        goto error_out;
-    }
-    else if ( !strcmp( tagname, "code" ) )
-    {
-      xmlFree( code );
-      if( (code = gweather_xml_get_value( xml )) == NULL )
-        goto error_out;
-    }
-    else if ( !strcmp( tagname, "zone" ) )
-    {
-      xmlFree( zone );
-      if( (zone = gweather_xml_get_value( xml )) == NULL )
-        goto error_out;
-    }
-    else if ( !strcmp( tagname, "radar" ) )
-    {
-      xmlFree( radar );
-      if( (radar = gweather_xml_get_value( xml )) == NULL )
-        goto error_out;
-    }
-    else if ( !strcmp( tagname, "coordinates" ) )
-    {
-      xmlFree( coordinates );
-      if( (coordinates = gweather_xml_get_value( xml )) == NULL )
-        goto error_out;
-    }
-    else /* some strange tag */
-    {
-      /* skip past it */
-      if( xmlTextReaderRead( xml ) != 1 )
-        goto error_out;
-    }
-
-    xmlFree( tagname );
-  }
-
-  if( self )
-    gtk_tree_store_set( store, self, GWEATHER_XML_COL_LOC, name, -1 );
-
-  /* absorb the end tag.  in the case of processing a <gweather> then 'self'
-     is NULL.  In this case, we let this fail since we might be at EOF */
-  if( xmlTextReaderRead( xml ) != 1 && self )
-    goto error_out;
-
-  /* if this is an actual location, setup the WeatherLocation for it */
-  if( is_location )
-  {
-    WeatherLocation *new_loc;
-
-    if( cityname == NULL )
-      cityname = name;
-
-    if( radar != NULL )
-      dflt_radar = radar;
-
-    if( zone != NULL )
-      dflt_zone = zone;
-
-    new_loc =  weather_location_new( cityname, code, dflt_zone,
-                                     dflt_radar, coordinates );
-
-    gtk_tree_store_set( store, &iter, GWEATHER_XML_COL_POINTER, new_loc, -1 );
-  }
-
-  ret = 0;
-
-error_out:
-  xmlFree( name );
-  xmlFree( code );
-  xmlFree( zone );
-  xmlFree( radar );
-  xmlFree( coordinates );
-
-  return ret;
-}
-
-/*****************************************************************************
- * Func:    gweather_xml_load_locations()
- * Desc:    Main entry point for loading the locations from the XML file
- * Parm:
- *      *tree:      tree to view locations
- *      *current:   currently selected location
- */
-int
-gweather_xml_load_locations( GtkTreeView *tree)
-{
-  char *tagname, *format;
-  GtkTreeSortable *sortable;
-  GtkTreeStore *store;
-  xmlTextReaderPtr xml;
-  int keep_going;
-  int ret = -1;
-
-  /* Open the xml file containing the different locations */
-#ifdef GWEATHER_XML_LOCATION
-  xml = xmlNewTextReaderFilename (GWEATHER_XML_LOCATION);
-#else
-  xml = xmlNewTextReaderFilename ("/usr/share/gnome-applets/gweather/Locations.xml");
-#endif
-  if( xml == NULL )
-    goto error_out;
-
-  /* fast forward to the first element */
-  do
-  {
-    /* if we encounter a problem here, exit right away */
-    if( xmlTextReaderRead( xml ) != 1 )
-      goto error_out;
-  } while( xmlTextReaderNodeType( xml ) != XML_READER_TYPE_ELEMENT );
-
-  /* check the name and format */
-  tagname = (char *) xmlTextReaderName( xml );
-  keep_going = tagname && !strcmp( tagname, "gweather" );
-  xmlFree( tagname );
-
-  if( !keep_going )
-    goto error_out;
-
-  format = (char *) xmlTextReaderGetAttribute( xml, (xmlChar *) "format" );
-  keep_going = format && !strcmp( format, "1.0" );
-  xmlFree( format );
-
-  if( !keep_going )
-    goto error_out;
-
-  store = GTK_TREE_STORE (gtk_tree_view_get_model (tree));
-  /* temporarily disconnect the model to speed things up */
-  g_object_ref (store);
-  gtk_tree_view_set_model (tree, NULL);
-
-  ret = gweather_xml_parse_node( store, NULL, xml, NULL, NULL, NULL );
-
-  gtk_tree_view_set_model (tree, GTK_TREE_MODEL (store));
-  g_object_unref (store);
-
-  if( ret )
-    goto error_out;
-
-  /* Sort the tree */
-  sortable = GTK_TREE_SORTABLE (gtk_tree_view_get_model( tree ));
-  gtk_tree_sortable_set_default_sort_func( sortable,
-                                           &gweather_xml_location_sort_func,
-                                           NULL, NULL);
-  gtk_tree_sortable_set_sort_column_id( sortable, 
-                                     GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
-                                        GTK_SORT_ASCENDING );
-error_out:
-  xmlFreeTextReader( xml );
-
-  return ret;
-}
-
-typedef struct {
-  const gchar *name;
-  gdouble latitude;
-  gdouble longitude;
-  gdouble distance;
-  WeatherLocation *location;
-} SearchData;
-  
-
-static gdouble
-distance (gdouble lat1, gdouble lon1, 
-          gdouble lat2, gdouble lon2)
-{
-  gdouble radius = 6372.795;
-
-  return acos (cos (lat1) * cos (lat2) * cos (lon1 - lon2) + sin (lat1) * sin (lat2)) * radius;
-}
-
-static gboolean
-compare_location (GtkTreeModel *model,
-                  GtkTreePath  *path,
-                  GtkTreeIter  *iter,
-                  gpointer      user_data)
-{
-  SearchData *data = user_data;
-  WeatherLocation *loc;
-  gdouble d;
-   
-  gtk_tree_model_get (model, iter, GWEATHER_XML_COL_POINTER, &loc, -1);
-
-  if (!loc)
-    return FALSE;
-
-  d = distance (data->latitude, data->longitude, loc->latitude, loc->longitude);
-
-  if (d < data->distance) {
-    data->distance = d;
-    data->location = loc;
-  }
-
-  return FALSE;
-}
-
-gchar *
-find_weather_code (GtkTreeModel *model,
-		   const gchar  *name,
-                   gdouble       lat, 
-                   gdouble       lon)
-{
-  SearchData data;
-  gchar *code;
-
-  data.name = name;
-  data.latitude = lat;
-  data.longitude = lon;
-  data.distance = 1e6;
-  data.location = NULL;
-
-  gtk_tree_model_foreach (GTK_TREE_MODEL (model), compare_location, &data);
-
-  if (data.distance < 50)
-    code = g_strdup (data.location->code);
-  else
-    code = g_strdup ("-");
-
-  return code;
-}
Index: applets/clock/gweather-xml.h
===================================================================
--- applets/clock/gweather-xml.h	(revision 10983)
+++ applets/clock/gweather-xml.h	(working copy)
@@ -1,37 +0,0 @@
-/* gweather-xml.h 
- *
- * Copyright (C) 2004 Gareth Owen
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __GWEATHER_XML_H__
-#define __GWEATHER_XML_H__
-
-#include <gtk/gtk.h>
-#include <libgweather/weather.h>
-
-enum
-{
-    GWEATHER_XML_COL_LOC = 0,
-    GWEATHER_XML_COL_POINTER,
-    GWEATHER_XML_NUM_COLUMNS
-}; 
-
-int gweather_xml_load_locations( GtkTreeView *tree);
-gchar *find_weather_code (GtkTreeModel *model, const gchar *name, gdouble lat, gdouble lon);
-
-
-#endif /* __GWEATHER_XML_H__ */
