libmbca r14 - in trunk: . src
- From: kaijanma svn gnome org
- To: svn-commits-list gnome org
- Subject: libmbca r14 - in trunk: . src
- Date: Thu, 14 Aug 2008 10:57:52 +0000 (UTC)
Author: kaijanma
Date: Thu Aug 14 10:57:52 2008
New Revision: 14
URL: http://svn.gnome.org/viewvc/libmbca?rev=14&view=rev
Log:
check libgweather version during configure
Modified:
trunk/configure.ac
trunk/src/provider_thread.c
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Thu Aug 14 10:57:52 2008
@@ -33,6 +33,49 @@
AC_SUBST(LIBMBCA_CFLAGS)
AC_SUBST(LIBMBCA_LIBS)
+##### Find out the version of libgweather we're using
+gweather_version=`pkg-config --modversion gweather`
+
+GWEATHER_VERSION_MAJOR=`echo $gweather_version | awk -F. '{print $1}'`
+GWEATHER_VERSION_MINOR=`echo $gweather_version | awk -F. '{print $2}'`
+GWEATHER_VERSION_MICRO=`echo $gweather_version | awk -F. '{print $3}'`
+if test "z$GWEATHER_VERSION_MAJOR" = "z"; then
+ GWEATHER_VERSION_MAJOR="0"
+fi
+if test "z$GWEATHER_VERSION_MINOR" = "z"; then
+ GWEATHER_VERSION_MINOR="0"
+fi
+if test "z$GWEATHER_VERSION_MICRO" = "z"; then
+ GWEATHER_VERSION_MICRO="0"
+fi
+
+if test "z$GWEATHER_VERSION_MAJOR" = "z0" -a "z$GWEATHER_VERSION_MINOR" = "z0" -a "z$GWEATHER_VERSION_MICRO" = "z0"; then
+ echo "Error: Couldn't determine the version of your gweather package."
+ echo " This is probably an error in this script, please report it"
+ echo " along with the following information:"
+ echo " Base gweather version ='$gweather_version'"
+ echo " GWEATHER_VERSION_MAJOR='$GWEATHER_VERSION_MAJOR'"
+ echo " GWEATHER_VERSION_MINOR='$GWEATHER_VERSION_MINOR'"
+ echo " GWEATHER_VERSION_MICRO='$GWEATHER_VERSION_MICRO'"
+ exit 1
+else
+
+ echo "Your gweather version is $GWEATHER_VERSION_MAJOR,$GWEATHER_VERSION_MINOR,$GWEATHER_VERSION_MICRO."
+ if test "$GWEATHER_VERSION_MAJOR" -lt "2"; then
+ CFLAGS="$CFLAGS -DLIBGWEATHER_PRIOR_2_23_6"
+ else
+ if test "$GWEATHER_VERSION_MAJOR" -eq "2"; then
+ if test "$GWEATHER_VERSION_MINOR" -ge "23"; then
+ if test "$GWEATHER_VERSION_MICRO" -lt "6"; then
+ CFLAGS="$CFLAGS -DLIBGWEATHER_PRIOR_2_23_6"
+ fi
+ else
+ CFLAGS="$CFLAGS -DLIBGWEATHER_PRIOR_2_23_6"
+ fi
+ fi
+ fi
+fi
+
AC_OUTPUT([
Makefile
libmbca.pc
Modified: trunk/src/provider_thread.c
==============================================================================
--- trunk/src/provider_thread.c (original)
+++ trunk/src/provider_thread.c Thu Aug 14 10:57:52 2008
@@ -31,6 +31,8 @@
#include "provider_thread.h"
#include "gnome-panel/system-timezone.h"
+
+#ifdef LIBGWEATHER_PRIOR_2_23_6
/**
* ret must be freed
*/
@@ -171,7 +173,106 @@
return NULL;
}
+#else
+/* libgweather 2.23.6
+==================
+ ...
+Locations.xml
+ ...
+ - every <location> node is inside a <city> node with a real city name
+ ...
+*/
+/**
+ * ret must be freed
+ */
+gchar*
+mbca_alpha2name (const gchar* code,
+ GtkTreeModel* gweather_database,
+ volatile gboolean* abort)
+{
+ GtkTreeIter region;
+
+ gtk_tree_model_get_iter_first (gweather_database, ®ion);
+ do
+ {
+ GtkTreeIter country;
+ if ( !gtk_tree_model_iter_children (gweather_database,
+ &country,
+ ®ion))
+ {
+ /* no countries */
+ continue;
+ }
+
+ do
+ {
+ GtkTreeIter city;
+
+ if (!gtk_tree_model_iter_children (gweather_database,
+ &city,
+ &country))
+ {
+ /* no cities */
+ continue;
+ }
+
+ do
+ {
+ GtkTreeIter location;
+ WeatherLocation* loc;
+
+ if (!gtk_tree_model_iter_children (gweather_database,
+ &location,
+ &city))
+ {
+ /* no locations */
+ continue;
+ }
+
+ 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;
+ }
+ gtk_tree_model_get (gweather_database, &statelocation,
+ GWEATHER_XML_COL_POINTER, &loc,
+ -1);
+ if(!loc)
+ {
+ /* skip */
+ continue;
+ }
+ }
+
+ if (g_ascii_strcasecmp (code, loc->country_code) == 0)
+ {
+ gchar* name;
+ gtk_tree_model_get (gweather_database, &country,
+ GWEATHER_XML_COL_LOC, &name,
+ -1);
+ return name;
+ }
+ } while (gtk_tree_model_iter_next (gweather_database,
+ &country) && !(*abort));
+ }
+ while (gtk_tree_model_iter_next (gweather_database,
+ &city) && !(*abort));
+ }
+ while (gtk_tree_model_iter_next (gweather_database, ®ion) && !(*abort));
+
+ return NULL;
+}
+#endif /* LIBGWEATHER_PRIOR_2_23_6 */
/**
*Â brief populate provider list store
@@ -277,6 +378,7 @@
g_free (name);
}
+#ifdef LIBGWEATHER_PRIOR_2_23_6
/**
* code must not be freed
*/
@@ -344,6 +446,18 @@
return NULL;
}
+#else
+/**
+ * code must not be freed
+ */
+static const gchar*
+mbca_match_timezone(const gchar* timezone,
+ GtkTreeModel* gweather_database,
+ GtkTreeIter country,
+ volatile gboolean* abort)
+{
+}
+#endif /* LIBGWEATHER_PRIOR_2_23_6 */
/**
* code must not be freed!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]