X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/078aa316386d910546c6acadb914d0e252c8ee42..3e9ca23e1344df0bd26ba826048f41bf136ddc1f:/src/dialog.c diff --git a/src/dialog.c b/src/dialog.c index fbcdf101..a3c4bdba 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -19,10 +19,24 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "viking.h" #include "thumbnails.h" #include "garminsymbols.h" #include "degrees_converters.h" +#include "authors.h" +#ifdef VIK_CONFIG_GOOGLE +#include "googlesearch.h" +#endif +#ifdef VIK_CONFIG_GEONAMES +#include "geonamessearch.h" +#endif +#include "util.h" + +#include #include #include @@ -37,7 +51,7 @@ void a_dialog_msg ( GtkWindow *parent, gint type, const gchar *info, const gchar gboolean a_dialog_goto_latlon ( GtkWindow *parent, struct LatLon *ll, const struct LatLon *old ) { - GtkWidget *dialog = gtk_dialog_new_with_buttons ("Go to Lat/Lon", + GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Go to Lat/Lon"), parent, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, @@ -49,13 +63,13 @@ gboolean a_dialog_goto_latlon ( GtkWindow *parent, struct LatLon *ll, const stru GtkWidget *lat, *lon; gchar *tmp_lat, *tmp_lon; - latlabel = gtk_label_new ("Latitude:"); + latlabel = gtk_label_new (_("Latitude:")); lat = gtk_entry_new (); tmp_lat = g_strdup_printf ( "%f", old->lat ); gtk_entry_set_text ( GTK_ENTRY(lat), tmp_lat ); g_free ( tmp_lat ); - lonlabel = gtk_label_new ("Longitude:"); + lonlabel = gtk_label_new (_("Longitude:")); lon = gtk_entry_new (); tmp_lon = g_strdup_printf ( "%f", old->lon ); gtk_entry_set_text ( GTK_ENTRY(lon), tmp_lon ); @@ -85,7 +99,7 @@ gboolean a_dialog_goto_latlon ( GtkWindow *parent, struct LatLon *ll, const stru gboolean a_dialog_goto_utm ( GtkWindow *parent, struct UTM *utm, const struct UTM *old ) { - GtkWidget *dialog = gtk_dialog_new_with_buttons ("Go to Lat/Lon", + GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Go to Lat/Lon"), parent, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, @@ -98,23 +112,23 @@ gboolean a_dialog_goto_utm ( GtkWindow *parent, struct UTM *utm, const struct UT gchar *tmp_eas, *tmp_nor; gchar tmp_letter[2]; - norlabel = gtk_label_new ("Northing:"); + norlabel = gtk_label_new (_("Northing:")); nor = gtk_entry_new (); tmp_nor = g_strdup_printf("%ld", (long) old->northing ); gtk_entry_set_text ( GTK_ENTRY(nor), tmp_nor ); g_free ( tmp_nor ); - easlabel = gtk_label_new ("Easting:"); + easlabel = gtk_label_new (_("Easting:")); eas = gtk_entry_new (); tmp_eas = g_strdup_printf("%ld", (long) old->easting ); gtk_entry_set_text ( GTK_ENTRY(eas), tmp_eas ); g_free ( tmp_eas ); zonehbox = gtk_hbox_new ( FALSE, 0 ); - gtk_box_pack_start ( GTK_BOX(zonehbox), gtk_label_new ( "Zone:" ), FALSE, FALSE, 5 ); + gtk_box_pack_start ( GTK_BOX(zonehbox), gtk_label_new ( _("Zone:") ), FALSE, FALSE, 5 ); zonespin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( old->zone, 1, 60, 1, 5, 5 ), 1, 0 ); gtk_box_pack_start ( GTK_BOX(zonehbox), zonespin, TRUE, TRUE, 5 ); - gtk_box_pack_start ( GTK_BOX(zonehbox), gtk_label_new ( "Letter:" ), FALSE, FALSE, 5 ); + gtk_box_pack_start ( GTK_BOX(zonehbox), gtk_label_new ( _("Letter:") ), FALSE, FALSE, 5 ); letterentry = gtk_entry_new (); gtk_entry_set_max_length ( GTK_ENTRY(letterentry), 1 ); gtk_entry_set_width_chars ( GTK_ENTRY(letterentry), 2 ); @@ -158,10 +172,24 @@ void a_dialog_response_accept ( GtkDialog *dialog ) gtk_dialog_response ( dialog, GTK_RESPONSE_ACCEPT ); } +static void symbol_entry_changed_cb(GtkWidget *combo, GtkListStore *store) +{ + GtkTreeIter iter; + gchar *sym; + + if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo), &iter)) + return; + + gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, (void *)&sym, -1 ); + /* Note: symm is NULL when "(none)" is select (first cell is empty) */ + gtk_widget_set_tooltip_text(combo, sym); + g_free(sym); +} + /* todo: less on this side, like add track */ gboolean a_dialog_new_waypoint ( GtkWindow *parent, gchar **dest, VikWaypoint *wp, GHashTable *waypoints, VikCoordMode coord_mode ) { - GtkWidget *dialog = gtk_dialog_new_with_buttons ("Create", + GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Waypoint Properties"), parent, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, @@ -170,7 +198,7 @@ gboolean a_dialog_new_waypoint ( GtkWindow *parent, gchar **dest, VikWaypoint *w GTK_RESPONSE_ACCEPT, NULL); struct LatLon ll; - GtkWidget *latlabel, *lonlabel, *namelabel, *latentry, *lonentry, *altentry, *altlabel, *nameentry, *commentlabel, + GtkWidget *latlabel, *lonlabel, *namelabel, *latentry, *lonentry, *altentry, *altlabel, *nameentry=NULL, *commentlabel, *commententry, *imagelabel, *imageentry, *symbollabel, *symbolentry; GtkListStore *store; @@ -187,44 +215,62 @@ gboolean a_dialog_new_waypoint ( GtkWindow *parent, gchar **dest, VikWaypoint *w if ( dest != NULL ) { - namelabel = gtk_label_new ("Name:"); + namelabel = gtk_label_new (_("Name:")); nameentry = gtk_entry_new (); + if ( *dest ) { + gtk_entry_set_text( GTK_ENTRY(nameentry), *dest ); + g_free ( *dest ); + *dest = NULL; + } g_signal_connect_swapped ( nameentry, "activate", G_CALLBACK(a_dialog_response_accept), GTK_DIALOG(dialog) ); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), namelabel, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), nameentry, FALSE, FALSE, 0); } - latlabel = gtk_label_new ("Latitude:"); + latlabel = gtk_label_new (_("Latitude:")); latentry = gtk_entry_new (); gtk_entry_set_text ( GTK_ENTRY(latentry), lat ); g_free ( lat ); - lonlabel = gtk_label_new ("Longitude:"); + lonlabel = gtk_label_new (_("Longitude:")); lonentry = gtk_entry_new (); gtk_entry_set_text ( GTK_ENTRY(lonentry), lon ); g_free ( lon ); - altlabel = gtk_label_new ("Altitude:"); + altlabel = gtk_label_new (_("Altitude:")); altentry = gtk_entry_new (); gtk_entry_set_text ( GTK_ENTRY(altentry), alt ); g_free ( alt ); - commentlabel = gtk_label_new ("Comment:"); + commentlabel = gtk_label_new (_("Comment:")); commententry = gtk_entry_new (); - - imagelabel = gtk_label_new ("Image:"); - imageentry = vik_file_entry_new (); + gchar *cmt = NULL; +#if defined(VIK_CONFIG_GOOGLE) && VIK_CONFIG_SEARCH==VIK_CONFIG_SEARCH_GOOGLE + //if (strcmp(VIK_CONFIG_SEARCH,"google")) + cmt = a_googlesearch_get_search_string_for_this_place(VIK_WINDOW(parent)); +#endif +#if defined(VIK_CONFIG_GEONAMES) && VIK_CONFIG_SEARCH==VIK_CONFIG_SEARCH_GEONAMES + //if (strcmp(VIK_CONFIG_SEARCH,"geonames")) + cmt = a_geonamessearch_get_search_string_for_this_place(VIK_WINDOW(parent)); +#endif + if (cmt) + gtk_entry_set_text(GTK_ENTRY(commententry), cmt); + + imagelabel = gtk_label_new (_("Image:")); + imageentry = vik_file_entry_new (GTK_FILE_CHOOSER_ACTION_OPEN); { GtkCellRenderer *r; - symbollabel = gtk_label_new ("Symbol:"); + symbollabel = gtk_label_new (_("Symbol:")); GtkTreeIter iter; store = gtk_list_store_new(3, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING); symbolentry = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); - gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(symbolentry), 3); + gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(symbolentry), 6); + g_signal_connect(symbolentry, "changed", + G_CALLBACK(symbol_entry_changed_cb), store); gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, 0, NULL, 1, NULL, 2, "(none)", -1); + gtk_list_store_set (store, &iter, 0, NULL, 1, NULL, 2, _("(none)"), -1); a_populate_sym_list(store); r = gtk_cell_renderer_pixbuf_new (); @@ -279,15 +325,11 @@ gboolean a_dialog_new_waypoint ( GtkWindow *parent, gchar **dest, VikWaypoint *w { const gchar *constname = gtk_entry_get_text ( GTK_ENTRY(nameentry) ); if ( strlen(constname) == 0 ) /* TODO: other checks (isalpha or whatever ) */ - a_dialog_info_msg ( parent, "Please enter a name for the waypoint." ); + a_dialog_info_msg ( parent, _("Please enter a name for the waypoint.") ); else { - int i; gchar *name = g_strdup ( constname ); - for ( i = strlen ( name ) - 1; i >= 0; i-- ) - name[i] = toupper(name[i]); /* all caps for stardandization */ - - if ( g_hash_table_lookup ( waypoints, name ) && !a_dialog_overwrite ( parent, "The waypoint \"%s\" exists, do you want to overwrite it?", name ) ) + if ( g_hash_table_lookup ( waypoints, name ) && !a_dialog_overwrite ( parent, _("The waypoint \"%s\" exists, do you want to overwrite it?"), name ) ) g_free ( name ); else { @@ -357,9 +399,75 @@ gboolean a_dialog_new_waypoint ( GtkWindow *parent, gchar **dest, VikWaypoint *w return FALSE; } +static void get_selected_foreach_func(GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data) +{ + GList **list = data; + gchar *name; + gtk_tree_model_get (model, iter, 0, &name, -1); + *list = g_list_prepend(*list, name); +} + +GList *a_dialog_select_from_list ( GtkWindow *parent, GHashTable *tracks, GList *track_names, gboolean multiple_selection_allowed, const gchar *title, const gchar *msg ) +{ + GtkTreeIter iter; + GtkCellRenderer *renderer; + GtkWidget *view; + + GtkWidget *dialog = gtk_dialog_new_with_buttons (title, + parent, + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CANCEL, + GTK_RESPONSE_REJECT, + GTK_STOCK_OK, + GTK_RESPONSE_ACCEPT, + NULL); + GtkWidget *label = gtk_label_new ( msg ); + GtkListStore *store = gtk_list_store_new(1, G_TYPE_STRING); + + GList *track_runner = track_names; + while (track_runner) + { + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, 0, track_runner->data, -1); + track_runner = g_list_next(track_runner); + } + + view = gtk_tree_view_new(); + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(view), -1, NULL, renderer, "text", 0, NULL); + gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(store)); + gtk_tree_view_set_headers_visible( GTK_TREE_VIEW(view), FALSE); + gtk_tree_selection_set_mode( gtk_tree_view_get_selection(GTK_TREE_VIEW(view)), + multiple_selection_allowed ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_BROWSE ); + g_object_unref(store); + + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), label, FALSE, FALSE, 0); + gtk_widget_show ( label ); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), view, FALSE, FALSE, 0); + gtk_widget_show ( view ); + + while ( gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT ) + { + GList *names = NULL; + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); + gtk_tree_selection_selected_foreach(selection, get_selected_foreach_func, &names); + if (names) + { + gtk_widget_destroy ( dialog ); + return (names); + } + a_dialog_error_msg(parent, _("Nothing was selected")); + } + gtk_widget_destroy ( dialog ); + return NULL; +} + gchar *a_dialog_new_track ( GtkWindow *parent, GHashTable *tracks ) { - GtkWidget *dialog = gtk_dialog_new_with_buttons ("Add Track", + GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Add Track"), parent, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, @@ -367,7 +475,7 @@ gchar *a_dialog_new_track ( GtkWindow *parent, GHashTable *tracks ) GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - GtkWidget *label = gtk_label_new ( "Track Name:" ); + GtkWidget *label = gtk_label_new ( _("Track Name:") ); GtkWidget *entry = gtk_entry_new (); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), label, FALSE, FALSE, 0); @@ -382,15 +490,11 @@ gchar *a_dialog_new_track ( GtkWindow *parent, GHashTable *tracks ) { const gchar *constname = gtk_entry_get_text ( GTK_ENTRY(entry) ); if ( *constname == '\0' ) - a_dialog_info_msg ( parent, "Please enter a name for the track." ); + a_dialog_info_msg ( parent, _("Please enter a name for the track.") ); else { gchar *name = g_strdup ( constname ); - gint i; - - for ( i = strlen ( name ) - 1; i >= 0; i-- ) - name[i] = toupper(name[i]); /* all caps for stardandization */ - if ( g_hash_table_lookup( tracks, name ) && !a_dialog_overwrite ( parent, "The track \"%s\" exists, do you want to overwrite it?", gtk_entry_get_text ( GTK_ENTRY(entry) ) ) ) + if ( g_hash_table_lookup( tracks, name ) && !a_dialog_overwrite ( parent, _("The track \"%s\" exists, do you want to overwrite it?"), gtk_entry_get_text ( GTK_ENTRY(entry) ) ) ) { g_free ( name ); } @@ -415,7 +519,7 @@ GtkWidget *a_dialog_create_label_vbox ( gchar **texts, int label_count ) for ( i = 0; i < label_count; i++ ) { label = gtk_label_new(NULL); - gtk_label_set_markup ( GTK_LABEL(label), texts[i] ); + gtk_label_set_markup ( GTK_LABEL(label), _(texts[i]) ); gtk_box_pack_start ( GTK_BOX(vbox), label, FALSE, TRUE, 5 ); } return vbox; @@ -452,7 +556,7 @@ static void zoom_spin_changed ( GtkSpinButton *spin, GtkWidget *pass_along[3] ) gboolean a_dialog_custom_zoom ( GtkWindow *parent, gdouble *xmpp, gdouble *ympp ) { - GtkWidget *dialog = gtk_dialog_new_with_buttons ("Zoom Factors...", + GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Zoom Factors..."), parent, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, @@ -466,14 +570,14 @@ gboolean a_dialog_custom_zoom ( GtkWindow *parent, gdouble *xmpp, gdouble *ympp table = gtk_table_new ( 4, 2, FALSE ); gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), table, TRUE, TRUE, 0 ); - label = gtk_label_new ( "Zoom factor (in meters per pixel:" ); - xlabel = gtk_label_new ( "X (easting): "); - ylabel = gtk_label_new ( "Y (northing): "); + label = gtk_label_new ( _("Zoom factor (in meters per pixel:") ); + xlabel = gtk_label_new ( _("X (easting): ")); + ylabel = gtk_label_new ( _("Y (northing): ")); pass_along[0] = xspin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( *xmpp, VIK_VIEWPORT_MIN_ZOOM, VIK_VIEWPORT_MAX_ZOOM, 1, 5, 5 ), 1, 8 ); pass_along[1] = yspin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( *ympp, VIK_VIEWPORT_MIN_ZOOM, VIK_VIEWPORT_MAX_ZOOM, 1, 5, 5 ), 1, 8 ); - pass_along[2] = samecheck = gtk_check_button_new_with_label ( "X and Y zoom factors must be equal" ); + pass_along[2] = samecheck = gtk_check_button_new_with_label ( _("X and Y zoom factors must be equal") ); /* TODO -- same factor */ /* samecheck = gtk_check_button_new_with_label ( "Same x/y zoom factor" ); */ @@ -526,10 +630,10 @@ gboolean a_dialog_time_threshold ( GtkWindow *parent, gchar *title_text, gchar * label = gtk_label_new (label_text); - t1 = gtk_radio_button_new_with_label ( NULL, "1 min" ); - t2 = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(t1), "1 hour" ); - t3 = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(t2), "1 day" ); - t4 = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(t3), "Custom (in minutes):" ); + t1 = gtk_radio_button_new_with_label ( NULL, _("1 min") ); + t2 = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(t1), _("1 hour") ); + t3 = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(t2), _("1 day") ); + t4 = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(t3), _("Custom (in minutes):") ); pass_along[0] = t4; @@ -564,37 +668,28 @@ gboolean a_dialog_time_threshold ( GtkWindow *parent, gchar *title_text, gchar * return FALSE; } +static void about_url_hook (GtkAboutDialog *about, + const gchar *link, + gpointer data) +{ + open_url (GTK_WINDOW(about), link); +} + +static void about_email_hook (GtkAboutDialog *about, + const gchar *email, + gpointer data) +{ + new_email (GTK_WINDOW(about), email); +} void a_dialog_about ( GtkWindow *parent ) { - int re; - GtkWidget *msgbox = gtk_message_dialog_new_with_markup ( parent, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_NONE, - "Viking 0.1.1\n\n" - "GPS Data and Topo Analyzer, Explorer, and Manager.\n\n" - "(C) 2003-2006, Evan Battaglia" - ); - - gtk_dialog_add_buttons (GTK_DIALOG(msgbox), "Credits", 1, "License", 2, "Close", 3, NULL, NULL); - - while ((re = gtk_dialog_run ( GTK_DIALOG(msgbox))) != 3) { - if (re==1) { - /* creds */ - a_dialog_info_msg(parent, - "Author:\n" - " Evan Battaglia \n\n" - "Contributors:\n" - " Alex Foobarian \n" - " Guilhem Bonnefille \n" - " Quy Tonthat \n" - " Reid Priedhorsky \n" - ); - } - if (re==2) { - a_dialog_info_msg(parent, "\n\n" - "This program is free software; you can redistribute it and/or modify " + const gchar *program_name = PACKAGE_NAME; + const gchar *version = VIKING_VERSION; + const gchar *website = VIKING_URL; + const gchar *copyright = "2003-2008, Evan Battaglia"; + const gchar *comments = _("GPS Data and Topo Analyzer, Explorer, and Manager."); + const gchar *license = _("This program is free software; you can redistribute it and/or modify " "it under the terms of the GNU General Public License as published by " "the Free Software Foundation; either version 2 of the License, or " "(at your option) any later version." @@ -607,7 +702,57 @@ void a_dialog_about ( GtkWindow *parent ) "You should have received a copy of the GNU General Public License " "along with this program; if not, write to the Free Software " "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA"); - } + + gtk_about_dialog_set_url_hook (about_url_hook, NULL, NULL); + gtk_about_dialog_set_email_hook (about_email_hook, NULL, NULL); + gtk_show_about_dialog (parent, + /* TODO do not set program-name and correctly set info for g_get_application_name */ + "program-name", program_name, + "version", version, + "website", website, + "comments", comments, + "copyright", copyright, + "license", license, + "wrap-license", TRUE, + /* logo automatically retrieved via gtk_window_get_default_icon_list */ + "authors", AUTHORS, + NULL); +} + +gboolean a_dialog_map_n_zoom(GtkWindow *parent, gchar *mapnames[], gint default_map, gchar *zoom_list[], gint default_zoom, gint *selected_map, gint *selected_zoom) +{ + gchar **s; + + GtkWidget *dialog = gtk_dialog_new_with_buttons ( _("Download along track"), parent, 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL ); + + GtkWidget *map_label = gtk_label_new(_("Map type:")); + GtkComboBox *map_combo = GTK_COMBO_BOX(gtk_combo_box_new_text()); + for (s = mapnames; *s; s++) + gtk_combo_box_append_text(map_combo, *s); + gtk_combo_box_set_active (map_combo, default_map); + GtkWidget *zoom_label = gtk_label_new(_("Zoom level:")); + GtkComboBox *zoom_combo = GTK_COMBO_BOX(gtk_combo_box_new_text()); + for (s = zoom_list; *s; s++) + gtk_combo_box_append_text(zoom_combo, *s); + gtk_combo_box_set_active (zoom_combo, default_zoom); + + GtkTable *box = GTK_TABLE(gtk_table_new(2, 2, FALSE)); + gtk_table_attach_defaults(box, GTK_WIDGET(map_label), 0, 1, 0, 1); + gtk_table_attach_defaults(box, GTK_WIDGET(map_combo), 1, 2, 0, 1); + gtk_table_attach_defaults(box, GTK_WIDGET(zoom_label), 0, 1, 1, 2); + gtk_table_attach_defaults(box, GTK_WIDGET(zoom_combo), 1, 2, 1, 2); + + gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), GTK_WIDGET(box), FALSE, FALSE, 5 ); + + gtk_widget_show_all ( dialog ); + if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) != GTK_RESPONSE_ACCEPT ) { + gtk_widget_destroy(dialog); + return FALSE; } - gtk_widget_destroy ( msgbox ); + + *selected_map = gtk_combo_box_get_active(map_combo); + *selected_zoom = gtk_combo_box_get_active(zoom_combo); + + gtk_widget_destroy(dialog); + return TRUE; }