#define GOOGLE_SEARCH_URL_FMT "http://maps.google.com/maps?q=%s&output=js"
#define GOOGLE_SEARCH_PATTERN_1 "{center:{lat:"
#define GOOGLE_SEARCH_PATTERN_2 ",lng:"
+#define GOOGLE_SEARCH_NOT_FOUND "around this map area did not match any locations"
static gchar *last_search_str = NULL;
static VikCoord *last_coord = NULL;
static gchar *last_successful_search_str = NULL;
-static DownloadOptions googlesearch_options = { 0, "http://maps.google.com/" };
+static DownloadOptions googlesearch_options = { "http://maps.google.com/", 0 };
gchar * a_googlesearch_get_search_string_for_this_place(VikWindow *vw)
{
len = g_mapped_file_get_length(mf);
text = g_mapped_file_get_contents(mf);
+ if (g_strstr_len(text, len, GOOGLE_SEARCH_NOT_FOUND) != NULL) {
+ found = FALSE;
+ goto done;
+ }
+
if ((pat = g_strstr_len(text, len, GOOGLE_SEARCH_PATTERN_1)) == NULL) {
found = FALSE;
goto done;
escaped_srch_str = uri_escape(srch_str);
- if ((tmp_fd = g_file_open_tmp (NULL, &tmpname, NULL)) == -1) {
+ if ((tmp_fd = g_file_open_tmp ("vikgsearch.XXXXXX", &tmpname, NULL)) == -1) {
g_critical("couldn't open temp file\n");
exit(1);
}