- *cmd = g_strdup_printf( GOOGLE_DIRECTIONS_STRING, gtk_entry_get_text ( GTK_ENTRY(widgets->from_entry) ), gtk_entry_get_text ( GTK_ENTRY(widgets->to_entry) ) );
- *input_type = g_strdup("google");
+ gchar *from_quoted, *to_quoted;
+ gchar **from_split, **to_split;
+ from_quoted = g_shell_quote ( gtk_entry_get_text ( GTK_ENTRY(widgets->from_entry) ) );
+ to_quoted = g_shell_quote ( gtk_entry_get_text ( GTK_ENTRY(widgets->to_entry) ) );
+
+ from_split = g_strsplit( from_quoted, " ", 0);
+ to_split = g_strsplit( to_quoted, " ", 0);
+ from_quoted = g_strjoinv( "%20", from_split);
+ to_quoted = g_strjoinv( "%20", to_split);
+
+ *cmd = g_strdup_printf( GOOGLE_DIRECTIONS_STRING, from_quoted, to_quoted );
+ *input_file_type = g_strdup("kml");
+
+ g_free(last_from_str);
+ g_free(last_to_str);
+
+ last_from_str = g_strdup( gtk_entry_get_text ( GTK_ENTRY(widgets->from_entry) ));
+ last_to_str = g_strdup( gtk_entry_get_text ( GTK_ENTRY(widgets->to_entry) ));
+
+ g_free(from_quoted);
+ g_free(to_quoted);
+ g_strfreev(from_split);
+ g_strfreev(to_split);