static void goto_tool_finalize ( GObject *gob );
static gchar *goto_tool_get_label ( VikGotoTool *vw );
-static DownloadMapOptions *goto_tool_get_download_options ( VikGotoTool *self );
+static DownloadFileOptions *goto_tool_get_download_options ( VikGotoTool *self );
typedef struct _VikGotoToolPrivate VikGotoToolPrivate;
return g_strdup ( priv->label );
}
-static DownloadMapOptions *goto_tool_get_download_options ( VikGotoTool *self )
+static DownloadFileOptions *goto_tool_get_download_options ( VikGotoTool *self )
{
// Default: return NULL
return NULL;
return VIK_GOTO_TOOL_GET_CLASS( self )->get_url_format( self );
}
-DownloadMapOptions *vik_goto_tool_get_download_options ( VikGotoTool *self )
+DownloadFileOptions *vik_goto_tool_get_download_options ( VikGotoTool *self )
{
return VIK_GOTO_TOOL_GET_CLASS( self )->get_download_options( self );
}
return VIK_GOTO_TOOL_GET_CLASS( self )->parse_file_for_latlon( self, filename, ll );
}
+/**
+ * vik_goto_tool_get_coord:
+ *
+ * @self: The #VikGotoTool
+ * @vvp: The #VikViewport
+ * @srch_str: The string to search with
+ * @coord: Returns the top match position for a successful search
+ *
+ * Returns: An integer value indicating:
+ * 0 = search found something
+ * -1 = search place not found by the #VikGotoTool
+ * 1 = search unavailable in the #VikGotoTool due to communication issue
+ *
+ */
int vik_goto_tool_get_coord ( VikGotoTool *self, VikWindow *vw, VikViewport *vvp, gchar *srch_str, VikCoord *coord )
{
gchar *tmpname;
tmpname = a_download_uri_to_tmp_file ( uri, vik_goto_tool_get_download_options(self) );
+ if ( !tmpname ) {
+ // Some kind of download error, so no tmp file
+ ret = 1;
+ goto done_no_file;
+ }
+
g_debug("%s: %s", __FILE__, tmpname);
if (!vik_goto_tool_parse_file_for_latlon(self, tmpname, &ll)) {
ret = -1;
vik_coord_load_from_latlon ( coord, vik_viewport_get_coord_mode(vvp), &ll );
done:
+ (void)util_remove(tmpname);
+done_no_file:
+ g_free(tmpname);
g_free(escaped_srch_str);
g_free(uri);
- util_remove(tmpname);
- g_free(tmpname);
return ret;
}