[libchamplain] Migrate to libmemphis version 0.2



commit abd9242cbe9fe26e2283b704516adff4f695a1b5
Author: Simon Wenner <simon wenner ch>
Date:   Thu Feb 25 17:31:20 2010 +0100

    Migrate to libmemphis version 0.2
    
    Version 0.2 features proper io error handling and introspection support.

 champlain.pc.in                               |    2 +-
 champlain/Makefile.am                         |    1 +
 champlain/champlain-local-map-data-source.c   |    9 ++++++++-
 champlain/champlain-memphis-tile-source.c     |   18 +++++++++++++++---
 champlain/champlain-network-map-data-source.c |   11 ++++++++++-
 configure.ac                                  |    4 ++--
 6 files changed, 37 insertions(+), 8 deletions(-)
---
diff --git a/champlain.pc.in b/champlain.pc.in
index d4251fa..2607c4a 100644
--- a/champlain.pc.in
+++ b/champlain.pc.in
@@ -8,4 +8,4 @@ Description: Map View for Clutter
 Version: @VERSION@
 Libs: -L${libdir} -lchamplain- API_VERSION@
 Cflags: -I${includedir}/libchamplain- API_VERSION@
-Requires: gobject-2.0 clutter-1.0 memphis-0.1
+Requires: gobject-2.0 clutter-1.0 memphis-0.2
diff --git a/champlain/Makefile.am b/champlain/Makefile.am
index 1fb4b6f..fb0f386 100644
--- a/champlain/Makefile.am
+++ b/champlain/Makefile.am
@@ -181,6 +181,7 @@ Champlain-0.5.gir: $(INTROSPECTION_SCANNER) libchamplain-0.5.la
 	--c-include="$(libchamplain_include_HEADERS)" \
 	--include=Clutter-1.0 \
 	--include=Gtk-2.0 \
+	--include=Memphis-0.2 \
 	--library=champlain-0.5 \
 	--libtool="$(LIBTOOL)" \
 	--output $@ \
diff --git a/champlain/champlain-local-map-data-source.c b/champlain/champlain-local-map-data-source.c
index 23c1f8e..f654d81 100644
--- a/champlain/champlain-local-map-data-source.c
+++ b/champlain/champlain-local-map-data-source.c
@@ -164,8 +164,15 @@ champlain_local_map_data_source_load_map_data (ChamplainLocalMapDataSource *self
   ChamplainLocalMapDataSourcePrivate *priv = self->priv;
   ChamplainBoundingBox *bbox;
   MemphisMap *map = memphis_map_new ();
+  GError *err = NULL;
 
-  memphis_map_load_from_file (map, map_path);
+  memphis_map_load_from_file (map, map_path, &err);
+  if (err != NULL)
+    {
+      g_critical ("Can't load map file: \"%s\"", err->message);
+      memphis_map_free (map);
+      return;
+    }
 
   if (priv->map)
     memphis_map_free (priv->map);
diff --git a/champlain/champlain-memphis-tile-source.c b/champlain/champlain-memphis-tile-source.c
index eb0fb98..d87e104 100644
--- a/champlain/champlain-memphis-tile-source.c
+++ b/champlain/champlain-memphis-tile-source.c
@@ -241,7 +241,7 @@ champlain_memphis_tile_source_init (ChamplainMemphisTileSource *tile_source)
 
   priv->rules = memphis_rule_set_new ();
   memphis_rule_set_load_from_data (priv->rules, default_rules,
-      strlen (default_rules));
+      strlen (default_rules), NULL);
 
   priv->renderer = memphis_renderer_new_full (priv->rules, memphis_map_new ());
 
@@ -538,13 +538,25 @@ champlain_memphis_tile_source_load_rules (
     }
 
   ChamplainMemphisTileSourcePrivate *priv = tile_source->priv;
+  GError *err = NULL;
 
   g_static_rw_lock_writer_lock (&MemphisLock);
   if (rules_path)
-    memphis_rule_set_load_from_file (priv->rules, rules_path);
+    {
+      memphis_rule_set_load_from_file (priv->rules, rules_path, &err);
+      if (err != NULL)
+       {
+          g_critical ("Can't load rules file: \"%s\"", err->message);
+          memphis_rule_set_load_from_data (priv->rules, default_rules,
+                                           strlen (default_rules), NULL);
+          g_static_rw_lock_writer_unlock (&MemphisLock);
+          return;
+       }
+    }
   else
     memphis_rule_set_load_from_data (priv->rules, default_rules,
-                                     strlen (default_rules));
+                                     strlen (default_rules), NULL);
+
   g_static_rw_lock_writer_unlock (&MemphisLock);
 
   reload_tiles (tile_source);
diff --git a/champlain/champlain-network-map-data-source.c b/champlain/champlain-network-map-data-source.c
index 5e3758d..c9f64b2 100644
--- a/champlain/champlain-network-map-data-source.c
+++ b/champlain/champlain-network-map-data-source.c
@@ -237,6 +237,7 @@ load_map_data_cb (SoupSession *session, SoupMessage *msg,
       CHAMPLAIN_NETWORK_MAP_DATA_SOURCE (user_data);
   ChamplainNetworkMapDataSourcePrivate *priv = self->priv;
   ChamplainBoundingBox *bbox;
+  GError *err = NULL;
 
   if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code))
     {
@@ -252,10 +253,18 @@ load_map_data_cb (SoupSession *session, SoupMessage *msg,
   MemphisMap *map = memphis_map_new ();
   memphis_map_load_from_data (map,
       msg->response_body->data,
-      msg->response_body->length);
+      msg->response_body->length,
+      &err);
 
   DEBUG ("BBox data received");
 
+  if (err != NULL)
+    {
+      g_critical ("Can't load map data: \"%s\"", err->message);
+      memphis_map_free (map);
+      return;
+    }
+
   if (priv->map)
     memphis_map_free (priv->map);
 
diff --git a/configure.ac b/configure.ac
index 1c434c2..70e81a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,7 +55,7 @@ PKG_CHECK_MODULES(DEPS,
       cairo >= 1.4,
       gio-2.0 >= 2.16,
       sqlite3 >= 3.0,
-      memphis-0.1 >= 0.1
+      memphis-0.2 >= 0.2
   ]
 )
 # check for gtk-doc
@@ -120,7 +120,7 @@ if test x$enable_gtk = xyes; then
   PKG_CHECK_MODULES(GTK_DEPS,
     [   gtk+-2.0 >= 2.12,
         clutter-gtk-0.10 >= 0.10,
-        memphis-0.1 >= 0.1
+        memphis-0.2 >= 0.2
     ]
   )
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]