From: Kaj-Michael Lang Date: Fri, 6 Jun 2008 15:57:33 +0000 (+0300) Subject: Repo admin: cosmetic fixes X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6db547e7128fc6d36f1c25875e98696211976942;p=mapper Repo admin: cosmetic fixes --- diff --git a/src/map-repo.c b/src/map-repo.c index 466eeca..622cd54 100644 --- a/src/map-repo.c +++ b/src/map-repo.c @@ -528,8 +528,7 @@ return TRUE; } static gboolean -mapman_by_area(gdouble start_lat, gdouble start_lon, - gdouble end_lat, gdouble end_lon, MapmanInfo * mapman_info, +mapman_by_area(gdouble start_lat, gdouble start_lon, gdouble end_lat, gdouble end_lon, MapmanInfo * mapman_info, gboolean is_deleting, gboolean is_overwriting) { guint start_unitx, start_unity, end_unitx, end_unity; @@ -716,280 +715,241 @@ gtk_widget_set_sensitive(mapman_info->num_track_radius, gtk_toggle_button_get_ac gboolean menu_cb_mapman(GtkAction * action) { - GtkWidget *dialog; - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *table; - GtkWidget *label; - GtkWidget *button; - GtkWidget *lbl_gps_lat; - GtkWidget *lbl_gps_lon; - GtkWidget *lbl_center_lat; - GtkWidget *lbl_center_lon; - MapmanInfo mapman_info; - gchar buffer[80]; - gdouble lat, lon; - guint i, czoom; - - mapman_info.dialog = dialog = gtk_dialog_new_with_buttons(_("Manage Maps"), GTK_WINDOW(_window), - GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - - help_dialog_help_enable(GTK_DIALOG(mapman_info.dialog), HELP_ID_MAPMAN); - - /* Clear button. */ - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), - button = gtk_button_new_with_label(_("Clear"))); - g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(mapman_clear), &mapman_info); - - /* Cancel button. */ - gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT); - - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), mapman_info.notebook = gtk_notebook_new(), TRUE, TRUE, 0); - - /* Setup page. */ - gtk_notebook_append_page(GTK_NOTEBOOK(mapman_info.notebook), vbox = gtk_vbox_new(FALSE, 2), label = gtk_label_new(_("Setup"))); - gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(mapman_info.notebook), vbox, FALSE, FALSE, GTK_PACK_START); - - gtk_box_pack_start(GTK_BOX(vbox), hbox = gtk_hbox_new(FALSE, 4), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), mapman_info.rad_download = gtk_radio_button_new_with_label(NULL, _("Download Maps")), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), label = gtk_alignment_new(0.f, 0.5f, 0.f, 0.f), FALSE, FALSE, 0); - mapman_info.chk_overwrite = gtk_check_button_new_with_label(_("Overwrite")); - gtk_toggle_button_set_active(mapman_info.chk_overwrite, TRUE); - mapman_info.rad_delete = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(mapman_info.rad_download), _("Delete Maps")); - - gtk_container_add(GTK_CONTAINER(label), mapman_info.chk_overwrite); - gtk_box_pack_start(GTK_BOX(vbox), mapman_info.rad_delete, FALSE, FALSE, 0); - - gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0); - - gtk_box_pack_start(GTK_BOX(vbox), mapman_info.rad_by_area = gtk_radio_button_new_with_label(NULL, _("By Area (see tab)")), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox = gtk_hbox_new(FALSE, 4), FALSE, FALSE, 0); - - /* Route */ - gtk_box_pack_start(GTK_BOX(hbox), mapman_info.rad_by_route = gtk_radio_button_new_with_label_from_widget - (GTK_RADIO_BUTTON(mapman_info.rad_by_area), _("Along Route - Radius (tiles):")), FALSE, FALSE, 0); - gtk_widget_set_sensitive(mapman_info.rad_by_route, _route->head != _route->tail); - gtk_box_pack_start(GTK_BOX(hbox), mapman_info.num_route_radius = hildon_number_editor_new(0, 100), FALSE, FALSE, 0); - hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(mapman_info.num_route_radius), _route_dl_radius); +GtkWidget *dialog; +GtkWidget *vbox; +GtkWidget *hbox; +GtkWidget *table; +GtkWidget *label; +GtkWidget *button; +GtkWidget *lbl_gps_lat; +GtkWidget *lbl_gps_lon; +GtkWidget *lbl_center_lat; +GtkWidget *lbl_center_lon; +MapmanInfo mapman_info; +gchar buffer[80]; +gdouble lat, lon; +guint i, czoom; + +mapman_info.dialog = dialog = gtk_dialog_new_with_buttons(_("Manage Maps"), GTK_WINDOW(_window), + GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); + +help_dialog_help_enable(GTK_DIALOG(mapman_info.dialog), HELP_ID_MAPMAN); + +/* Clear button. */ +gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), button = gtk_button_new_with_label(_("Clear"))); +g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(mapman_clear), &mapman_info); + +/* Cancel button. */ +gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT); + +gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), mapman_info.notebook = gtk_notebook_new(), TRUE, TRUE, 0); + +/* Setup page. */ +gtk_notebook_append_page(GTK_NOTEBOOK(mapman_info.notebook), vbox = gtk_vbox_new(FALSE, 2), label = gtk_label_new(_("Setup"))); +gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(mapman_info.notebook), vbox, FALSE, FALSE, GTK_PACK_START); + +gtk_box_pack_start(GTK_BOX(vbox), hbox = gtk_hbox_new(FALSE, 4), FALSE, FALSE, 0); +gtk_box_pack_start(GTK_BOX(hbox), mapman_info.rad_download = gtk_radio_button_new_with_label(NULL, _("Download Maps")), FALSE, FALSE, 0); +gtk_box_pack_start(GTK_BOX(hbox), label = gtk_alignment_new(0.f, 0.5f, 0.f, 0.f), FALSE, FALSE, 0); +mapman_info.chk_overwrite = gtk_check_button_new_with_label(_("Overwrite")); +gtk_toggle_button_set_active(mapman_info.chk_overwrite, TRUE); +mapman_info.rad_delete = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(mapman_info.rad_download), _("Delete Maps")); + +gtk_container_add(GTK_CONTAINER(label), mapman_info.chk_overwrite); +gtk_box_pack_start(GTK_BOX(vbox), mapman_info.rad_delete, FALSE, FALSE, 0); + +gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0); + +gtk_box_pack_start(GTK_BOX(vbox), mapman_info.rad_by_area = gtk_radio_button_new_with_label(NULL, _("By Area (see tab)")), FALSE, FALSE, 0); +gtk_box_pack_start(GTK_BOX(vbox), hbox = gtk_hbox_new(FALSE, 4), FALSE, FALSE, 0); + +/* Route */ +gtk_box_pack_start(GTK_BOX(hbox), mapman_info.rad_by_route = gtk_radio_button_new_with_label_from_widget + (GTK_RADIO_BUTTON(mapman_info.rad_by_area), _("Along Route - Radius (tiles):")), FALSE, FALSE, 0); +gtk_widget_set_sensitive(mapman_info.rad_by_route, _route->head != _route->tail); +gtk_box_pack_start(GTK_BOX(hbox), mapman_info.num_route_radius = hildon_number_editor_new(0, 100), FALSE, FALSE, 0); +hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(mapman_info.num_route_radius), _route_dl_radius); /* Track */ - gtk_box_pack_start(GTK_BOX(vbox), hbox = gtk_hbox_new(FALSE, 4), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), mapman_info.rad_by_track = gtk_radio_button_new_with_label_from_widget - (GTK_RADIO_BUTTON(mapman_info.rad_by_area), _("Along Track - Radius (tiles):")), FALSE, FALSE, 0); - gtk_widget_set_sensitive(mapman_info.rad_by_track, _track->head != _track->tail); - gtk_box_pack_start(GTK_BOX(hbox), mapman_info.num_track_radius = hildon_number_editor_new(0, 100), FALSE, FALSE, 0); - hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(mapman_info.num_track_radius), _track_dl_radius); - - /* Zoom page. */ - gtk_notebook_append_page(GTK_NOTEBOOK(mapman_info.notebook), - table = gtk_table_new(5, 5, FALSE), - label = gtk_label_new(_("Zoom"))); - gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(mapman_info.notebook), table, FALSE, FALSE, GTK_PACK_START); - gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Zoom Levels to Download: (0 = most detail)")), 0, 4, 0, 1, GTK_FILL, 0, 4, 0); - gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f); - for (i = 0; i < _curr_repo->max_zoom; i++) { - g_snprintf(buffer, sizeof(buffer), "%d", i); - gtk_table_attach(GTK_TABLE(table), - mapman_info.chk_zoom_levels[i] = gtk_check_button_new_with_label(buffer), - i % 4, i % 4 + 1, i / 4 + 1, i / 4 + 2, GTK_EXPAND | GTK_FILL, 0, 4, 0); - } +gtk_box_pack_start(GTK_BOX(vbox), hbox = gtk_hbox_new(FALSE, 4), FALSE, FALSE, 0); +gtk_box_pack_start(GTK_BOX(hbox), mapman_info.rad_by_track = gtk_radio_button_new_with_label_from_widget + (GTK_RADIO_BUTTON(mapman_info.rad_by_area), _("Along Track - Radius (tiles):")), FALSE, FALSE, 0); +gtk_widget_set_sensitive(mapman_info.rad_by_track, _track->head != _track->tail); +gtk_box_pack_start(GTK_BOX(hbox), mapman_info.num_track_radius = hildon_number_editor_new(0, 100), FALSE, FALSE, 0); +hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(mapman_info.num_track_radius), _track_dl_radius); + +/* Zoom page. */ +gtk_notebook_append_page(GTK_NOTEBOOK(mapman_info.notebook), + table = gtk_table_new(5, 5, FALSE), + label = gtk_label_new(_("Zoom"))); +gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(mapman_info.notebook), table, FALSE, FALSE, GTK_PACK_START); +gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Zoom Levels to Download: (0 = most detail)")), 0, 4, 0, 1, GTK_FILL, 0, 4, 0); +gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f); +for (i = 0; i < _curr_repo->max_zoom; i++) { + g_snprintf(buffer, sizeof(buffer), "%d", i); + gtk_table_attach(GTK_TABLE(table), + mapman_info.chk_zoom_levels[i] = gtk_check_button_new_with_label(buffer), + i % 4, i % 4 + 1, i / 4 + 1, i / 4 + 2, GTK_EXPAND | GTK_FILL, 0, 4, 0); +} + +/* Area page. */ +gtk_notebook_append_page(GTK_NOTEBOOK(mapman_info.notebook), + mapman_info.tbl_area = gtk_table_new(3, 4, FALSE), label = gtk_label_new(_("Area"))); + +/* Label Columns. */ +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), label = gtk_label_new(_("Latitude")), 1, 2, 0, 1, GTK_FILL, 0, 4, 0); +gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), label = gtk_label_new(_("Longitude")), 2, 3, 0, 1, GTK_FILL, 0, 4, 0); +gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); - /* Area page. */ - gtk_notebook_append_page(GTK_NOTEBOOK(mapman_info.notebook), - mapman_info.tbl_area = - gtk_table_new(3, 4, FALSE), label = - gtk_label_new(_("Area"))); - - /* Label Columns. */ - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - label = gtk_label_new(_("Latitude")), - 1, 2, 0, 1, GTK_FILL, 0, 4, 0); - gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - label = gtk_label_new(_("Longitude")), - 2, 3, 0, 1, GTK_FILL, 0, 4, 0); - gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); - - /* GPS. */ - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - label = gtk_label_new(_("GPS Location")), - 0, 1, 1, 2, GTK_FILL, 0, 4, 0); - gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - lbl_gps_lat = gtk_label_new(""), - 1, 2, 1, 2, GTK_FILL, 0, 4, 0); - gtk_label_set_selectable(GTK_LABEL(lbl_gps_lat), TRUE); - gtk_misc_set_alignment(GTK_MISC(lbl_gps_lat), 1.f, 0.5f); - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - lbl_gps_lon = gtk_label_new(""), - 2, 3, 1, 2, GTK_FILL, 0, 4, 0); - gtk_label_set_selectable(GTK_LABEL(lbl_gps_lon), TRUE); - gtk_misc_set_alignment(GTK_MISC(lbl_gps_lon), 1.f, 0.5f); - - /* Center. */ - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - label = gtk_label_new(_("View Center")), - 0, 1, 2, 3, GTK_FILL, 0, 4, 0); - gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - lbl_center_lat = gtk_label_new(""), - 1, 2, 2, 3, GTK_FILL, 0, 4, 0); - gtk_label_set_selectable(GTK_LABEL(lbl_center_lat), TRUE); - gtk_misc_set_alignment(GTK_MISC(lbl_center_lat), 1.f, 0.5f); - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - lbl_center_lon = gtk_label_new(""), - 2, 3, 2, 3, GTK_FILL, 0, 4, 0); - gtk_label_set_selectable(GTK_LABEL(lbl_center_lon), TRUE); - gtk_misc_set_alignment(GTK_MISC(lbl_center_lon), 1.f, 0.5f); - - /* default values for Top Left and Bottom Right are defined by the - * rectangle of the current and the previous Center */ - - /* Top Left. */ - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - label = gtk_label_new(_("Top-Left")), - 0, 1, 3, 4, GTK_FILL, 0, 4, 0); - gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - mapman_info.txt_topleft_lat = gtk_entry_new(), - 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, 0, 4, 0); - gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_topleft_lat), 1.f); - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - mapman_info.txt_topleft_lon = gtk_entry_new(), - 2, 3, 3, 4, GTK_EXPAND | GTK_FILL, 0, 4, 0); - gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_topleft_lon), 1.f); - - /* Bottom Right. */ - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - label = gtk_label_new(_("Bottom-Right")), - 0, 1, 4, 5, GTK_FILL, 0, 4, 0); - gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - mapman_info.txt_botright_lat = gtk_entry_new(), - 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, 0, 4, 0); - gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_botright_lat), 1.f); - gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), - mapman_info.txt_botright_lon = gtk_entry_new(), - 2, 3, 4, 5, GTK_EXPAND | GTK_FILL, 0, 4, 0); - gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_botright_lon), 1.f); +/* GPS. */ +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), label = gtk_label_new(_("GPS Location")), 0, 1, 1, 2, GTK_FILL, 0, 4, 0); +gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), lbl_gps_lat = gtk_label_new(""), 1, 2, 1, 2, GTK_FILL, 0, 4, 0); +gtk_label_set_selectable(GTK_LABEL(lbl_gps_lat), TRUE); +gtk_misc_set_alignment(GTK_MISC(lbl_gps_lat), 1.f, 0.5f); +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), lbl_gps_lon = gtk_label_new(""), 2, 3, 1, 2, GTK_FILL, 0, 4, 0); +gtk_label_set_selectable(GTK_LABEL(lbl_gps_lon), TRUE); +gtk_misc_set_alignment(GTK_MISC(lbl_gps_lon), 1.f, 0.5f); + +/* Center. */ +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), label = gtk_label_new(_("View Center")), 0, 1, 2, 3, GTK_FILL, 0, 4, 0); +gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), lbl_center_lat = gtk_label_new(""), 1, 2, 2, 3, GTK_FILL, 0, 4, 0); +gtk_label_set_selectable(GTK_LABEL(lbl_center_lat), TRUE); +gtk_misc_set_alignment(GTK_MISC(lbl_center_lat), 1.f, 0.5f); +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), lbl_center_lon = gtk_label_new(""), 2, 3, 2, 3, GTK_FILL, 0, 4, 0); +gtk_label_set_selectable(GTK_LABEL(lbl_center_lon), TRUE); +gtk_misc_set_alignment(GTK_MISC(lbl_center_lon), 1.f, 0.5f); + +/* default values for Top Left and Bottom Right are defined by the + * rectangle of the current and the previous Center */ + +/* Top Left. */ +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), label = gtk_label_new(_("Top-Left")), 0, 1, 3, 4, GTK_FILL, 0, 4, 0); +gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), mapman_info.txt_topleft_lat = gtk_entry_new(), 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, 0, 4, 0); +gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_topleft_lat), 1.f); +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), mapman_info.txt_topleft_lon = gtk_entry_new(), 2, 3, 3, 4, GTK_EXPAND | GTK_FILL, 0, 4, 0); +gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_topleft_lon), 1.f); + +/* Bottom Right. */ +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), label = gtk_label_new(_("Bottom-Right")), 0, 1, 4, 5, GTK_FILL, 0, 4, 0); +gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), mapman_info.txt_botright_lat = gtk_entry_new(), 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, 0, 4, 0); +gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_botright_lat), 1.f); +gtk_table_attach(GTK_TABLE(mapman_info.tbl_area), mapman_info.txt_botright_lon = gtk_entry_new(), 2, 3, 4, 5, GTK_EXPAND | GTK_FILL, 0, 4, 0); +gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_botright_lon), 1.f); #if defined(WITH_DEVICE_770) && !defined(WITH_HILDON_NEW) - /* Set hildon input hints */ - g_object_set(G_OBJECT(mapman_info.txt_topleft_lon), - HILDON_INPUT_MODE_HINT, - HILDON_INPUT_MODE_HINT_NUMERICSPECIAL, NULL); - g_object_set(G_OBJECT(mapman_info.txt_topleft_lat), - HILDON_INPUT_MODE_HINT, - HILDON_INPUT_MODE_HINT_NUMERICSPECIAL, NULL); - g_object_set(G_OBJECT(mapman_info.txt_botright_lon), - HILDON_INPUT_MODE_HINT, - HILDON_INPUT_MODE_HINT_NUMERICSPECIAL, NULL); - g_object_set(G_OBJECT(mapman_info.txt_botright_lat), - HILDON_INPUT_MODE_HINT, - HILDON_INPUT_MODE_HINT_NUMERICSPECIAL, NULL); +/* Set hildon input hints */ +g_object_set(G_OBJECT(mapman_info.txt_topleft_lon), HILDON_INPUT_MODE_HINT, HILDON_INPUT_MODE_HINT_NUMERICSPECIAL, NULL); +g_object_set(G_OBJECT(mapman_info.txt_topleft_lat), HILDON_INPUT_MODE_HINT, HILDON_INPUT_MODE_HINT_NUMERICSPECIAL, NULL); +g_object_set(G_OBJECT(mapman_info.txt_botright_lon), HILDON_INPUT_MODE_HINT, HILDON_INPUT_MODE_HINT_NUMERICSPECIAL, NULL); +g_object_set(G_OBJECT(mapman_info.txt_botright_lat), HILDON_INPUT_MODE_HINT, HILDON_INPUT_MODE_HINT_NUMERICSPECIAL, NULL); #endif - /* Default action is to download by area. */ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mapman_info.rad_by_area), TRUE); +/* Default action is to download by area. */ +gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mapman_info.rad_by_area), TRUE); - /* Initialize fields. Do no use g_ascii_formatd; these strings will be - * output (and parsed) as locale-dependent. */ +/* Initialize fields. Do no use g_ascii_formatd; these strings will be + * output (and parsed) as locale-dependent. */ - g_snprintf(buffer, sizeof(buffer), "%.06f", _gps->data.lat); - gtk_label_set_text(GTK_LABEL(lbl_gps_lat), buffer); - g_snprintf(buffer, sizeof(buffer), "%.06f", _gps->data.lon); - gtk_label_set_text(GTK_LABEL(lbl_gps_lon), buffer); +g_snprintf(buffer, sizeof(buffer), "%.06f", _gps->data.lat); +gtk_label_set_text(GTK_LABEL(lbl_gps_lat), buffer); +g_snprintf(buffer, sizeof(buffer), "%.06f", _gps->data.lon); +gtk_label_set_text(GTK_LABEL(lbl_gps_lon), buffer); - gtk_map_get_center_latlon(_map, &lat, &lon); - g_snprintf(buffer, sizeof(buffer), "%.06f", lat); - gtk_label_set_text(GTK_LABEL(lbl_center_lat), buffer); - g_snprintf(buffer, sizeof(buffer), "%.06f", lon); - gtk_label_set_text(GTK_LABEL(lbl_center_lon), buffer); +gtk_map_get_center_latlon(_map, &lat, &lon); +g_snprintf(buffer, sizeof(buffer), "%.06f", lat); +gtk_label_set_text(GTK_LABEL(lbl_center_lat), buffer); +g_snprintf(buffer, sizeof(buffer), "%.06f", lon); +gtk_label_set_text(GTK_LABEL(lbl_center_lon), buffer); - /* Initialize to the bounds of the screen. */ - g_object_get(_map, "min-lat", &lat, "max-lon", &lon); - g_snprintf(buffer, sizeof(buffer), "%.06f", lat); - gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_topleft_lat), buffer); - g_snprintf(buffer, sizeof(buffer), "%.06f", lon); - gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_topleft_lon), buffer); +/* Initialize to the bounds of the screen. */ +g_object_get(_map, "min-lat", &lat, "max-lon", &lon); +g_snprintf(buffer, sizeof(buffer), "%.06f", lat); +gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_topleft_lat), buffer); +g_snprintf(buffer, sizeof(buffer), "%.06f", lon); +gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_topleft_lon), buffer); - g_object_get(_map, "max-lat", &lat, "min-lon", &lon); - g_snprintf(buffer, sizeof(buffer), "%.06f", lat); - gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_botright_lat), buffer); - g_snprintf(buffer, sizeof(buffer), "%.06f", lon); - gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_botright_lon), buffer); +g_object_get(_map, "max-lat", &lat, "min-lon", &lon); +g_snprintf(buffer, sizeof(buffer), "%.06f", lat); +gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_botright_lat), buffer); +g_snprintf(buffer, sizeof(buffer), "%.06f", lon); +gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_botright_lon), buffer); - czoom=gtk_map_get_zoom(_map); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mapman_info.chk_zoom_levels[czoom]), TRUE); +czoom=gtk_map_get_zoom(_map); +gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mapman_info.chk_zoom_levels[czoom]), TRUE); - gtk_widget_show_all(dialog); +gtk_widget_show_all(dialog); - mapman_update_state(NULL, &mapman_info); +mapman_update_state(NULL, &mapman_info); - /* Connect signals. */ - if (_curr_repo->type != REPOTYPE_NONE) { - g_signal_connect(G_OBJECT(mapman_info.rad_download), "clicked", G_CALLBACK(mapman_update_state), &mapman_info); - gtk_widget_set_sensitive(mapman_info.rad_download, TRUE); - } else { - gtk_widget_set_sensitive(mapman_info.rad_download, FALSE); - popup_error(dialog, _("NOTE: You must set a Map URI in the current repository in order to download maps.")); - } +/* Connect signals. */ +if (_curr_repo->type != REPOTYPE_NONE) { + g_signal_connect(G_OBJECT(mapman_info.rad_download), "clicked", G_CALLBACK(mapman_update_state), &mapman_info); + gtk_widget_set_sensitive(mapman_info.rad_download, TRUE); +} else { + gtk_widget_set_sensitive(mapman_info.rad_download, FALSE); + popup_error(dialog, _("NOTE: You must set a Map URI in the current repository in order to download maps.")); +} - g_signal_connect(G_OBJECT(mapman_info.rad_delete), "clicked", G_CALLBACK(mapman_update_state), &mapman_info); - g_signal_connect(G_OBJECT(mapman_info.rad_by_area), "clicked", G_CALLBACK(mapman_update_state), &mapman_info); - g_signal_connect(G_OBJECT(mapman_info.rad_by_route), "clicked", G_CALLBACK(mapman_update_state), &mapman_info); - g_signal_connect(G_OBJECT(mapman_info.rad_by_track), "clicked", G_CALLBACK(mapman_update_state), &mapman_info); - - while (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) { - gboolean is_deleting = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info.rad_delete)); - gboolean is_overwriting = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info.chk_overwrite)); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info.rad_by_route))) { - _route_dl_radius = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(mapman_info.num_route_radius)); - if (mapman_by_path(_route, &mapman_info, _route_dl_radius, is_deleting, is_overwriting)) - break; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info.rad_by_track))) { - _track_dl_radius = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(mapman_info.num_track_radius)); - if (mapman_by_path(_track, &mapman_info, _track_dl_radius, is_deleting, is_overwriting)) - break; - } else { - const gchar *text; - gchar *error_check; - gdouble start_lat, start_lon, end_lat, end_lon; - - text = gtk_entry_get_text(GTK_ENTRY(mapman_info.txt_topleft_lat)); - start_lat = strtof(text, &error_check); - if (text == error_check || start_lat < -90.f || start_lat > 90.f) { - popup_error(dialog, _("Invalid Top-Left Latitude")); - continue; - } +g_signal_connect(G_OBJECT(mapman_info.rad_delete), "clicked", G_CALLBACK(mapman_update_state), &mapman_info); +g_signal_connect(G_OBJECT(mapman_info.rad_by_area), "clicked", G_CALLBACK(mapman_update_state), &mapman_info); +g_signal_connect(G_OBJECT(mapman_info.rad_by_route), "clicked", G_CALLBACK(mapman_update_state), &mapman_info); +g_signal_connect(G_OBJECT(mapman_info.rad_by_track), "clicked", G_CALLBACK(mapman_update_state), &mapman_info); - text = gtk_entry_get_text(GTK_ENTRY(mapman_info.txt_topleft_lon)); - start_lon = strtof(text, &error_check); - if (text == error_check || start_lon < -180.f || start_lon > 180.f) { - popup_error(dialog, _("Invalid Top-Left Longitude")); - continue; - } +while (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) { + gboolean is_deleting = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info.rad_delete)); + gboolean is_overwriting = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info.chk_overwrite)); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info.rad_by_route))) { + _route_dl_radius = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(mapman_info.num_route_radius)); + if (mapman_by_path(_route, &mapman_info, _route_dl_radius, is_deleting, is_overwriting)) + break; + } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info.rad_by_track))) { + _track_dl_radius = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(mapman_info.num_track_radius)); + if (mapman_by_path(_track, &mapman_info, _track_dl_radius, is_deleting, is_overwriting)) + break; + } else { + const gchar *text; + gchar *error_check; + gdouble start_lat, start_lon, end_lat, end_lon; + + text = gtk_entry_get_text(GTK_ENTRY(mapman_info.txt_topleft_lat)); + start_lat = strtof(text, &error_check); + if (text == error_check || start_lat < -90.f || start_lat > 90.f) { + popup_error(dialog, _("Invalid Top-Left Latitude")); + continue; + } - text = gtk_entry_get_text(GTK_ENTRY(mapman_info.txt_botright_lat)); - end_lat = strtof(text, &error_check); - if (text == error_check || end_lat < -90.f || end_lat > 90.f) { - popup_error(dialog, _("Invalid Bottom-Right Latitude")); - continue; - } + text = gtk_entry_get_text(GTK_ENTRY(mapman_info.txt_topleft_lon)); + start_lon = strtof(text, &error_check); + if (text == error_check || start_lon < -180.f || start_lon > 180.f) { + popup_error(dialog, _("Invalid Top-Left Longitude")); + continue; + } - text = gtk_entry_get_text(GTK_ENTRY(mapman_info.txt_botright_lon)); - end_lon = strtof(text, &error_check); - if (text == error_check || end_lon < -180.f || end_lon > 180.f) { - popup_error(dialog, _("Invalid Bottom-Right Longitude")); - continue; - } + text = gtk_entry_get_text(GTK_ENTRY(mapman_info.txt_botright_lat)); + end_lat = strtof(text, &error_check); + if (text == error_check || end_lat < -90.f || end_lat > 90.f) { + popup_error(dialog, _("Invalid Bottom-Right Latitude")); + continue; + } - if (mapman_by_area(start_lat, start_lon, end_lat, end_lon, &mapman_info, is_deleting, is_overwriting)) - break; + text = gtk_entry_get_text(GTK_ENTRY(mapman_info.txt_botright_lon)); + end_lon = strtof(text, &error_check); + if (text == error_check || end_lon < -180.f || end_lon > 180.f) { + popup_error(dialog, _("Invalid Bottom-Right Longitude")); + continue; } + + if (mapman_by_area(start_lat, start_lon, end_lat, end_lon, &mapman_info, is_deleting, is_overwriting)) + break; } +} - gtk_widget_hide(dialog); /* Destroying causes a crash (!?!?!??!) */ +gtk_widget_hide(dialog); /* Destroying causes a crash (!?!?!??!) */ - return TRUE; +return TRUE; }