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 gint tmp_degformat = _degformat;
65 gint fallback_deg_format = _degformat;
66 gchar buffer[80], tmp1[LL_FMT_LEN], tmp2[LL_FMT_LEN];
68 printf("%s()\n", __PRETTY_FUNCTION__);
70 unit2latlon(unitx, unity, lat, lon);
72 // Check that the current coord system supports the select position
73 if(!coord_system_check_lat_lon (lat, lon, &fallback_deg_format))
75 _degformat = fallback_deg_format;
78 format_lat_lon(lat, lon, tmp1, tmp2);
81 if(DEG_FORMAT_ENUM_TEXT[_degformat].field_2_in_use)
83 snprintf(buffer, sizeof(buffer),
86 DEG_FORMAT_ENUM_TEXT[_degformat].long_field_1, tmp1,
87 DEG_FORMAT_ENUM_TEXT[_degformat].long_field_2, tmp2);
91 snprintf(buffer, sizeof(buffer),
93 DEG_FORMAT_ENUM_TEXT[_degformat].long_field_1, tmp1);
96 MACRO_BANNER_SHOW_INFO(_window, buffer);
98 _degformat = tmp_degformat;
100 vprintf("%s(): return\n", __PRETTY_FUNCTION__);
104 cmenu_clip_latlon(gint unitx, gint unity)
108 printf("%s()\n", __PRETTY_FUNCTION__);
110 unit2latlon(unitx, unity, lat, lon);
112 snprintf(buffer, sizeof(buffer), "%.06f,%.06f", lat, lon);
114 gtk_clipboard_set_text(
115 gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), buffer, -1);
117 vprintf("%s(): return\n", __PRETTY_FUNCTION__);
121 cmenu_route_to(gint unitx, gint unity)
127 printf("%s()\n", __PRETTY_FUNCTION__);
129 unit2latlon(unitx, unity, lat, lon);
131 g_ascii_formatd(strlat, 32, "%.06f", lat);
132 g_ascii_formatd(strlon, 32, "%.06f", lon);
133 snprintf(buffer, sizeof(buffer), "%s, %s", strlat, strlon);
135 route_download(buffer);
137 vprintf("%s(): return\n", __PRETTY_FUNCTION__);
141 cmenu_distance_to(gint unitx, gint unity)
145 printf("%s()\n", __PRETTY_FUNCTION__);
147 unit2latlon(unitx, unity, lat, lon);
149 snprintf(buffer, sizeof(buffer), "%s: %.02f %s", _("Distance"),
150 calculate_distance(_gps.lat, _gps.lon, lat, lon)
151 * UNITS_CONVERT[_units],
152 UNITS_ENUM_TEXT[_units]);
153 MACRO_BANNER_SHOW_INFO(_window, buffer);
155 vprintf("%s(): return\n", __PRETTY_FUNCTION__);
159 cmenu_add_route(gint unitx, gint unity)
161 printf("%s()\n", __PRETTY_FUNCTION__);
162 MACRO_PATH_INCREMENT_TAIL(_route);
163 screen2unit(_cmenu_position_x, _cmenu_position_y,
164 _route.tail->unitx, _route.tail->unity);
165 route_find_nearest_point();
167 vprintf("%s(): return\n", __PRETTY_FUNCTION__);
171 cmenu_cb_loc_show_latlon(GtkMenuItem *item)
175 printf("%s()\n", __PRETTY_FUNCTION__);
177 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
178 unit2latlon(unitx, unity, lat, lon);
180 latlon_dialog(lat, lon);
182 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
187 cmenu_cb_loc_route_to(GtkMenuItem *item)
190 printf("%s()\n", __PRETTY_FUNCTION__);
192 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
193 cmenu_route_to(unitx, unity);
195 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
200 cmenu_cb_loc_download_poi(GtkMenuItem *item)
203 printf("%s()\n", __PRETTY_FUNCTION__);
205 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
206 poi_download_dialog(unitx, unity);
208 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
213 cmenu_cb_loc_browse_poi(GtkMenuItem *item)
216 printf("%s()\n", __PRETTY_FUNCTION__);
218 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
219 poi_browse_dialog(unitx, unity);
221 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
226 cmenu_cb_loc_distance_to(GtkMenuItem *item)
229 printf("%s()\n", __PRETTY_FUNCTION__);
231 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
232 cmenu_distance_to(unitx, unity);
234 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
239 cmenu_cb_loc_add_route(GtkMenuItem *item)
242 printf("%s()\n", __PRETTY_FUNCTION__);
244 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
245 cmenu_add_route(unitx, unity);
247 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
252 cmenu_cb_loc_add_way(GtkMenuItem *item)
255 printf("%s()\n", __PRETTY_FUNCTION__);
257 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
258 route_add_way_dialog(unitx, unity);
260 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
265 cmenu_cb_loc_add_poi(GtkMenuItem *item)
268 printf("%s()\n", __PRETTY_FUNCTION__);
270 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
271 poi_add_dialog(_window, unitx, unity);
273 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
278 cmenu_cb_loc_set_gps(GtkMenuItem *item)
280 printf("%s()\n", __PRETTY_FUNCTION__);
282 screen2unit(_cmenu_position_x, _cmenu_position_y, _pos.unitx, _pos.unity);
283 unit2latlon(_pos.unitx, _pos.unity, _gps.lat, _gps.lon);
285 /* Move mark to new location. */
286 map_refresh_mark(_center_mode > 0);
288 GConfClient *gconf_client = gconf_client_get_default();
291 gconf_client_set_float(gconf_client, GCONF_KEY_SUPL_LON, _gps.lon, NULL);
292 gconf_client_set_float(gconf_client, GCONF_KEY_SUPL_LAT, _gps.lat, NULL);
293 g_get_current_time(&curtime);
294 gconf_client_set_float(gconf_client, GCONF_KEY_SUPL_TIME, curtime.tv_sec, NULL);
296 g_object_unref(gconf_client);
298 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
303 cmenu_cb_loc_apply_correction(GtkMenuItem *item)
305 printf("%s()\n", __PRETTY_FUNCTION__);
307 if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)))
309 /* Get difference between tap point and GPS location. */
311 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
312 _map_correction_unitx = unitx - _pos.unitx;
313 _map_correction_unity = unity - _pos.unity;
314 map_refresh_mark(TRUE);
315 MACRO_BANNER_SHOW_INFO(_window, _("Map correction applied."));
319 _map_correction_unitx = 0;
320 _map_correction_unity = 0;
321 map_refresh_mark(TRUE);
322 MACRO_BANNER_SHOW_INFO(_window, _("Map correction removed."));
325 printf("Map correction now set to: %d, %d\n");
327 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
332 cmenu_cb_way_show_latlon(GtkMenuItem *item)
336 printf("%s()\n", __PRETTY_FUNCTION__);
338 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
339 if((way = find_nearest_waypoint(unitx, unity)))
340 cmenu_show_latlon(way->point->unitx, way->point->unity);
343 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
347 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
352 cmenu_cb_way_show_desc(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)))
361 MACRO_BANNER_SHOW_INFO(_window, way->desc);
365 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
368 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
373 cmenu_cb_way_clip_latlon(GtkMenuItem *item)
377 printf("%s()\n", __PRETTY_FUNCTION__);
379 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
380 if((way = find_nearest_waypoint(unitx, unity)))
381 cmenu_clip_latlon(way->point->unitx, way->point->unity);
384 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
387 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
392 cmenu_cb_way_clip_desc(GtkMenuItem *item)
396 printf("%s()\n", __PRETTY_FUNCTION__);
398 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
399 if((way = find_nearest_waypoint(unitx, unity)))
400 gtk_clipboard_set_text(
401 gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), way->desc, -1);
404 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
407 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
412 cmenu_cb_way_route_to(GtkMenuItem *item)
416 printf("%s()\n", __PRETTY_FUNCTION__);
418 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
419 if((way = find_nearest_waypoint(unitx, unity)))
420 cmenu_route_to(way->point->unitx, way->point->unity);
423 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
426 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
431 cmenu_cb_way_distance_to(GtkMenuItem *item)
435 printf("%s()\n", __PRETTY_FUNCTION__);
437 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
438 if((way = find_nearest_waypoint(unitx, unity)))
439 route_show_distance_to(way->point);
442 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
445 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
450 cmenu_cb_way_delete(GtkMenuItem *item)
454 printf("%s()\n", __PRETTY_FUNCTION__);
456 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
457 if((way = find_nearest_waypoint(unitx, unity)))
459 gchar buffer[BUFFER_SIZE];
462 snprintf(buffer, sizeof(buffer), "%s:\n%s\n",
463 _("Confirm delete of waypoint"), way->desc);
464 confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), buffer);
466 if(GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm)))
468 Point *pdel_min, *pdel_max, *pdel_start, *pdel_end;
471 /* Delete surrounding route data, too. */
472 if(way == _route.whead)
473 pdel_min = _route.head;
475 pdel_min = way[-1].point;
477 if(way == _route.wtail)
478 pdel_max = _route.tail;
480 pdel_max = way[1].point;
482 /* Find largest continuous segment around the waypoint, EXCLUDING
483 * pdel_min and pdel_max. */
484 for(pdel_start = way->point - 1; pdel_start->unity
485 && pdel_start > pdel_min; pdel_start--) { }
486 for(pdel_end = way->point + 1; pdel_end->unity
487 && pdel_end < pdel_max; pdel_end++) { }
489 /* If pdel_end is set to _route.tail, and if _route.tail is a
490 * non-zero point, then delete _route.tail. */
491 if(pdel_end == _route.tail && pdel_end->unity)
492 pdel_end++; /* delete _route.tail too */
493 /* else, if *both* endpoints are zero points, delete one. */
494 else if(!pdel_start->unity && !pdel_end->unity)
497 /* Delete BETWEEN pdel_start and pdel_end, exclusive. */
498 num_del = pdel_end - pdel_start - 1;
500 memmove(pdel_start + 1, pdel_end,
501 (_route.tail - pdel_end + 1) * sizeof(Point));
502 _route.tail -= num_del;
504 /* Remove waypoint and move/adjust subsequent waypoints. */
506 while(way++ != _route.wtail)
509 way[-1].point -= num_del;
513 route_find_nearest_point();
516 gtk_widget_destroy(confirm);
520 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
523 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
528 cmenu_cb_way_add_poi(GtkMenuItem *item)
532 printf("%s()\n", __PRETTY_FUNCTION__);
534 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
535 if((way = find_nearest_waypoint(unitx, unity)))
536 poi_add_dialog(_window, way->point->unitx, way->point->unity);
539 MACRO_BANNER_SHOW_INFO(_window, _("There are no waypoints."));
542 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
547 cmenu_cb_poi_route_to(GtkMenuItem *item)
551 printf("%s()\n", __PRETTY_FUNCTION__);
553 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
554 if(select_poi(unitx, unity, &poi, FALSE)) /* FALSE = not quick */
557 latlon2unit(poi.lat, poi.lon, unitx, unity);
558 cmenu_route_to(unitx, unity);
561 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
566 cmenu_cb_poi_distance_to(GtkMenuItem *item)
570 printf("%s()\n", __PRETTY_FUNCTION__);
572 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
573 if(select_poi(unitx, unity, &poi, FALSE)) /* FALSE = not quick */
576 latlon2unit(poi.lat, poi.lon, unitx, unity);
577 cmenu_distance_to(unitx, unity);
580 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
585 cmenu_cb_poi_add_route(GtkMenuItem *item)
589 printf("%s()\n", __PRETTY_FUNCTION__);
591 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
592 if(select_poi(unitx, unity, &poi, FALSE)) /* FALSE = not quick */
595 latlon2unit(poi.lat, poi.lon, unitx, unity);
596 cmenu_add_route(unitx, unity);
599 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
604 cmenu_cb_poi_add_way(GtkMenuItem *item)
608 printf("%s()\n", __PRETTY_FUNCTION__);
610 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
611 if(select_poi(unitx, unity, &poi, FALSE)) /* FALSE = not quick */
614 latlon2unit(poi.lat, poi.lon, unitx, unity);
615 route_add_way_dialog(unitx, unity);
618 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
623 cmenu_cb_poi_edit_poi(GtkMenuItem *item)
627 printf("%s()\n", __PRETTY_FUNCTION__);
629 memset(&poi, 0, sizeof(poi));
630 screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
631 select_poi(unitx, unity, &poi, FALSE); /* FALSE = not quick */
632 poi_view_dialog(_window, &poi);
640 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
645 cmenu_cb_hide(GtkMenuItem *item)
647 printf("%s()\n", __PRETTY_FUNCTION__);
650 g_mutex_unlock(_mouse_mutex);
651 _mouse_is_down = _mouse_is_dragging = FALSE;
653 vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
659 /* Create needed handles. */
661 GtkWidget *menu_item;
662 printf("%s()\n", __PRETTY_FUNCTION__);
664 /* Setup the context menu. */
665 _map_cmenu = GTK_MENU(gtk_menu_new());
667 /* Setup the map context menu. */
668 gtk_menu_append(_map_cmenu, menu_item
669 = gtk_menu_item_new_with_label(_("Tap Point")));
670 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item),
671 submenu = gtk_menu_new());
673 /* Setup the map context menu. */
674 gtk_menu_append(submenu, _cmenu_loc_show_latlon_item
675 = gtk_menu_item_new_with_label(_("Show Position")));
676 gtk_menu_append(submenu, gtk_separator_menu_item_new());
677 gtk_menu_append(submenu, _cmenu_loc_distance_to_item
678 = gtk_menu_item_new_with_label(_("Show Distance to")));
679 gtk_menu_append(submenu, _cmenu_loc_route_to_item
680 = gtk_menu_item_new_with_label(_("Download Route to...")));
681 gtk_menu_append(submenu, _cmenu_loc_download_poi_item
682 = gtk_menu_item_new_with_label(_("Download POI...")));
683 gtk_menu_append(submenu, _cmenu_loc_browse_poi_item
684 = gtk_menu_item_new_with_label(_("Browse POI...")));
685 gtk_menu_append(submenu, gtk_separator_menu_item_new());
686 gtk_menu_append(submenu, _cmenu_loc_add_route_item
687 = gtk_menu_item_new_with_label(_("Add Route Point")));
688 gtk_menu_append(submenu, _cmenu_loc_add_way_item
689 = gtk_menu_item_new_with_label(_("Add Waypoint...")));
690 gtk_menu_append(submenu, _cmenu_loc_add_poi_item
691 = gtk_menu_item_new_with_label(_("Add POI...")));
692 gtk_menu_append(submenu, gtk_separator_menu_item_new());
693 gtk_menu_append(submenu, _cmenu_loc_set_gps_item
694 = gtk_menu_item_new_with_label(_("Set as GPS Location")));
695 gtk_menu_append(submenu, _cmenu_loc_apply_correction_item
696 = gtk_check_menu_item_new_with_label(
697 _("Apply Map Correction")));
698 gtk_check_menu_item_set_active(
699 GTK_CHECK_MENU_ITEM(_cmenu_loc_apply_correction_item),
700 _map_correction_unitx != 0 || _map_correction_unity != 0);
702 /* Setup the waypoint context menu. */
703 gtk_menu_append(_map_cmenu, menu_item
704 = gtk_menu_item_new_with_label(_("Waypoint")));
705 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item),
706 submenu = gtk_menu_new());
708 gtk_menu_append(submenu, _cmenu_way_show_latlon_item
709 = gtk_menu_item_new_with_label(_("Show Position")));
710 gtk_menu_append(submenu, _cmenu_way_show_desc_item
711 = gtk_menu_item_new_with_label(_("Show Description")));
712 gtk_menu_append(submenu, _cmenu_way_clip_latlon_item
713 = gtk_menu_item_new_with_label(_("Copy Position")));
714 gtk_menu_append(submenu, _cmenu_way_clip_desc_item
715 = gtk_menu_item_new_with_label(_("Copy Description")));
716 gtk_menu_append(submenu, gtk_separator_menu_item_new());
717 gtk_menu_append(submenu, _cmenu_way_distance_to_item
718 = gtk_menu_item_new_with_label(_("Show Distance to")));
719 gtk_menu_append(submenu, _cmenu_way_route_to_item
720 = gtk_menu_item_new_with_label(_("Download Route to...")));
721 gtk_menu_append(submenu, _cmenu_way_delete_item
722 = gtk_menu_item_new_with_label(_("Delete...")));
723 gtk_menu_append(submenu, gtk_separator_menu_item_new());
724 gtk_menu_append(submenu, _cmenu_way_add_poi_item
725 = gtk_menu_item_new_with_label(_("Add POI...")));
726 gtk_menu_append(submenu, gtk_separator_menu_item_new());
727 gtk_menu_append(submenu, _cmenu_way_goto_nextway_item
728 = gtk_menu_item_new_with_label(_("Go to Next")));
730 /* Setup the POI context menu. */
731 gtk_menu_append(_map_cmenu, _cmenu_poi_submenu
732 = gtk_menu_item_new_with_label(_("POI")));
733 gtk_menu_item_set_submenu(GTK_MENU_ITEM(_cmenu_poi_submenu),
734 submenu = gtk_menu_new());
736 gtk_menu_append(submenu, _cmenu_poi_edit_poi_item
737 = gtk_menu_item_new_with_label(_("View/Edit...")));
738 gtk_menu_append(submenu, gtk_separator_menu_item_new());
739 gtk_menu_append(submenu, _cmenu_poi_distance_to_item
740 = gtk_menu_item_new_with_label(_("Show Distance to")));
741 gtk_menu_append(submenu, _cmenu_poi_route_to_item
742 = gtk_menu_item_new_with_label(_("Download Route to...")));
743 gtk_menu_append(submenu, gtk_separator_menu_item_new());
744 gtk_menu_append(submenu, _cmenu_poi_add_route_item
745 = gtk_menu_item_new_with_label(_("Add Route Point")));
746 gtk_menu_append(submenu, _cmenu_poi_add_way_item
747 = gtk_menu_item_new_with_label(_("Add Waypoint...")));
748 gtk_menu_append(submenu, gtk_separator_menu_item_new());
749 gtk_menu_append(submenu, _cmenu_poi_goto_nearpoi_item
750 = gtk_menu_item_new_with_label(_("Go to Nearest")));
752 /* Connect signals for context menu. */
753 g_signal_connect(G_OBJECT(_cmenu_loc_show_latlon_item), "activate",
754 G_CALLBACK(cmenu_cb_loc_show_latlon), NULL);
755 g_signal_connect(G_OBJECT(_cmenu_loc_route_to_item), "activate",
756 G_CALLBACK(cmenu_cb_loc_route_to), NULL);
757 g_signal_connect(G_OBJECT(_cmenu_loc_download_poi_item), "activate",
758 G_CALLBACK(cmenu_cb_loc_download_poi), NULL);
759 g_signal_connect(G_OBJECT(_cmenu_loc_browse_poi_item), "activate",
760 G_CALLBACK(cmenu_cb_loc_browse_poi), NULL);
761 g_signal_connect(G_OBJECT(_cmenu_loc_distance_to_item), "activate",
762 G_CALLBACK(cmenu_cb_loc_distance_to), NULL);
763 g_signal_connect(G_OBJECT(_cmenu_loc_add_route_item), "activate",
764 G_CALLBACK(cmenu_cb_loc_add_route), NULL);
765 g_signal_connect(G_OBJECT(_cmenu_loc_add_way_item), "activate",
766 G_CALLBACK(cmenu_cb_loc_add_way), NULL);
767 g_signal_connect(G_OBJECT(_cmenu_loc_add_poi_item), "activate",
768 G_CALLBACK(cmenu_cb_loc_add_poi), NULL);
769 g_signal_connect(G_OBJECT(_cmenu_loc_set_gps_item), "activate",
770 G_CALLBACK(cmenu_cb_loc_set_gps), NULL);
771 g_signal_connect(G_OBJECT(_cmenu_loc_apply_correction_item), "toggled",
772 G_CALLBACK(cmenu_cb_loc_apply_correction), NULL);
774 g_signal_connect(G_OBJECT(_cmenu_way_show_latlon_item), "activate",
775 G_CALLBACK(cmenu_cb_way_show_latlon), NULL);
776 g_signal_connect(G_OBJECT(_cmenu_way_show_desc_item), "activate",
777 G_CALLBACK(cmenu_cb_way_show_desc), NULL);
778 g_signal_connect(G_OBJECT(_cmenu_way_clip_latlon_item), "activate",
779 G_CALLBACK(cmenu_cb_way_clip_latlon), NULL);
780 g_signal_connect(G_OBJECT(_cmenu_way_clip_desc_item), "activate",
781 G_CALLBACK(cmenu_cb_way_clip_desc), NULL);
782 g_signal_connect(G_OBJECT(_cmenu_way_route_to_item), "activate",
783 G_CALLBACK(cmenu_cb_way_route_to), NULL);
784 g_signal_connect(G_OBJECT(_cmenu_way_distance_to_item), "activate",
785 G_CALLBACK(cmenu_cb_way_distance_to), NULL);
786 g_signal_connect(G_OBJECT(_cmenu_way_delete_item), "activate",
787 G_CALLBACK(cmenu_cb_way_delete), NULL);
788 g_signal_connect(G_OBJECT(_cmenu_way_add_poi_item), "activate",
789 G_CALLBACK(cmenu_cb_way_add_poi), NULL);
790 g_signal_connect(G_OBJECT(_cmenu_way_goto_nextway_item), "activate",
791 G_CALLBACK(menu_cb_view_goto_nextway), NULL);
793 g_signal_connect(G_OBJECT(_cmenu_poi_edit_poi_item), "activate",
794 G_CALLBACK(cmenu_cb_poi_edit_poi), NULL);
795 g_signal_connect(G_OBJECT(_cmenu_poi_route_to_item), "activate",
796 G_CALLBACK(cmenu_cb_poi_route_to), NULL);
797 g_signal_connect(G_OBJECT(_cmenu_poi_distance_to_item), "activate",
798 G_CALLBACK(cmenu_cb_poi_distance_to), NULL);
799 g_signal_connect(G_OBJECT(_cmenu_poi_add_route_item), "activate",
800 G_CALLBACK(cmenu_cb_poi_add_route), NULL);
801 g_signal_connect(G_OBJECT(_cmenu_poi_add_way_item), "activate",
802 G_CALLBACK(cmenu_cb_poi_add_way), NULL);
803 g_signal_connect(G_OBJECT(_cmenu_poi_goto_nearpoi_item), "activate",
804 G_CALLBACK(menu_cb_view_goto_nearpoi), NULL);
806 gtk_widget_show_all(GTK_WIDGET(_map_cmenu));
809 gtk_widget_tap_and_hold_setup(_map_widget, GTK_WIDGET(_map_cmenu), NULL, 0);
812 /* Add a "hide" signal event handler to handle dismissing the context
814 g_signal_connect(GTK_WIDGET(_map_cmenu), "hide",
815 G_CALLBACK(cmenu_cb_hide), NULL);
817 vprintf("%s(): return\n", __PRETTY_FUNCTION__);