2 * Copyright (C) 2006, 2007 John Costigan.
4 * POI and GPS-Info code originally written by Cezary Jackiewicz.
6 * Default map data provided by http://www.openstreetmap.org/
8 * This file is part of Maemo Mapper.
10 * Maemo Mapper is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
15 * Maemo Mapper is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with Maemo Mapper. If not, see <http://www.gnu.org/licenses/>.
33 #include <gconf/gconf-client.h>
36 # include <hildon/hildon-note.h>
37 # include <hildon/hildon-banner.h>
39 # include <hildon-widgets/hildon-note.h>
40 # include <hildon-widgets/hildon-banner.h>
49 #include "gdk-pixbuf-rotate.h"
55 #define GCONF_SUPL_KEY_PREFIX "/system/osso/supl"
56 #define GCONF_KEY_SUPL_LAT GCONF_SUPL_KEY_PREFIX"/pos_latitude"
57 #define GCONF_KEY_SUPL_LON GCONF_SUPL_KEY_PREFIX"/pos_longitude"
58 #define GCONF_KEY_SUPL_TIME GCONF_SUPL_KEY_PREFIX"/pos_timestamp"
61 cmenu_show_latlon(gint unitx, gint unity)
64 gchar buffer[80], tmp1[LL_FMT_LEN], tmp2[LL_FMT_LEN];
65 printf("%s()\n", __PRETTY_FUNCTION__);
67 unit2latlon(unitx, unity, lat, lon);
68 lat_format(lat, tmp1);
69 lon_format(lon, tmp2);
71 snprintf(buffer, sizeof(buffer),
75 _("Longitude"), tmp2);
77 MACRO_BANNER_SHOW_INFO(_window, buffer);
79 vprintf("%s(): return\n", __PRETTY_FUNCTION__);
83 cmenu_clip_latlon(gint unitx, gint unity)
87 printf("%s()\n", __PRETTY_FUNCTION__);
89 unit2latlon(unitx, unity, lat, lon);
91 snprintf(buffer, sizeof(buffer), "%.06f,%.06f", lat, lon);
93 gtk_clipboard_set_text(
94 gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), buffer, -1);
96 vprintf("%s(): return\n", __PRETTY_FUNCTION__);
100 cmenu_route_to(gint unitx, gint unity)
106 printf("%s()\n", __PRETTY_FUNCTION__);
108 unit2latlon(unitx, unity, lat, lon);
110 g_ascii_formatd(strlat, 32, "%.06f", lat);
111 g_ascii_formatd(strlon, 32, "%.06f", lon);
112 snprintf(buffer, sizeof(buffer), "%s, %s", strlat, strlon);
114 route_download(buffer);
116 vprintf("%s(): return\n", __PRETTY_FUNCTION__);
120 cmenu_distance_to(gint unitx, gint unity)
124 printf("%s()\n", __PRETTY_FUNCTION__);
126 unit2latlon(unitx, unity, lat, lon);
128 snprintf(buffer, sizeof(buffer), "%s: %.02f %s", _("Distance"),
129 calculate_distance(_gps.lat, _gps.lon, lat, lon)
130 * UNITS_CONVERT[_units],
131 UNITS_ENUM_TEXT[_units]);
132 MACRO_BANNER_SHOW_INFO(_window, buffer);
134 vprintf("%s(): return\n", __PRETTY_FUNCTION__);
138 cmenu_add_route(gint unitx, gint unity)
140 printf("%s()\n", __PRETTY_FUNCTION__);
141 MACRO_PATH_INCREMENT_TAIL(_route);
142 screen2unit(_cmenu_position_x, _cmenu_position_y,
143 _route.tail->unitx, _route.tail->unity);
144 route_find_nearest_point();
146 vprintf("%s(): return\n", __PRETTY_FUNCTION__);
150 cmenu_cb_loc_show_latlon(GtkMenuItem *item)
154 printf("%s()\n", __PRETTY_FUNCTION__);
156 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
157 unit2latlon(unitx, unity, lat, lon);
159 latlon_dialog(lat, lon);
161 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
166 cmenu_cb_loc_route_to(GtkMenuItem *item)
169 printf("%s()\n", __PRETTY_FUNCTION__);
171 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
172 cmenu_route_to(unitx, unity);
174 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
179 cmenu_cb_loc_download_poi(GtkMenuItem *item)
182 printf("%s()\n", __PRETTY_FUNCTION__);
184 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
185 poi_download_dialog(unitx, unity);
187 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
192 cmenu_cb_loc_browse_poi(GtkMenuItem *item)
195 printf("%s()\n", __PRETTY_FUNCTION__);
197 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
198 poi_browse_dialog(unitx, unity);
200 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
205 cmenu_cb_loc_distance_to(GtkMenuItem *item)
208 printf("%s()\n", __PRETTY_FUNCTION__);
210 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
211 cmenu_distance_to(unitx, unity);
213 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
218 cmenu_cb_loc_add_route(GtkMenuItem *item)
221 printf("%s()\n", __PRETTY_FUNCTION__);
223 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
224 cmenu_add_route(unitx, unity);
226 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
231 cmenu_cb_loc_add_way(GtkMenuItem *item)
234 printf("%s()\n", __PRETTY_FUNCTION__);
236 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
237 route_add_way_dialog(unitx, unity);
239 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
244 cmenu_cb_loc_add_poi(GtkMenuItem *item)
247 printf("%s()\n", __PRETTY_FUNCTION__);
249 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
250 poi_add_dialog(_window, unitx, unity);
252 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
257 cmenu_cb_loc_set_gps(GtkMenuItem *item)
259 printf("%s()\n", __PRETTY_FUNCTION__);
261 screen2unit(_cmenu_position_x, _cmenu_position_y, _pos.unitx, _pos.unity);
262 unit2latlon(_pos.unitx, _pos.unity, _gps.lat, _gps.lon);
264 /* Move mark to new location. */
265 map_refresh_mark(_center_mode > 0);
267 GConfClient *gconf_client = gconf_client_get_default();
270 gconf_client_set_float(gconf_client, GCONF_KEY_SUPL_LON, _gps.lon, NULL);
271 gconf_client_set_float(gconf_client, GCONF_KEY_SUPL_LAT, _gps.lat, NULL);
272 g_get_current_time(&curtime);
273 gconf_client_set_float(gconf_client, GCONF_KEY_SUPL_TIME, curtime.tv_sec, NULL);
275 g_object_unref(gconf_client);
277 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
282 cmenu_cb_loc_apply_correction(GtkMenuItem *item)
284 printf("%s()\n", __PRETTY_FUNCTION__);
286 if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)))
288 /* Get difference between tap point and GPS location. */
290 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
291 _map_correction_unitx = unitx - _pos.unitx;
292 _map_correction_unity = unity - _pos.unity;
293 map_refresh_mark(TRUE);
294 MACRO_BANNER_SHOW_INFO(_window, _("Map correction applied."));
298 _map_correction_unitx = 0;
299 _map_correction_unity = 0;
300 map_refresh_mark(TRUE);
301 MACRO_BANNER_SHOW_INFO(_window, _("Map correction removed."));
304 printf("Map correction now set to: %d, %d\n");
306 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
311 cmenu_cb_way_show_latlon(GtkMenuItem *item)
315 printf("%s()\n", __PRETTY_FUNCTION__);
317 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
318 if((way = find_nearest_waypoint(unitx, unity)))
319 cmenu_show_latlon(way->point->unitx, way->point->unity);
322 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
326 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
331 cmenu_cb_way_show_desc(GtkMenuItem *item)
335 printf("%s()\n", __PRETTY_FUNCTION__);
337 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
338 if((way = find_nearest_waypoint(unitx, unity)))
340 MACRO_BANNER_SHOW_INFO(_window, way->desc);
344 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
347 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
352 cmenu_cb_way_clip_latlon(GtkMenuItem *item)
356 printf("%s()\n", __PRETTY_FUNCTION__);
358 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
359 if((way = find_nearest_waypoint(unitx, unity)))
360 cmenu_clip_latlon(way->point->unitx, way->point->unity);
363 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
366 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
371 cmenu_cb_way_clip_desc(GtkMenuItem *item)
375 printf("%s()\n", __PRETTY_FUNCTION__);
377 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
378 if((way = find_nearest_waypoint(unitx, unity)))
379 gtk_clipboard_set_text(
380 gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), way->desc, -1);
383 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
386 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
391 cmenu_cb_way_route_to(GtkMenuItem *item)
395 printf("%s()\n", __PRETTY_FUNCTION__);
397 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
398 if((way = find_nearest_waypoint(unitx, unity)))
399 cmenu_route_to(way->point->unitx, way->point->unity);
402 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
405 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
410 cmenu_cb_way_distance_to(GtkMenuItem *item)
414 printf("%s()\n", __PRETTY_FUNCTION__);
416 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
417 if((way = find_nearest_waypoint(unitx, unity)))
418 route_show_distance_to(way->point);
421 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
424 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
429 cmenu_cb_way_delete(GtkMenuItem *item)
433 printf("%s()\n", __PRETTY_FUNCTION__);
435 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
436 if((way = find_nearest_waypoint(unitx, unity)))
438 gchar buffer[BUFFER_SIZE];
441 snprintf(buffer, sizeof(buffer), "%s:\n%s\n",
442 _("Confirm delete of waypoint"), way->desc);
443 confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), buffer);
445 if(GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm)))
447 Point *pdel_min, *pdel_max, *pdel_start, *pdel_end;
450 /* Delete surrounding route data, too. */
451 if(way == _route.whead)
452 pdel_min = _route.head;
454 pdel_min = way[-1].point;
456 if(way == _route.wtail)
457 pdel_max = _route.tail;
459 pdel_max = way[1].point;
461 /* Find largest continuous segment around the waypoint, EXCLUDING
462 * pdel_min and pdel_max. */
463 for(pdel_start = way->point - 1; pdel_start->unity
464 && pdel_start > pdel_min; pdel_start--) { }
465 for(pdel_end = way->point + 1; pdel_end->unity
466 && pdel_end < pdel_max; pdel_end++) { }
468 /* If pdel_end is set to _route.tail, and if _route.tail is a
469 * non-zero point, then delete _route.tail. */
470 if(pdel_end == _route.tail && pdel_end->unity)
471 pdel_end++; /* delete _route.tail too */
472 /* else, if *both* endpoints are zero points, delete one. */
473 else if(!pdel_start->unity && !pdel_end->unity)
476 /* Delete BETWEEN pdel_start and pdel_end, exclusive. */
477 num_del = pdel_end - pdel_start - 1;
479 memmove(pdel_start + 1, pdel_end,
480 (_route.tail - pdel_end + 1) * sizeof(Point));
481 _route.tail -= num_del;
483 /* Remove waypoint and move/adjust subsequent waypoints. */
485 while(way++ != _route.wtail)
488 way[-1].point -= num_del;
492 route_find_nearest_point();
495 gtk_widget_destroy(confirm);
499 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
502 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
507 cmenu_cb_way_add_poi(GtkMenuItem *item)
511 printf("%s()\n", __PRETTY_FUNCTION__);
513 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
514 if((way = find_nearest_waypoint(unitx, unity)))
515 poi_add_dialog(_window, way->point->unitx, way->point->unity);
518 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
521 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
526 cmenu_cb_poi_route_to(GtkMenuItem *item)
530 printf("%s()\n", __PRETTY_FUNCTION__);
532 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
533 if(select_poi(unitx, unity, &poi, FALSE)) /* FALSE = not quick */
536 latlon2unit(poi.lat, poi.lon, unitx, unity);
537 cmenu_route_to(unitx, unity);
540 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
545 cmenu_cb_poi_distance_to(GtkMenuItem *item)
549 printf("%s()\n", __PRETTY_FUNCTION__);
551 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
552 if(select_poi(unitx, unity, &poi, FALSE)) /* FALSE = not quick */
555 latlon2unit(poi.lat, poi.lon, unitx, unity);
556 cmenu_distance_to(unitx, unity);
559 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
564 cmenu_cb_poi_add_route(GtkMenuItem *item)
568 printf("%s()\n", __PRETTY_FUNCTION__);
570 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
571 if(select_poi(unitx, unity, &poi, FALSE)) /* FALSE = not quick */
574 latlon2unit(poi.lat, poi.lon, unitx, unity);
575 cmenu_add_route(unitx, unity);
578 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
583 cmenu_cb_poi_add_way(GtkMenuItem *item)
587 printf("%s()\n", __PRETTY_FUNCTION__);
589 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
590 if(select_poi(unitx, unity, &poi, FALSE)) /* FALSE = not quick */
593 latlon2unit(poi.lat, poi.lon, unitx, unity);
594 route_add_way_dialog(unitx, unity);
597 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
602 cmenu_cb_poi_edit_poi(GtkMenuItem *item)
606 printf("%s()\n", __PRETTY_FUNCTION__);
608 memset(&poi, 0, sizeof(poi));
609 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
610 select_poi(unitx, unity, &poi, FALSE); /* FALSE = not quick */
611 poi_view_dialog(_window, &poi);
619 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
624 cmenu_cb_hide(GtkMenuItem *item)
626 printf("%s()\n", __PRETTY_FUNCTION__);
629 g_mutex_unlock(_mouse_mutex);
630 _mouse_is_down = _mouse_is_dragging = FALSE;
632 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
638 /* Create needed handles. */
640 GtkWidget *menu_item;
641 printf("%s()\n", __PRETTY_FUNCTION__);
643 /* Setup the context menu. */
644 _map_cmenu = GTK_MENU(gtk_menu_new());
646 /* Setup the map context menu. */
647 gtk_menu_append(_map_cmenu, menu_item
648 = gtk_menu_item_new_with_label(_("Tap Point")));
649 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item),
650 submenu = gtk_menu_new());
652 /* Setup the map context menu. */
653 gtk_menu_append(submenu, _cmenu_loc_show_latlon_item
654 = gtk_menu_item_new_with_label(_("Show Lat/Lon")));
655 gtk_menu_append(submenu, gtk_separator_menu_item_new());
656 gtk_menu_append(submenu, _cmenu_loc_distance_to_item
657 = gtk_menu_item_new_with_label(_("Show Distance to")));
658 gtk_menu_append(submenu, _cmenu_loc_route_to_item
659 = gtk_menu_item_new_with_label(_("Download Route to...")));
660 gtk_menu_append(submenu, _cmenu_loc_download_poi_item
661 = gtk_menu_item_new_with_label(_("Download POI...")));
662 gtk_menu_append(submenu, _cmenu_loc_browse_poi_item
663 = gtk_menu_item_new_with_label(_("Browse POI...")));
664 gtk_menu_append(submenu, gtk_separator_menu_item_new());
665 gtk_menu_append(submenu, _cmenu_loc_add_route_item
666 = gtk_menu_item_new_with_label(_("Add Route Point")));
667 gtk_menu_append(submenu, _cmenu_loc_add_way_item
668 = gtk_menu_item_new_with_label(_("Add Waypoint...")));
669 gtk_menu_append(submenu, _cmenu_loc_add_poi_item
670 = gtk_menu_item_new_with_label(_("Add POI...")));
671 gtk_menu_append(submenu, gtk_separator_menu_item_new());
672 gtk_menu_append(submenu, _cmenu_loc_set_gps_item
673 = gtk_menu_item_new_with_label(_("Set as GPS Location")));
674 gtk_menu_append(submenu, _cmenu_loc_apply_correction_item
675 = gtk_check_menu_item_new_with_label(
676 _("Apply Map Correction")));
677 gtk_check_menu_item_set_active(
678 GTK_CHECK_MENU_ITEM(_cmenu_loc_apply_correction_item),
679 _map_correction_unitx != 0 || _map_correction_unity != 0);
681 /* Setup the waypoint context menu. */
682 gtk_menu_append(_map_cmenu, menu_item
683 = gtk_menu_item_new_with_label(_("Waypoint")));
684 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item),
685 submenu = gtk_menu_new());
687 gtk_menu_append(submenu, _cmenu_way_show_latlon_item
688 = gtk_menu_item_new_with_label(_("Show Lat/Lon")));
689 gtk_menu_append(submenu, _cmenu_way_show_desc_item
690 = gtk_menu_item_new_with_label(_("Show Description")));
691 gtk_menu_append(submenu, _cmenu_way_clip_latlon_item
692 = gtk_menu_item_new_with_label(_("Copy Lat/Lon")));
693 gtk_menu_append(submenu, _cmenu_way_clip_desc_item
694 = gtk_menu_item_new_with_label(_("Copy Description")));
695 gtk_menu_append(submenu, gtk_separator_menu_item_new());
696 gtk_menu_append(submenu, _cmenu_way_distance_to_item
697 = gtk_menu_item_new_with_label(_("Show Distance to")));
698 gtk_menu_append(submenu, _cmenu_way_route_to_item
699 = gtk_menu_item_new_with_label(_("Download Route to...")));
700 gtk_menu_append(submenu, _cmenu_way_delete_item
701 = gtk_menu_item_new_with_label(_("Delete...")));
702 gtk_menu_append(submenu, gtk_separator_menu_item_new());
703 gtk_menu_append(submenu, _cmenu_way_add_poi_item
704 = gtk_menu_item_new_with_label(_("Add POI...")));
705 gtk_menu_append(submenu, gtk_separator_menu_item_new());
706 gtk_menu_append(submenu, _cmenu_way_goto_nextway_item
707 = gtk_menu_item_new_with_label(_("Go to Next")));
709 /* Setup the POI context menu. */
710 gtk_menu_append(_map_cmenu, _cmenu_poi_submenu
711 = gtk_menu_item_new_with_label(_("POI")));
712 gtk_menu_item_set_submenu(GTK_MENU_ITEM(_cmenu_poi_submenu),
713 submenu = gtk_menu_new());
715 gtk_menu_append(submenu, _cmenu_poi_edit_poi_item
716 = gtk_menu_item_new_with_label(_("View/Edit...")));
717 gtk_menu_append(submenu, gtk_separator_menu_item_new());
718 gtk_menu_append(submenu, _cmenu_poi_distance_to_item
719 = gtk_menu_item_new_with_label(_("Show Distance to")));
720 gtk_menu_append(submenu, _cmenu_poi_route_to_item
721 = gtk_menu_item_new_with_label(_("Download Route to...")));
722 gtk_menu_append(submenu, gtk_separator_menu_item_new());
723 gtk_menu_append(submenu, _cmenu_poi_add_route_item
724 = gtk_menu_item_new_with_label(_("Add Route Point")));
725 gtk_menu_append(submenu, _cmenu_poi_add_way_item
726 = gtk_menu_item_new_with_label(_("Add Waypoint...")));
727 gtk_menu_append(submenu, gtk_separator_menu_item_new());
728 gtk_menu_append(submenu, _cmenu_poi_goto_nearpoi_item
729 = gtk_menu_item_new_with_label(_("Go to Nearest")));
731 /* Connect signals for context menu. */
732 g_signal_connect(G_OBJECT(_cmenu_loc_show_latlon_item), "activate",
733 G_CALLBACK(cmenu_cb_loc_show_latlon), NULL);
734 g_signal_connect(G_OBJECT(_cmenu_loc_route_to_item), "activate",
735 G_CALLBACK(cmenu_cb_loc_route_to), NULL);
736 g_signal_connect(G_OBJECT(_cmenu_loc_download_poi_item), "activate",
737 G_CALLBACK(cmenu_cb_loc_download_poi), NULL);
738 g_signal_connect(G_OBJECT(_cmenu_loc_browse_poi_item), "activate",
739 G_CALLBACK(cmenu_cb_loc_browse_poi), NULL);
740 g_signal_connect(G_OBJECT(_cmenu_loc_distance_to_item), "activate",
741 G_CALLBACK(cmenu_cb_loc_distance_to), NULL);
742 g_signal_connect(G_OBJECT(_cmenu_loc_add_route_item), "activate",
743 G_CALLBACK(cmenu_cb_loc_add_route), NULL);
744 g_signal_connect(G_OBJECT(_cmenu_loc_add_way_item), "activate",
745 G_CALLBACK(cmenu_cb_loc_add_way), NULL);
746 g_signal_connect(G_OBJECT(_cmenu_loc_add_poi_item), "activate",
747 G_CALLBACK(cmenu_cb_loc_add_poi), NULL);
748 g_signal_connect(G_OBJECT(_cmenu_loc_set_gps_item), "activate",
749 G_CALLBACK(cmenu_cb_loc_set_gps), NULL);
750 g_signal_connect(G_OBJECT(_cmenu_loc_apply_correction_item), "toggled",
751 G_CALLBACK(cmenu_cb_loc_apply_correction), NULL);
753 g_signal_connect(G_OBJECT(_cmenu_way_show_latlon_item), "activate",
754 G_CALLBACK(cmenu_cb_way_show_latlon), NULL);
755 g_signal_connect(G_OBJECT(_cmenu_way_show_desc_item), "activate",
756 G_CALLBACK(cmenu_cb_way_show_desc), NULL);
757 g_signal_connect(G_OBJECT(_cmenu_way_clip_latlon_item), "activate",
758 G_CALLBACK(cmenu_cb_way_clip_latlon), NULL);
759 g_signal_connect(G_OBJECT(_cmenu_way_clip_desc_item), "activate",
760 G_CALLBACK(cmenu_cb_way_clip_desc), NULL);
761 g_signal_connect(G_OBJECT(_cmenu_way_route_to_item), "activate",
762 G_CALLBACK(cmenu_cb_way_route_to), NULL);
763 g_signal_connect(G_OBJECT(_cmenu_way_distance_to_item), "activate",
764 G_CALLBACK(cmenu_cb_way_distance_to), NULL);
765 g_signal_connect(G_OBJECT(_cmenu_way_delete_item), "activate",
766 G_CALLBACK(cmenu_cb_way_delete), NULL);
767 g_signal_connect(G_OBJECT(_cmenu_way_add_poi_item), "activate",
768 G_CALLBACK(cmenu_cb_way_add_poi), NULL);
769 g_signal_connect(G_OBJECT(_cmenu_way_goto_nextway_item), "activate",
770 G_CALLBACK(menu_cb_view_goto_nextway), NULL);
772 g_signal_connect(G_OBJECT(_cmenu_poi_edit_poi_item), "activate",
773 G_CALLBACK(cmenu_cb_poi_edit_poi), NULL);
774 g_signal_connect(G_OBJECT(_cmenu_poi_route_to_item), "activate",
775 G_CALLBACK(cmenu_cb_poi_route_to), NULL);
776 g_signal_connect(G_OBJECT(_cmenu_poi_distance_to_item), "activate",
777 G_CALLBACK(cmenu_cb_poi_distance_to), NULL);
778 g_signal_connect(G_OBJECT(_cmenu_poi_add_route_item), "activate",
779 G_CALLBACK(cmenu_cb_poi_add_route), NULL);
780 g_signal_connect(G_OBJECT(_cmenu_poi_add_way_item), "activate",
781 G_CALLBACK(cmenu_cb_poi_add_way), NULL);
782 g_signal_connect(G_OBJECT(_cmenu_poi_goto_nearpoi_item), "activate",
783 G_CALLBACK(menu_cb_view_goto_nearpoi), NULL);
785 gtk_widget_show_all(GTK_WIDGET(_map_cmenu));
788 gtk_widget_tap_and_hold_setup(_map_widget, GTK_WIDGET(_map_cmenu), NULL, 0);
791 /* Add a "hide" signal event handler to handle dismissing the context
793 g_signal_connect(GTK_WIDGET(_map_cmenu), "hide",
794 G_CALLBACK(cmenu_cb_hide), NULL);
796 vprintf("%s(): return\n", __PRETTY_FUNCTION__);