]> err.no Git - mapper/commitdiff
Display track waypoints in Track tab.
authorKaj-Michael Lang <milang@onion.tal.org>
Wed, 13 Feb 2008 12:14:43 +0000 (14:14 +0200)
committerKaj-Michael Lang <milang@onion.tal.org>
Wed, 13 Feb 2008 12:14:43 +0000 (14:14 +0200)
Start to add mapping mode toolbar

src/cb.c
src/mapper.c
src/ui-common.c

index ca6c29209dcc3bfb4ec2e4f0e0bc1fe38da485f3..e846a08268fa9d7604ef6ef97f4ff83548538039 100644 (file)
--- a/src/cb.c
+++ b/src/cb.c
 #include "dialogs.h"
 #include "help.h"
 
-gboolean 
-menu_cb_route_download(GtkAction * action)
+static void
+track_tree_view_update_store(GtkWidget *tree_view, Path *track)
 {
 GtkListStore *store;
 
-route_download(NULL);
-store=route_generate_store(&_route);
+store=route_generate_store(track);
 if (store!=NULL) {
-       gtk_tree_view_set_model(route_tree_view, store);
+       gtk_tree_view_set_model(tree_view, store);
        g_object_unref(G_OBJECT(store));
 }
+}
+
+gboolean 
+menu_cb_route_download(GtkAction * action)
+{
+route_download(NULL);
+track_tree_view_update_store(route_tree_view, &_route);
 return TRUE;
 }
 
@@ -82,11 +88,7 @@ menu_cb_route_open(GtkAction * action)
 GtkListStore *store;
 
 route_open_file();
-store=route_generate_store(&_route);
-if (store!=NULL) {
-       gtk_tree_view_set_model(route_tree_view, store);
-       g_object_unref(G_OBJECT(store));
-}
+track_tree_view_update_store(route_tree_view, &_route);
 return TRUE;
 }
 
@@ -125,6 +127,7 @@ gboolean
 menu_cb_track_open(GtkAction * action)
 {
 track_open();
+track_tree_view_update_store(track_tree_view, &_track);
 return TRUE;
 }
 
@@ -139,6 +142,7 @@ gboolean
 menu_cb_track_insert_break(GtkAction * action)
 {
 track_insert_break();
+track_tree_view_update_store(track_tree_view, &_track);
 return TRUE;
 }
 
@@ -146,6 +150,7 @@ gboolean
 menu_cb_track_insert_mark(GtkAction * action)
 {
 track_insert_mark();
+track_tree_view_update_store(track_tree_view, &_track);
 return TRUE;
 }
 
@@ -174,6 +179,7 @@ gboolean
 menu_cb_track_clear(GtkAction * action)
 {
 track_clear();
+track_tree_view_update_store(track_tree_view, &_track);
 return TRUE;
 }
 
index 8ee7956e989ec1ce640de69548fe7279098a44ff..e3ed145c5549332336335cd3dc4664011d0b127a 100644 (file)
@@ -400,14 +400,14 @@ textdomain(GETTEXT_PACKAGE);
 g_thread_init(NULL);
 g_type_init();
 g_set_application_name("Mapper");
+#if defined (WITH_GST)
+gst_init(&argc, &argv);
+#endif
 gtk_init(&argc, &argv);
 if (mapper_osso_init()!=0)
        return 1;
 if (mapper_osso_cb_init()!=0)
        return 1;
-#if defined (WITH_GST)
-gst_init(&argc, &argv);
-#endif
 
 init_progress=gtk_progress_bar_new();
 init_dialog=progress_dialog(NULL, "Mapper is loading...",init_progress);
index c2662f37e82da1afac2dde8d5eb25fc0ac4848a9..75243a68fb7c0f3c861f0d8b8a3b503703804899 100644 (file)
@@ -87,6 +87,9 @@ static const gchar *mapper_ui =
 "       <menuitem action='file_settings_osm'/>"
 "         </menu>"
 "      <separator/>"
+#if 0
+"      <menuitem action='file_import_osm'/>"
+#endif
 "      <menuitem action='file_quit'/>"
 "    </menu>"
 "    <menu action='map' name='map'>"
@@ -195,6 +198,16 @@ static const gchar *mapper_ui =
 #endif
 "    <separator/>"
 "  </toolbar>"
+"  <toolbar name='MappingToolBar'>"
+"    <toolitem action='goto_gps'/>"
+"    <separator/>"
+"    <toolitem action='poi_add'/>"
+"    <toolitem action='poi_quick_add'/>"
+"    <toolitem action='track_insert_break'/>"
+"    <toolitem action='track_insert_mark'/>"
+"    <separator/>"
+"    <toolitem action='search_address'/>"
+"  </toolbar>"
 "</ui>";
 
 static GtkActionEntry ui_entries[] = {
@@ -522,6 +535,9 @@ static GtkWidget *
 mapper_tree_view_new(GtkWidget *container) 
 {
 GtkWidget *tree_view, *sw;
+GtkTreeViewColumn *column;
+GtkCellRenderer *renderer;
+
 tree_view=gtk_tree_view_new();
 sw=gtk_scrolled_window_new(NULL, NULL);
 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
@@ -529,6 +545,19 @@ gtk_container_add(GTK_CONTAINER(sw), tree_view);
 gtk_box_pack_start(container, sw, TRUE, TRUE, 0);
 gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view)), GTK_SELECTION_SINGLE);
 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_view), TRUE);
+
+renderer=gtk_cell_renderer_text_new();
+column=gtk_tree_view_column_new_with_attributes(_("Location"), renderer, "text", ROUTE_LATLON, NULL);
+gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
+
+renderer=gtk_cell_renderer_text_new();
+column=gtk_tree_view_column_new_with_attributes(_("Distance"), renderer, "text", ROUTE_DISTANCE, NULL);
+gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
+
+renderer=gtk_cell_renderer_text_new();
+column=gtk_tree_view_column_new_with_attributes(_("Waypoint"), renderer, "text", ROUTE_WAYPOINT, NULL);
+gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
+
 return tree_view;
 }
 
@@ -675,19 +704,6 @@ ui_notebook.track=gtk_notebook_append_page(notebook, vbox, label);
 vbox=gtk_vbox_new(FALSE, 0);
 label=gtk_label_new("Route");
 route_tree_view=mapper_tree_view_new(vbox);
-
-renderer=gtk_cell_renderer_text_new();
-column=gtk_tree_view_column_new_with_attributes(_("Location"), renderer, "text", ROUTE_LATLON, NULL);
-gtk_tree_view_append_column(GTK_TREE_VIEW(route_tree_view), column);
-
-renderer=gtk_cell_renderer_text_new();
-column=gtk_tree_view_column_new_with_attributes(_("Distance"), renderer, "text", ROUTE_DISTANCE, NULL);
-gtk_tree_view_append_column(GTK_TREE_VIEW(route_tree_view), column);
-
-renderer=gtk_cell_renderer_text_new();
-column=gtk_tree_view_column_new_with_attributes(_("Waypoint"), renderer, "text", ROUTE_WAYPOINT, NULL);
-gtk_tree_view_append_column(GTK_TREE_VIEW(route_tree_view), column);
-
 #if 0
 g_signal_connect(G_OBJECT(route_tree_view), "row-activated", G_CALLBACK(route_waypoint_activated_cb), NULL);
 #endif