From: Kaj-Michael Lang Date: Wed, 31 Oct 2007 13:11:35 +0000 (+0200) Subject: Misc X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e4e522e5991b922e3f1f484764d8d604d1ccfc3;p=mapper Misc --- diff --git a/src/map-repo.c b/src/map-repo.c index 3ab6ed6..bbacca5 100644 --- a/src/map-repo.c +++ b/src/map-repo.c @@ -772,9 +772,7 @@ mapman_by_area(gfloat start_lat, gfloat start_lon, num_maps * (strstr(_curr_repo->url, "%s") ? 18e-3 : 6e-3)); } - confirm = - hildon_note_new_confirmation(GTK_WINDOW(mapman_info->dialog), - buffer); + confirm = hildon_note_new_confirmation(GTK_WINDOW(mapman_info->dialog), buffer); if (GTK_RESPONSE_OK != gtk_dialog_run(GTK_DIALOG(confirm))) { gtk_widget_destroy(confirm); @@ -813,9 +811,7 @@ mapman_by_route(MapmanInfo * mapman_info, guint prev_tilex, prev_tiley, num_maps = 0, i; Point *curr; gchar buffer[80]; - guint radius = - hildon_number_editor_get_value(HILDON_NUMBER_EDITOR - (mapman_info->num_route_radius)); + guint radius = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(mapman_info->num_route_radius)); /* First, get the number of maps to download. */ for (i = 0; i < MAX_ZOOM; i++) { @@ -1152,8 +1148,7 @@ gboolean menu_cb_mapman(GtkAction * action) #endif /* Default action is to download by area. */ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mapman_info.rad_by_area), - TRUE); + 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. */ @@ -1176,16 +1171,13 @@ gboolean menu_cb_mapman(GtkAction * action) snprintf(buffer, sizeof(buffer), "%.06f", lon); gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_topleft_lon), buffer); - unit2latlon(x2unit(_screen_width_pixels), y2unit(_screen_height_pixels), - lat, lon); + unit2latlon(x2unit(_screen_width_pixels), y2unit(_screen_height_pixels), lat, lon); snprintf(buffer, sizeof(buffer), "%.06f", lat); gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_botright_lat), buffer); snprintf(buffer, sizeof(buffer), "%.06f", lon); gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_botright_lon), buffer); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON - (mapman_info.chk_zoom_levels[_zoom]), - TRUE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mapman_info.chk_zoom_levels[_zoom]), TRUE); gtk_widget_show_all(dialog); @@ -1193,78 +1185,57 @@ gboolean menu_cb_mapman(GtkAction * action) /* 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); + 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.")); + 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_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); 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))) { - if (mapman_by_route - (&mapman_info, is_deleting, is_overwriting)) + 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))) { + if (mapman_by_route(&mapman_info, is_deleting, is_overwriting)) break; } else { const gchar *text; gchar *error_check; gfloat start_lat, start_lon, end_lat, end_lon; - text = gtk_entry_get_text(GTK_ENTRY - (mapman_info.txt_topleft_lat)); + 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) { + 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_topleft_lon)); + 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) { + 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_lat)); + 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) { + 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_botright_lon)); + 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) { + 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)) + if (mapman_by_area(start_lat, start_lon, end_lat, end_lon, &mapman_info, is_deleting, is_overwriting)) break; } }