]> git.street.me.uk Git - andy/viking.git/commitdiff
Extend Routing functions for UI reuse.
authorMatthew Hague <matthewhague@zoho.com>
Wed, 5 Feb 2014 00:05:13 +0000 (00:05 +0000)
committerRob Norris <rw_norris@hotmail.com>
Wed, 5 Feb 2014 00:34:41 +0000 (00:34 +0000)
Made vik_routing_default_find return whether find was successful or not, and exposed vik_routing_default_engine via vikrouting.h to allow the route planner to display the name of the engine it's using

src/vikrouting.c
src/vikrouting.h

index 9e66a24d8dbba766699717f9021e7354bca4f3e0..da73ae7ffdf4f3ce9c418a9eee66ad5849026820 100644 (file)
@@ -109,7 +109,7 @@ vik_routing_find_engine ( const gchar *id )
  * 
  * Returns: the default engine
  */
-static VikRoutingEngine *
+VikRoutingEngine *
 vik_routing_default_engine ( void )
 {
   const gchar *id = a_preferences_get ( VIKING_ROUTING_PARAMS_NAMESPACE "default")->s;
@@ -125,14 +125,16 @@ vik_routing_default_engine ( void )
  * vik_routing_default_find:
  * 
  * Route computation with default engine.
+ *
+ * Return indicates success or not
  */
-void
+gboolean
 vik_routing_default_find(VikTrwLayer *vt, struct LatLon start, struct LatLon end)
 {
   /* The engine */
   VikRoutingEngine *engine = vik_routing_default_engine ( );
   /* The route computation */
-  vik_routing_engine_find ( engine, vt, start, end );
+  return (gboolean)vik_routing_engine_find ( engine, vt, start, end );
 }
 
 /**
index 8e9aa2d56f0c0b9db724f2c0a8c88f48d502bd62..870d1ecf4aec526fd0332beb4d19cf359d8b27ea 100644 (file)
@@ -28,7 +28,7 @@
 G_BEGIN_DECLS
 
 /* Default */
-void vik_routing_default_find ( VikTrwLayer *vt, struct LatLon start, struct LatLon end );
+gboolean vik_routing_default_find ( VikTrwLayer *vt, struct LatLon start, struct LatLon end );
 
 /* Routing engines management */
 void vik_routing_prefs_init();
@@ -41,6 +41,10 @@ typedef gboolean (*Predicate)( gpointer data, gpointer user_data );
 GtkWidget *vik_routing_ui_selector_new ( Predicate func, gpointer user_data );
 VikRoutingEngine *vik_routing_ui_selector_get_nth ( GtkWidget *combo, int pos );
 
+/* Needs to be visible to display info about which routing engine is getting the route in viktrwlayer.c  */
+VikRoutingEngine * vik_routing_default_engine ( void );
+
+
 G_END_DECLS
 
 #endif