Beispiel #1
0
void a_vik_goto(VikWindow *vw, VikViewport *vvp)
{
  VikCoord new_center;
  gchar *s_str;
  gboolean more = TRUE;

  if (goto_tools_list == NULL)
  {
    /* Empty list */
    display_no_tool(vw);
    return;
  }

  do {
    s_str = a_prompt_for_goto_string(vw);
    if ((!s_str) || (s_str[0] == 0)) {
      more = FALSE;
    }

    else if (!vik_goto_tool_get_coord(g_list_nth_data (goto_tools_list, last_goto_tool), vw, vvp, s_str, &new_center)) {
      if (last_coord)
        g_free(last_coord);
      last_coord = g_malloc(sizeof(VikCoord));
      *last_coord = new_center;
      if (last_successful_goto_str)
        g_free(last_successful_goto_str);
      last_successful_goto_str = g_strdup(last_goto_str);
      vik_viewport_set_center_coord(vvp, &new_center, TRUE);
      more = FALSE;
    }
    else if (!prompt_try_again(vw))
        more = FALSE;
    g_free(s_str);
  } while (more);
}
Beispiel #2
0
/**
 * Goto a place when we already have a string to search on
 *
 * Returns: %TRUE if a successful lookup
 */
static gboolean vik_goto_place ( VikWindow *vw, VikViewport *vvp, gchar* name, VikCoord *vcoord )
{
  // Ensure last_goto_tool is given a value
  get_provider ();

  if ( goto_tools_list ) {
    VikGotoTool *gototool = g_list_nth_data ( goto_tools_list, last_goto_tool );
    if ( gototool ) {
      if ( vik_goto_tool_get_coord ( gototool, vw, vvp, name, vcoord ) == 0 )
        return TRUE;
    }
  }
  return FALSE;
}
Beispiel #3
0
void a_vik_goto(VikWindow *vw, VikViewport *vvp)
{
  VikCoord new_center;
  gchar *s_str;
  gboolean more = TRUE;

  if (goto_tools_list == NULL)
  {
    /* Empty list */
    display_no_tool(vw);
    return;
  }

  do {
    s_str = a_prompt_for_goto_string(vw);
    if ((!s_str) || (s_str[0] == 0)) {
      more = FALSE;
    }
    else {
      int ans = vik_goto_tool_get_coord(g_list_nth_data (goto_tools_list, last_goto_tool), vw, vvp, s_str, &new_center);
      if ( ans == 0 ) {
        if (last_coord)
          g_free(last_coord);
        last_coord = g_malloc(sizeof(VikCoord));
        *last_coord = new_center;
        if (last_successful_goto_str)
          g_free(last_successful_goto_str);
        last_successful_goto_str = g_strdup(last_goto_str);
        vik_viewport_set_center_coord(vvp, &new_center, TRUE);
        more = FALSE;
      }
      else if ( ans == -1 ) {
        if (!prompt_try_again(vw, _("I don't know that place. Do you want another goto?")))
          more = FALSE;
      }
      else if (!prompt_try_again(vw, _("Service request failure. Do you want another goto?")))
        more = FALSE;
    }
    g_free(s_str);
  } while (more);
}