esac
AM_CONDITIONAL([REALTIME_GPS_TRACKING], [test x$ac_cv_enable_realtimegpstracking = xyes])
+AC_ARG_WITH(search,
+ [AC_HELP_STRING([--with-search],
+ [specify google or geonames for searching (default is google)])],
+ [case "x$withval" in
+ "xgoogle")
+ VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GOOGLE
+ ;;
+ "xgeonames")
+ VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GEONAMES
+ ;;
+ *)
+ AC_MSG_ERROR([Please, set a value for search method])
+ esac],
+ [VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GOOGLE])
+AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH_GOOGLE, 1,
+ [Id. for searching via GOOGLE])
+AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH_GEONAMES, 2,
+ [Id. for searching via GEONAMES])
+AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH, ${VIK_CONFIG_SEARCH},
+ [Method for the search])
+
+
AC_ARG_WITH(mapcache,
[AC_HELP_STRING([--with-mapcache],
[specify the size of the map cache (default is 50331648)])],
datasource_gc.c \
datasource_bfilter.c \
datasources.h \
+ googlesearch.c googlesearch.h \
dem.c dem.h \
vikdemlayer.h vikdemlayer.c \
vikfilelist.c vikfilelist.h \
#include "garminsymbols.h"
#include "degrees_converters.h"
#include "authors.h"
+#ifdef VIK_CONFIG_GOOGLE
+#include "googlesearch.h"
+#endif
+#ifdef VIK_CONFIG_GEONAMES
#include "geonamessearch.h"
+#endif
#include "util.h"
#include <glib/gi18n.h>
commentlabel = gtk_label_new (_("Comment:"));
commententry = gtk_entry_new ();
- gchar *cmt = a_geonamessearch_get_search_string_for_this_place(VIK_WINDOW(parent));
+ gchar *cmt = NULL;
+#if defined(VIK_CONFIG_GOOGLE) && VIK_CONFIG_SEARCH==VIK_CONFIG_SEARCH_GOOGLE
+ //if (strcmp(VIK_CONFIG_SEARCH,"google"))
+ cmt = a_googlesearch_get_search_string_for_this_place(VIK_WINDOW(parent));
+#endif
+#if defined(VIK_CONFIG_GEONAMES) && VIK_CONFIG_SEARCH==VIK_CONFIG_SEARCH_GEONAMES
+ //if (strcmp(VIK_CONFIG_SEARCH,"geonames"))
+ cmt = a_geonamessearch_get_search_string_for_this_place(VIK_WINDOW(parent));
+#endif
if (cmt)
gtk_entry_set_text(GTK_ENTRY(commententry), cmt);
#include <glib/gi18n.h>
#include "viking.h"
+#include "util.h"
#include "curl_download.h"
#define GEONAMES_WIKIPEDIA_URL_FMT "http://ws.geonames.org/wikipediaBoundingBoxJSON?formatted=true&north=%f&south=%f&east=%f&west=%f"
return (found);
}
-gchar *uri_escape(gchar *str)
-{
- gchar *esc_str = g_malloc(3*strlen(str));
- gchar *dst = esc_str;
- gchar *src;
-
- for (src = str; *src; src++) {
- if (*src == ' ')
- *dst++ = '+';
- else if (g_ascii_isalnum(*src))
- *dst++ = *src;
- else {
- g_sprintf(dst, "%%%02X", *src);
- dst += 3;
- }
- }
- *dst = '\0';
-
- return(esc_str);
-}
-
gchar *download_url(gchar *uri)
{
FILE *tmp_file;
/* Finding a named place */
extern void a_geonames_search(VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp);
gchar * a_geonamessearch_get_search_string_for_this_place(VikWindow *vw);
-gchar *uri_escape(gchar *str);
/* Finding Wikipedia entries within a certain box */
extern void a_geonames_wikipedia_box(VikWindow *vw, VikTrwLayer *vtl, VikLayersPanel *vlp, struct LatLon maxmin[2]);
#include <glib/gi18n.h>
#include "viking.h"
+#include "util.h"
#include "curl_download.h"
#define GOOGLE_SEARCH_URL_FMT "http://maps.google.com/maps?q=%s&output=js"
}
-gchar *uri_escape(gchar *str)
-{
- gchar *esc_str = g_malloc(3*strlen(str));
- gchar *dst = esc_str;
- gchar *src;
-
- for (src = str; *src; src++) {
- if (*src == ' ')
- *dst++ = '+';
- else if (g_ascii_isalnum(*src))
- *dst++ = *src;
- else {
- g_sprintf(dst, "%%%02X", *src);
- dst += 3;
- }
- }
- *dst = '\0';
-
- return(esc_str);
-}
-
static int google_search_get_coord(VikWindow *vw, VikViewport *vvp, gchar *srch_str, VikCoord *coord)
{
FILE *tmp_file;
extern void a_google_search(VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp);
gchar * a_googlesearch_get_search_string_for_this_place(VikWindow *vw);
-gchar *uri_escape(gchar *str);
#endif
#endif
" <menuitem action='ModeMercator'/>"
" <separator/>"
- " <menuitem action='GeoNamesSearch'/>"
+ " <menuitem action='GotoSearch'/>"
" <menuitem action='GotoLL'/>"
" <menuitem action='GotoUTM'/>"
" <separator/>"
" <separator/>"
" </placeholder>"
" <placeholder name='ViewToolItems'>"
- " <toolitem action='GeoNamesSearch'/>"
+ " <toolitem action='GotoSearch'/>"
" <separator/>"
" </placeholder>"
" <placeholder name='ToolItems'>"
g_free(uri);
uri = NULL;
}
+
+gchar *uri_escape(gchar *str)
+{
+ gchar *esc_str = g_malloc(3*strlen(str));
+ gchar *dst = esc_str;
+ gchar *src;
+
+ for (src = str; *src; src++) {
+ if (*src == ' ')
+ *dst++ = '+';
+ else if (g_ascii_isalnum(*src))
+ *dst++ = *src;
+ else {
+ g_sprintf(dst, "%%%02X", *src);
+ dst += 3;
+ }
+ }
+ *dst = '\0';
+
+ return(esc_str);
+}
+
void open_url(GtkWindow *parent, const gchar * url);
void new_email(GtkWindow *parent, const gchar * address);
+gchar *uri_escape(gchar *str);
+
#endif
#include "background.h"
#include "acquire.h"
#include "datasources.h"
+#ifdef VIK_CONFIG_GOOGLE
+#include "googlesearch.h"
+#endif
+#ifdef VIK_CONFIG_GEONAMES
#include "geonamessearch.h"
+#endif
#include "dems.h"
#include "print.h"
#include "preferences.h"
static void goto_address( GtkAction *a, VikWindow *vw)
{
+#if defined(VIK_CONFIG_GOOGLE) && VIK_CONFIG_SEARCH==VIK_CONFIG_SEARCH_GOOGLE
+ a_google_search(vw, vw->viking_vlp, vw->viking_vvp);
+#endif
+#if defined(VIK_CONFIG_GEONAMES) && VIK_CONFIG_SEARCH==VIK_CONFIG_SEARCH_GEONAMES
a_geonames_search(vw, vw->viking_vlp, vw->viking_vvp);
+#endif
+
}
static void preferences_cb ( GtkAction *a, VikWindow *vw )
{ "Exit", GTK_STOCK_QUIT, N_("E_xit"), "<control>W", N_("Exit the program"), (GCallback)window_close },
{ "SaveExit", GTK_STOCK_QUIT, N_("Save and Exit"), NULL, N_("Save and Exit the program"), (GCallback)save_file_and_exit },
- { "GeoNamesSearch", GTK_STOCK_JUMP_TO, N_("Go To GeoNames location"), NULL, N_("Go to address/place using GeoNames search"), (GCallback)goto_address },
+ { "GotoSearch", GTK_STOCK_JUMP_TO, N_("Go To location"), NULL, N_("Go to address/place using text search"), (GCallback)goto_address },
{ "GotoLL", GTK_STOCK_QUIT, N_("_Go to Lat\\/Lon..."), NULL, N_("Go to arbitrary lat\\/lon coordinate"), (GCallback)draw_goto_cb },
{ "GotoUTM", GTK_STOCK_QUIT, N_("Go to UTM..."), NULL, N_("Go to arbitrary UTM coordinate"), (GCallback)draw_goto_cb },
{ "SetBGColor",GTK_STOCK_SELECT_COLOR, N_("Set Background Color..."), NULL, NULL, (GCallback)set_bg_color },