From 610d0046069afc49e0aaaac09cde5c7434879de7 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Wed, 13 Feb 2008 14:14:43 +0200 Subject: [PATCH] Display track waypoints in Track tab. Start to add mapping mode toolbar --- src/cb.c | 26 ++++++++++++++++---------- src/mapper.c | 6 +++--- src/ui-common.c | 42 +++++++++++++++++++++++++++++------------- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/src/cb.c b/src/cb.c index ca6c292..e846a08 100644 --- a/src/cb.c +++ b/src/cb.c @@ -62,17 +62,23 @@ #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; } diff --git a/src/mapper.c b/src/mapper.c index 8ee7956..e3ed145 100644 --- a/src/mapper.c +++ b/src/mapper.c @@ -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); diff --git a/src/ui-common.c b/src/ui-common.c index c2662f3..75243a6 100644 --- a/src/ui-common.c +++ b/src/ui-common.c @@ -87,6 +87,9 @@ static const gchar *mapper_ui = " " " " " " +#if 0 +" " +#endif " " " " " " @@ -195,6 +198,16 @@ static const gchar *mapper_ui = #endif " " " " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " ""; 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 -- 2.39.5