From cde8f3e681065e27d7c29395efbbde8ce1ad25f5 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Mon, 11 Jun 2007 23:07:31 +0300 Subject: [PATCH] More toolbar items --- src/cb.c | 31 +++++++++++++++++-------------- src/cb.h | 2 ++ src/ui-common.c | 24 ++++++++++++++++++++---- 3 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/cb.c b/src/cb.c index 1f3e5a7..b4ba737 100644 --- a/src/cb.c +++ b/src/cb.c @@ -1234,8 +1234,17 @@ gboolean cmenu_cb_loc_add_poi(GtkAction * action) { printf("%s()\n", __PRETTY_FUNCTION__); - poi_dialog(ACTION_ADD_POI, - x2unit(_cmenu_position_x), y2unit(_cmenu_position_y)); + poi_dialog(ACTION_ADD_POI, x2unit(_cmenu_position_x), y2unit(_cmenu_position_y)); + + vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); + return TRUE; +} + +gboolean cb_add_poi(GtkAction * action) +{ + printf("%s()\n", __PRETTY_FUNCTION__); + + poi_dialog(ACTION_ADD_POI, _gps.lat, _gps.lon); vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); return TRUE; @@ -1414,10 +1423,8 @@ gboolean cmenu_cb_way_add_poi(GtkAction * action) WayPoint *way; printf("%s()\n", __PRETTY_FUNCTION__); - if ((way = find_nearest_waypoint(x2unit(_cmenu_position_x), - y2unit(_cmenu_position_y)))) - poi_dialog(ACTION_ADD_POI, way->point->unitx, - way->point->unity); + if ((way = find_nearest_waypoint(x2unit(_cmenu_position_x), y2unit(_cmenu_position_y)))) + poi_dialog(ACTION_ADD_POI, way->point->unitx, way->point->unity); vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); return TRUE; @@ -1444,8 +1451,7 @@ gboolean cmenu_cb_poi_distance_to(GtkAction * action) PoiInfo poi; printf("%s()\n", __PRETTY_FUNCTION__); - if (select_poi - (x2unit(_cmenu_position_x), y2unit(_cmenu_position_y), &poi)) { + if (select_poi(x2unit(_cmenu_position_x), y2unit(_cmenu_position_y), &poi)) { guint unitx, unity; latlon2unit(poi.lat, poi.lon, unitx, unity); cmenu_distance_to(unitx, unity); @@ -1460,8 +1466,7 @@ gboolean cmenu_cb_poi_add_route(GtkAction * action) PoiInfo poi; printf("%s()\n", __PRETTY_FUNCTION__); - if (select_poi - (x2unit(_cmenu_position_x), y2unit(_cmenu_position_y), &poi)) { + if (select_poi(x2unit(_cmenu_position_x), y2unit(_cmenu_position_y), &poi)) { guint unitx, unity; latlon2unit(poi.lat, poi.lon, unitx, unity); cmenu_add_route(unitx, unity); @@ -1476,8 +1481,7 @@ gboolean cmenu_cb_poi_add_way(GtkAction * action) PoiInfo poi; printf("%s()\n", __PRETTY_FUNCTION__); - if (select_poi - (x2unit(_cmenu_position_x), y2unit(_cmenu_position_y), &poi)) { + if (select_poi(x2unit(_cmenu_position_x), y2unit(_cmenu_position_y), &poi)) { guint unitx, unity; latlon2unit(poi.lat, poi.lon, unitx, unity); cmenu_route_add_way(unitx, unity); @@ -1491,8 +1495,7 @@ gboolean cmenu_cb_poi_edit_poi(GtkAction * action) { printf("%s()\n", __PRETTY_FUNCTION__); - poi_dialog(ACTION_EDIT_POI, - x2unit(_cmenu_position_x), y2unit(_cmenu_position_y)); + poi_dialog(ACTION_EDIT_POI, x2unit(_cmenu_position_x), y2unit(_cmenu_position_y)); vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); return TRUE; diff --git a/src/cb.h b/src/cb.h index 8306265..43640e0 100644 --- a/src/cb.h +++ b/src/cb.h @@ -95,6 +95,8 @@ gboolean cmenu_cb_loc_add_way(GtkAction * action); gboolean cmenu_cb_loc_add_poi(GtkAction * action); gboolean cmenu_cb_loc_set_gps(GtkAction * action); +gboolean cb_add_poi(GtkAction * action); + /* Callbacks for the "Waypoint" context menu. */ gboolean cmenu_cb_way_show_latlon(GtkAction * action); gboolean cmenu_cb_way_show_desc(GtkAction * action); diff --git a/src/ui-common.c b/src/ui-common.c index 858febc..f941666 100644 --- a/src/ui-common.c +++ b/src/ui-common.c @@ -710,11 +710,27 @@ static void toolbar_init(void) { GtkWidget *item; -#if 0 -item = gtk_tool_button_new_from_stock (GTK_STOCK_REFRESH); +item = gtk_tool_button_new_from_stock (GTK_STOCK_HOME); +gtk_toolbar_insert (GTK_TOOLBAR (_toolbar), item, -1); +/* g_signal_connect (item, "clicked", G_CALLBACK (cb_jump_to_home), NULL); */ + +item = gtk_tool_button_new_from_stock (GTK_STOCK_JUMP_TO); +gtk_toolbar_insert (GTK_TOOLBAR (_toolbar), item, -1); +g_signal_connect (item, "clicked", G_CALLBACK (menu_cb_goto_gps), NULL); + +item = gtk_tool_button_new_from_stock (GTK_STOCK_GO_FORWARD); +gtk_toolbar_insert (GTK_TOOLBAR (_toolbar), item, -1); +g_signal_connect (item, "clicked", G_CALLBACK (menu_cb_goto_nextway), NULL); + +item = gtk_separator_tool_item_new(); +gtk_toolbar_insert (GTK_TOOLBAR (_toolbar), item, -1); + +item = gtk_tool_button_new_from_stock (GTK_STOCK_ADD); +gtk_toolbar_insert (GTK_TOOLBAR (_toolbar), item, -1); +g_signal_connect (item, "clicked", G_CALLBACK (cb_add_poi), NULL); + +item = gtk_separator_tool_item_new(); gtk_toolbar_insert (GTK_TOOLBAR (_toolbar), item, -1); -g_signal_connect (item, "clicked", G_CALLBACK (gtk_main_quit), NULL); -#endif item = gtk_tool_button_new_from_stock (GTK_STOCK_ZOOM_IN); gtk_toolbar_insert (GTK_TOOLBAR (_toolbar), item, -1); -- 2.39.5