-#include <config.h>
+/*
+ * This file is part of mapper
+ *
+ * Copyright (C) 2007 Kaj-Michael Lang
+ * Copyright (C) 2006-2007 John Costigan.
+ *
+ * POI and GPS-Info code originally written by Cezary Jackiewicz.
+ *
+ * Default map data provided by http://www.openstreetmap.org/
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
-#define _GNU_SOURCE
+#include <config.h>
#include <unistd.h>
#include <stdlib.h>
#include "utils.h"
#include "gps.h"
#include "map.h"
+#include "latlon.h"
#include "route.h"
#include "settings.h"
#include "mapper-types.h"
+#include "map-download.h"
#include "ui-common.h"
+#include "help.h"
+
+#define MAP_REPO_LIST_URL "http://www.gnuite.com/nokia770/maemo-mapper/repos.txt"
+
typedef struct _RepoManInfo RepoManInfo;
struct _RepoManInfo {
GtkWidget *dialog;
if (g_mkdir_with_parents(cache_dir, 0755)) {
/* Failed to create Map Cache directory. */
gchar buffer[BUFFER_SIZE];
- snprintf(buffer, sizeof(buffer), "%s: %s",
+ g_snprintf(buffer, sizeof(buffer), "%s: %s",
_("Unable to create cache directory for repository"), name);
popup_error(parent, buffer);
return FALSE;
popup_error(rmi->dialog,
_("Cannot delete the last repository - there must be at"
" lease one repository."));
- vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
return TRUE;
}
- snprintf(buffer, sizeof(buffer), "%s:\n%s\n",
+ g_snprintf(buffer, sizeof(buffer), "%s:\n%s\n",
_("Confirm delete of repository"),
gtk_combo_box_get_active_text(GTK_COMBO_BOX(rmi->cmb_repos)));
confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), buffer);
gtk_widget_destroy(confirm);
- vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
return TRUE;
}
cmb_repos))),
NULL) - 1);
- vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
return rei;
}
GtkWidget *label;
GtkWidget *txt_name;
GtkWidget *dialog;
- printf("%s()\n", __PRETTY_FUNCTION__);
dialog = gtk_dialog_new_with_buttons(_("New Repository"),
GTK_WINDOW(rmi->dialog),
gtk_widget_destroy(dialog);
- vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
return TRUE;
}
}
gtk_widget_destroy(confirm);
- vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
return TRUE;
}
gchar *tail;
gint size;
GnomeVFSResult vfs_result;
- printf("%s()\n", __PRETTY_FUNCTION__);
/* Get repo config file from www.gnuite.com. */
- if (GNOME_VFS_OK !=
- (vfs_result =
- gnome_vfs_read_entire_file
- ("http://www.gnuite.com/nokia770/maemo-mapper/repos.txt",
- &size, &bytes))) {
+ if (GNOME_VFS_OK != (vfs_result = gnome_vfs_read_entire_file
+ (MAP_REPO_LIST_URL, &size, &bytes))) {
popup_error(rmi->dialog,
_
("An error occurred while retrieving the repositories. "
}
gtk_widget_destroy(confirm);
- vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
return TRUE;
}
GTK_DIALOG_MODAL, GTK_STOCK_OK,
GTK_RESPONSE_ACCEPT, NULL);
-#ifdef WITH_OSSO
- /* Enable the help button. */
- ossohelp_dialog_help_enable(GTK_DIALOG(rmi.dialog), HELP_ID_REPOMAN,
- _osso);
-#endif
+ help_dialog_help_enable(GTK_DIALOG(rmi.dialog), HELP_ID_REPOMAN);
/* Reset button. */
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(rmi.dialog)->action_area),
/* Populate combo box and pages in notebook. */
for (i = 0, curr = _repo_list; curr; curr = curr->next, i++) {
RepoData *rd = (RepoData *) curr->data;
- RepoEditInfo *rei =
- repoman_dialog_add_repo(&rmi, g_strdup(rd->name));
+ RepoEditInfo *rei = repoman_dialog_add_repo(&rmi, g_strdup(rd->name));
/* Initialize fields with data from the RepoData object. */
gtk_entry_set_text(GTK_ENTRY(rei->txt_url), rd->url);
- gtk_entry_set_text(GTK_ENTRY(rei->txt_cache_dir),
- rd->cache_dir);
+ gtk_entry_set_text(GTK_ENTRY(rei->txt_cache_dir), rd->cache_dir);
hildon_controlbar_set_value(HILDON_CONTROLBAR
(rei->num_dl_zoom_steps),
rd->dl_zoom_steps);
}
/* Connect signals. */
- g_signal_connect(G_OBJECT(btn_rename), "clicked",
- G_CALLBACK(repoman_dialog_rename), &rmi);
- g_signal_connect(G_OBJECT(btn_delete), "clicked",
- G_CALLBACK(repoman_dialog_delete), &rmi);
- g_signal_connect(G_OBJECT(btn_new), "clicked",
- G_CALLBACK(repoman_dialog_new), &rmi);
- g_signal_connect(G_OBJECT(rmi.cmb_repos), "changed",
- G_CALLBACK(repoman_dialog_select), &rmi);
+ g_signal_connect(G_OBJECT(btn_rename), "clicked", G_CALLBACK(repoman_dialog_rename), &rmi);
+ g_signal_connect(G_OBJECT(btn_delete), "clicked", G_CALLBACK(repoman_dialog_delete), &rmi);
+ g_signal_connect(G_OBJECT(btn_new), "clicked", G_CALLBACK(repoman_dialog_new), &rmi);
+ g_signal_connect(G_OBJECT(rmi.cmb_repos), "changed", G_CALLBACK(repoman_dialog_select), &rmi);
gtk_combo_box_set_active(GTK_COMBO_BOX(rmi.cmb_repos), curr_repo_index);
- gtk_notebook_set_current_page(GTK_NOTEBOOK(rmi.notebook),
- curr_repo_index);
+ gtk_notebook_set_current_page(GTK_NOTEBOOK(rmi.notebook), curr_repo_index);
gtk_widget_show_all(rmi.dialog);
gint i;
GList *curr;
gchar *old_curr_repo_name = _curr_repo->name;
+
for (i = 0, curr = rmi.repo_edits;
verified && curr; curr = curr->next, i++) {
RepoEditInfo *rei = curr->data;
- gchar *expanded =
- gnome_vfs_expand_initial_tilde(gtk_entry_get_text
- (GTK_ENTRY
- (rei->
- txt_cache_dir)));
- verified =
- repo_make_cache_dir(rei->name, expanded,
- rmi.dialog);
+ gchar *expanded = gnome_vfs_expand_initial_tilde(gtk_entry_get_text(GTK_ENTRY(rei->txt_cache_dir)));
+ verified = repo_make_cache_dir(rei->name, expanded, rmi.dialog);
g_free(expanded);
}
if (!verified) {
- gtk_combo_box_set_active(GTK_COMBO_BOX(rmi.cmb_repos),
- i - 1);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(rmi.cmb_repos), i - 1);
continue;
}
- /* We're good to replace. Remove old _repo_list menu items. */
- menu_maps_remove_repos();
+ /* ** */
/* But keep the repo list in memory, in case downloads are using it. */
_repo_list = NULL;
/* Write new _repo_list. */
- curr_repo_index =
- gtk_combo_box_get_active(GTK_COMBO_BOX(rmi.cmb_repos));
+ curr_repo_index = gtk_combo_box_get_active(GTK_COMBO_BOX(rmi.cmb_repos));
_curr_repo = NULL;
for (i = 0, curr = rmi.repo_edits; curr; curr = curr->next, i++) {
RepoEditInfo *rei = curr->data;
RepoData *rd = g_new(RepoData, 1);
rd->name = g_strdup(rei->name);
- rd->url =
- g_strdup(gtk_entry_get_text
- (GTK_ENTRY(rei->txt_url)));
- rd->cache_dir =
- gnome_vfs_expand_initial_tilde(gtk_entry_get_text
- (GTK_ENTRY
- (rei->
- txt_cache_dir)));
- rd->dl_zoom_steps =
- hildon_controlbar_get_value(HILDON_CONTROLBAR
- (rei->
- num_dl_zoom_steps));
- rd->view_zoom_steps =
- hildon_controlbar_get_value(HILDON_CONTROLBAR
- (rei->
- num_view_zoom_steps));
- rd->double_size =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
- (rei->
- chk_double_size));
- rd->nextable =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
- (rei->chk_nextable));
+ rd->url = g_strdup(gtk_entry_get_text(GTK_ENTRY(rei->txt_url)));
+ rd->cache_dir = gnome_vfs_expand_initial_tilde(gtk_entry_get_text(GTK_ENTRY(rei->txt_cache_dir)));
+ rd->dl_zoom_steps = hildon_controlbar_get_value(HILDON_CONTROLBAR(rei->num_dl_zoom_steps));
+ rd->view_zoom_steps = hildon_controlbar_get_value(HILDON_CONTROLBAR(rei->num_view_zoom_steps));
+ rd->double_size = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rei->chk_double_size));
+ rd->nextable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rei->chk_nextable));
set_repo_type(rd);
_repo_list = g_list_append(_repo_list, rd);
- if (!_curr_repo
- && !strcmp(old_curr_repo_name, rd->name))
+ if (!_curr_repo && !strcmp(old_curr_repo_name, rd->name))
repo_set_curr(rd);
else if (i == curr_repo_index)
repo_set_curr(rd);
}
if (!_curr_repo)
repo_set_curr((RepoData *) g_list_first(_repo_list)->data);
- menu_maps_add_repos(_menu_maps_submenu);
+
+ menu_maps_add_repos();
config_save_repo();
break;
map_set_zoom(_zoom); /* make sure we're at an appropriate zoom level. */
- vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
return TRUE;
}
guint i;
gchar buffer[80];
GtkWidget *confirm;
- printf("%s()\n", __PRETTY_FUNCTION__);
latlon2unit(start_lat, start_lon, start_unitx, start_unity);
latlon2unit(end_lat, end_lon, end_unitx, end_unity);
}
if (is_deleting) {
- snprintf(buffer, sizeof(buffer), "%s %d %s",
+ g_snprintf(buffer, sizeof(buffer), "%s %d %s",
_("Confirm DELETION of"), num_maps, _("maps "));
} else {
- snprintf(buffer, sizeof(buffer),
+ g_snprintf(buffer, sizeof(buffer),
"%s %d %s\n(%s %.2f MB)\n", _("Confirm download of"),
num_maps, _("maps"), _("up to about"),
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);
- vprintf("%s(): return FALSE\n", __PRETTY_FUNCTION__);
return FALSE;
}
for (i = 0; i < MAX_ZOOM; i++) {
}
}
gtk_widget_destroy(confirm);
- vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
return TRUE;
}
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));
- printf("%s()\n", __PRETTY_FUNCTION__);
+ 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++) {
num_maps *= 0.625 * pow(radius + 1, 1.85);
if (is_deleting) {
- snprintf(buffer, sizeof(buffer), "%s %s %d %s",
+ g_snprintf(buffer, sizeof(buffer), "%s %s %d %s",
_("Confirm DELETION of"), _("about"),
num_maps, _("maps "));
} else {
- snprintf(buffer, sizeof(buffer),
+ g_snprintf(buffer, sizeof(buffer),
"%s %s %d %s\n(%s %.2f MB)\n",
_("Confirm download of"), _("about"), num_maps,
_("maps"), _("up to about"),
if (GTK_RESPONSE_OK != gtk_dialog_run(GTK_DIALOG(confirm))) {
gtk_widget_destroy(confirm);
- vprintf("%s(): return FALSE\n", __PRETTY_FUNCTION__);
return FALSE;
}
}
_route_dl_radius = radius;
gtk_widget_destroy(confirm);
- vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
return TRUE;
}
static void
mapman_clear(GtkWidget * widget, MapmanInfo * mapman_info)
{
- guint i;
- printf("%s()\n", __PRETTY_FUNCTION__);
- if (gtk_notebook_get_current_page(GTK_NOTEBOOK(mapman_info->notebook)))
- /* This is the second page (the "Zoom" page) - clear the checks. */
- for (i = 0; i < MAX_ZOOM; i++)
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
- (mapman_info->
- chk_zoom_levels[i]),
- FALSE);
- else {
- /* This is the first page (the "Area" page) - clear the text fields. */
- gtk_entry_set_text(GTK_ENTRY(mapman_info->txt_topleft_lat), "");
- gtk_entry_set_text(GTK_ENTRY(mapman_info->txt_topleft_lon), "");
- gtk_entry_set_text(GTK_ENTRY(mapman_info->txt_botright_lat),
- "");
- gtk_entry_set_text(GTK_ENTRY(mapman_info->txt_botright_lon),
- "");
- }
- vprintf("%s(): return\n", __PRETTY_FUNCTION__);
+guint i;
+
+if (gtk_notebook_get_current_page(GTK_NOTEBOOK(mapman_info->notebook))) {
+ /* This is the second page (the "Zoom" page) - clear the checks. */
+ for (i = 0; i < MAX_ZOOM; i++)
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mapman_info->chk_zoom_levels[i]), FALSE);
+} else {
+ /* This is the first page (the "Area" page) - clear the text fields. */
+ gtk_entry_set_text(GTK_ENTRY(mapman_info->txt_topleft_lat), "");
+ gtk_entry_set_text(GTK_ENTRY(mapman_info->txt_topleft_lon), "");
+ gtk_entry_set_text(GTK_ENTRY(mapman_info->txt_botright_lat), "");
+ gtk_entry_set_text(GTK_ENTRY(mapman_info->txt_botright_lon), "");
+}
}
static void
mapman_update_state(GtkWidget * widget, MapmanInfo * mapman_info)
{
- printf("%s()\n", __PRETTY_FUNCTION__);
- gtk_widget_set_sensitive(mapman_info->chk_overwrite,
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
- (mapman_info->
- rad_download)));
+gtk_widget_set_sensitive(mapman_info->chk_overwrite,
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info->rad_download)));
if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON(mapman_info->rad_by_area)))
gtk_widget_set_sensitive(mapman_info->num_route_radius,
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
- (mapman_info->
- rad_by_route)));
- vprintf("%s(): return\n", __PRETTY_FUNCTION__);
+ (mapman_info->rad_by_route)));
}
gboolean menu_cb_mapman(GtkAction * action)
gchar buffer[80];
gfloat lat, lon;
guint i;
- printf("%s()\n", __PRETTY_FUNCTION__);
- mapman_info.dialog = dialog =
- gtk_dialog_new_with_buttons(_("Manage Maps"), GTK_WINDOW(_window),
+ mapman_info.dialog = dialog = gtk_dialog_new_with_buttons(_("Manage Maps"), GTK_WINDOW(_window),
GTK_DIALOG_MODAL, GTK_STOCK_OK,
GTK_RESPONSE_ACCEPT, NULL);
- /* Enable the help button. */
-#ifdef WITH_OSSO
- ossohelp_dialog_help_enable(GTK_DIALOG(mapman_info.dialog),
- HELP_ID_MAPMAN, _osso);
-#endif
+ help_dialog_help_enable(GTK_DIALOG(mapman_info.dialog), HELP_ID_MAPMAN);
/* Clear button. */
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
G_CALLBACK(mapman_clear), &mapman_info);
/* Cancel button. */
- gtk_dialog_add_button(GTK_DIALOG(dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
+ 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);
+ mapman_info.notebook = gtk_notebook_new(), TRUE, TRUE, 0);
/* Setup page. */
gtk_notebook_append_page(GTK_NOTEBOOK(mapman_info.notebook),
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);
+ 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);
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_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);
gtk_box_pack_start(GTK_BOX(hbox), mapman_info.rad_by_route =
0, 4, 0, 1, GTK_FILL, 0, 4, 0);
gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f);
for (i = 0; i < MAX_ZOOM; i++) {
- snprintf(buffer, sizeof(buffer), "%d", 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),
2, 3, 4, 5, GTK_EXPAND | GTK_FILL, 0, 4, 0);
gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_botright_lon), 1.f);
-#ifdef WITH_DEVICE_770
+#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,
#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. */
- snprintf(buffer, sizeof(buffer), "%.06f", _gps.lat);
+ g_snprintf(buffer, sizeof(buffer), "%.06f", _gps->lat);
gtk_label_set_text(GTK_LABEL(lbl_gps_lat), buffer);
- snprintf(buffer, sizeof(buffer), "%.06f", _gps.lon);
+ g_snprintf(buffer, sizeof(buffer), "%.06f", _gps->lon);
gtk_label_set_text(GTK_LABEL(lbl_gps_lon), buffer);
unit2latlon(_center.unitx, _center.unity, lat, lon);
- snprintf(buffer, sizeof(buffer), "%.06f", lat);
+ g_snprintf(buffer, sizeof(buffer), "%.06f", lat);
gtk_label_set_text(GTK_LABEL(lbl_center_lat), buffer);
- snprintf(buffer, sizeof(buffer), "%.06f", lon);
+ g_snprintf(buffer, sizeof(buffer), "%.06f", lon);
gtk_label_set_text(GTK_LABEL(lbl_center_lon), buffer);
/* Initialize to the bounds of the screen. */
unit2latlon(x2unit(0), y2unit(0), lat, lon);
- snprintf(buffer, sizeof(buffer), "%.06f", lat);
+ g_snprintf(buffer, sizeof(buffer), "%.06f", lat);
gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_topleft_lat), buffer);
- snprintf(buffer, sizeof(buffer), "%.06f", lon);
+ g_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);
- snprintf(buffer, sizeof(buffer), "%.06f", lat);
+ unit2latlon(x2unit(_screen_width_pixels), y2unit(_screen_height_pixels), lat, lon);
+ g_snprintf(buffer, sizeof(buffer), "%.06f", lat);
gtk_entry_set_text(GTK_ENTRY(mapman_info.txt_botright_lat), buffer);
- snprintf(buffer, sizeof(buffer), "%.06f", lon);
+ g_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);
/* 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;
}
}
gtk_widget_hide(dialog); /* Destroying causes a crash (!?!?!??!) */
- vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
return TRUE;
}