#include "viking.h"
#include "util.h"
-#include "curl_download.h"
-
#include "vikgototool.h"
+#include "vikgoto.h"
static gchar *last_goto_str = NULL;
static VikCoord *last_coord = NULL;
void vik_goto_register ( VikGotoTool *tool )
{
- IS_VIK_GOTO_TOOL( tool );
-
- goto_tools_list = g_list_append ( goto_tools_list, g_object_ref ( tool ) );
+ if ( IS_VIK_GOTO_TOOL( tool ) )
+ goto_tools_list = g_list_append ( goto_tools_list, g_object_ref ( tool ) );
}
void vik_goto_unregister_all ()
gtk_window_set_title(GTK_WINDOW(dialog), _("goto"));
GtkWidget *goto_label = gtk_label_new(_("I don't know that place. Do you want another goto?"));
- gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), goto_label, FALSE, FALSE, 5 );
+ gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), goto_label, FALSE, FALSE, 5 );
gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT );
gtk_widget_show_all(dialog);
gtk_window_set_title(GTK_WINDOW(dialog), _("goto"));
GtkWidget *tool_label = gtk_label_new(_("goto provider:"));
- GtkWidget *tool_list = gtk_combo_box_new_text ();
-
+ GtkWidget *tool_list = vik_combo_box_text_new ();
GList *current = g_list_first (goto_tools_list);
while (current != NULL)
{
char *label = NULL;
VikGotoTool *tool = current->data;
label = vik_goto_tool_get_label (tool);
- gtk_combo_box_append_text ( GTK_COMBO_BOX( tool_list ), label);
+ vik_combo_box_text_append ( tool_list, label );
current = g_list_next (current);
}
/* Set the previously selected provider as default */
if (last_goto_str)
gtk_entry_set_text(GTK_ENTRY(goto_entry), last_goto_str);
- gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), tool_label, FALSE, FALSE, 5 );
- gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), tool_list, FALSE, FALSE, 5 );
- gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), goto_label, FALSE, FALSE, 5 );
- gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), goto_entry, FALSE, FALSE, 5 );
+ // 'ok' when press return in the entry
+ g_signal_connect_swapped (goto_entry, "activate", G_CALLBACK(a_dialog_response_accept), dialog);
+
+ gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), tool_label, FALSE, FALSE, 5 );
+ gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), tool_list, FALSE, FALSE, 5 );
+ gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), goto_label, FALSE, FALSE, 5 );
+ gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), goto_entry, FALSE, FALSE, 5 );
gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT );
gtk_widget_show_all(dialog);
+ // Ensure the text field has focus so we can start typing straight away
+ gtk_widget_grab_focus ( goto_entry );
+
if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) != GTK_RESPONSE_ACCEPT ) {
gtk_widget_destroy(dialog);
return NULL;