libmbca r15 - trunk/src
- From: kaijanma svn gnome org
- To: svn-commits-list gnome org
- Subject: libmbca r15 - trunk/src
- Date: Thu, 14 Aug 2008 11:44:33 +0000 (UTC)
Author: kaijanma
Date: Thu Aug 14 11:44:33 2008
New Revision: 15
URL: http://svn.gnome.org/viewvc/libmbca?rev=15&view=rev
Log:
implement new parsers for gweather database
Modified:
trunk/src/provider_thread.c
Modified: trunk/src/provider_thread.c
==============================================================================
--- trunk/src/provider_thread.c (original)
+++ trunk/src/provider_thread.c Thu Aug 14 11:44:33 2008
@@ -263,10 +263,10 @@
return name;
}
} while (gtk_tree_model_iter_next (gweather_database,
- &country) && !(*abort));
+ &city) && !(*abort));
}
while (gtk_tree_model_iter_next (gweather_database,
- &city) && !(*abort));
+ &country) && !(*abort));
}
while (gtk_tree_model_iter_next (gweather_database, ®ion) && !(*abort));
@@ -456,6 +456,77 @@
GtkTreeIter country,
volatile gboolean* abort)
{
+ GtkTreeIter city;
+ GtkTreeIter location;
+ WeatherLocation* loc;
+
+ if (!gtk_tree_model_iter_children (gweather_database,
+ &city,
+ &country))
+ {
+ /* no cities */
+ return NULL;
+ }
+
+ do
+ {
+
+ if (!gtk_tree_model_iter_children (gweather_database,
+ &location,
+ &city))
+ {
+ /* no locations */
+ return NULL;
+ }
+
+ do
+ {
+ gtk_tree_model_get (gweather_database, &location,
+ GWEATHER_XML_COL_POINTER, &loc,
+ -1);
+ if (!loc)
+ {
+ /* country has states , location means state */
+ GtkTreeIter statelocation;
+ if (!gtk_tree_model_iter_children (gweather_database,
+ &statelocation,
+ &location))
+ {
+ /* no state locations */
+ continue;
+ }
+
+
+ do
+ {
+ gtk_tree_model_get (gweather_database, &statelocation,
+ GWEATHER_XML_COL_POINTER, &loc,
+ -1);
+ if(!loc)
+ {
+ /* skip */
+ continue;
+ }
+ }
+ while (gtk_tree_model_iter_next (gweather_database, &statelocation)
+ && !(*abort));
+
+ if (!loc)
+ {
+ continue;
+ }
+ }
+ if (g_ascii_strcasecmp (timezone, loc->tz_hint) == 0)
+ {
+ return loc->country_code;
+ }
+ }
+ while (gtk_tree_model_iter_next (gweather_database, &location)
+ && !(*abort));
+ } while (gtk_tree_model_iter_next (gweather_database, &city)
+ && !(*abort);
+
+ return NULL;
}
#endif /* LIBGWEATHER_PRIOR_2_23_6 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]