summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Curley <charlescurley@users.noreply.github.com>2018-08-30 00:08:15 -0600
committerPierre GRANDIN <pgrandin@users.noreply.github.com>2018-08-29 23:08:15 -0700
commit751676252e813ab32196f48763d103314125cfb9 (patch)
treea8da846cbcd5d199e95db4e98e11fa611d716af2
parentb52b58f8931c81b4d36677405780eac25835d803 (diff)
downloadnavit-751676252e813ab32196f48763d103314125cfb9.tar.gz
Curley distance poi (#638)
* 1) Changed the translation string for "Distance(m)" from "" to "Distance". Rational: the "m" is ambiguous, it could be meters or miles. However, in the POI context, feet are more likely than miles. So take it out entirely. I did it this way rather than run sed on the entire collection of po input files. 2) The display code sorts the entries by distance. It has no way of knowing if "5" is five miles or five feet. So we leave the distances in feet or meters (depending on the setting for imperial). Allowing kilometers or miles might be a future enhancement. 3) See bug 556 (https://github.com/navit-gps/navit/issues/556). Rather than remove the spurious one as part of this fix, I will leave that to later. But both now have the same English "translation", "Select a search radius from screen center". This hides the problem, at least from English users. This affects all four en_*.po.in files. 4) Someone who knows more than I do about the translation strings might have a better idea. Particularly, is there a graceful way to indicate the input units, either miles or kilometers? modified: navit/gui/gtk/gui_gtk_poi.c modified: po/en.po.in modified: po/en_AU.po.in modified: po/en_CA.po.in modified: po/en_GB.po.in * Made it prettier. Reformatted one commented and tabified the thing. modified: navit/gui/gtk/gui_gtk_poi.c * Replaced one of the two source strings for the PoI window prompt for inputting the search radius. Pull Request 557. modified: navit/gui/gtk/gui_gtk_poi.c modified: po/af.po.in modified: po/ar.po.in modified: po/ast.po.in modified: po/be.po.in modified: po/bg.po.in modified: po/bs.po.in modified: po/ca.po.in modified: po/ckb.po.in modified: po/cs.po.in modified: po/cy.po.in modified: po/da.po.in modified: po/de.po.in modified: po/de_CH.po.in modified: po/el.po.in modified: po/en.po.in modified: po/en_AU.po.in modified: po/en_CA.po.in modified: po/en_GB.po.in modified: po/eo.po.in modified: po/es.po.in modified: po/et.po.in modified: po/eu.po.in modified: po/fa.po.in modified: po/fi.po.in modified: po/fil.po.in modified: po/fo.po.in modified: po/fr.po.in modified: po/fr_CH.po.in modified: po/fy.po.in modified: po/gl.po.in modified: po/he.po.in modified: po/hi.po.in modified: po/hr.po.in modified: po/hu.po.in modified: po/id.po.in modified: po/it.po.in modified: po/ja.po.in modified: po/jv.po.in modified: po/kk.po.in modified: po/kn.po.in modified: po/ko.po.in modified: po/ku.po.in modified: po/lb.po.in modified: po/lt.po.in modified: po/lv.po.in modified: po/mk.po.in modified: po/ml.po.in modified: po/mn.po.in modified: po/mr.po.in modified: po/nb.po.in modified: po/nds.po.in modified: po/nl.po.in modified: po/nn.po.in modified: po/pl.po.in modified: po/pms.po.in modified: po/pt.po.in modified: po/pt_BR.po.in modified: po/ro.po.in modified: po/ru.po.in modified: po/sc.po.in modified: po/si.po.in modified: po/sk.po.in modified: po/sl.po.in modified: po/sq.po.in modified: po/sr.po.in modified: po/sv.po.in modified: po/sw.po.in modified: po/ta.po.in modified: po/te.po.in modified: po/th.po.in modified: po/tr.po.in modified: po/uk.po.in modified: po/ur.po.in modified: po/vi.po.in modified: po/zh_CN.po.in modified: po/zh_HK.po.in modified: po/zh_TW.po.in * The distance to points of interest has been rendered in kilometers even if the user has asked for imperial. This commit fixes that. We convert to feet only, and not miles, because the code sorts on the numeric value of the distance, so it doesn't like two different units. Currently, the distance is an int. Can it be made a float? Possible future enhancement? modified: navit/gui/gtk/gui_gtk_poi.c * Improved comment. modified: navit/gui/gtk/gui_gtk_poi.c
-rw-r--r--navit/gui/gtk/gui_gtk_poi.c369
1 files changed, 191 insertions, 178 deletions
diff --git a/navit/gui/gtk/gui_gtk_poi.c b/navit/gui/gtk/gui_gtk_poi.c
index ac2fa2221..b157bf2df 100644
--- a/navit/gui/gtk/gui_gtk_poi.c
+++ b/navit/gui/gtk/gui_gtk_poi.c
@@ -35,20 +35,20 @@
#include "attr.h"
#include "util.h"
-#include "navigation.h" /* for KILOMETERS_TO_MILES */
-
-static struct gtk_poi_search {
- GtkWidget *entry_distance;
- GtkWidget *label_distance;
- GtkWidget *treeview_cat;
- GtkWidget *treeview_poi;
- GtkWidget *button_visit, *button_destination, *button_map;
- GtkListStore *store_poi;
- GtkListStore *store_cat;
- GtkTreeModel *store_poi_sorted;
- GtkTreeModel *store_cat_sorted;
- char *selected_cat;
- struct navit *nav;
+#include "navigation.h" /* for FEET_PER_METER and other conversion factors. */
+
+static struct gtk_poi_search{
+ GtkWidget *entry_distance;
+ GtkWidget *label_distance;
+ GtkWidget *treeview_cat;
+ GtkWidget *treeview_poi;
+ GtkWidget *button_visit, *button_destination, *button_map;
+ GtkListStore *store_poi;
+ GtkListStore *store_cat;
+ GtkTreeModel *store_poi_sorted;
+ GtkTreeModel *store_cat_sorted;
+ char *selected_cat;
+ struct navit *nav;
} gtk_poi_search;
static GdkPixbuf *geticon(const char *name) {
@@ -101,86 +101,90 @@ static GtkTreeModel *category_list_model(struct gtk_poi_search *search) {
/** Construct model of POIs from map information. */
-static GtkTreeModel *model_poi (struct gtk_poi_search *search) {
- GtkTreeIter iter;
- struct map_selection *sel,*selm;
- struct coord coord_item,center;
- struct pcoord pc;
- struct mapset_handle *h;
- int search_distance_meters; /* distance to search the POI database, in meters, from the center of the screen. */
- int idist; /* idist appears to be the distance in meters from the center of the screen to a POI. */
- struct map *m;
- struct map_rect *mr;
- struct item *item;
- struct point cursor_position;
- enum item_type selected;
-
- /* Respect the Imperial attribute as we enlighten the user. */
- struct attr attr;
- int imperial = FALSE; /* default to using metric measures. */
- if (navit_get_attr(gtk_poi_search.nav, attr_imperial, &attr, NULL))
- imperial=attr.u.num;
-
- if (imperial == FALSE) {
- /* Input is in kilometers */
- search_distance_meters=1000*atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance)));
- } else {
- /* Input is in miles. */
- search_distance_meters=atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance)))/METERS_TO_MILES;
- }
-
- cursor_position.x=navit_get_width(search->nav)/2;
- cursor_position.y=navit_get_height(search->nav)/2;
- gtk_label_set_text(GTK_LABEL(search->label_distance),_("Select a search radius from screen center"));
-
- transform_reverse(navit_get_trans(search->nav), &cursor_position, &center);
- pc.pro = transform_get_projection(navit_get_trans(search->nav));
- pc.x = center.x;
- pc.y = center.y;
-
- //Search in the map, for pois
- sel=map_selection_rect_new(&pc,search_distance_meters*transform_scale(abs(center.y)+search_distance_meters*1.5),18);
- gtk_list_store_clear(search->store_poi);
-
- h=mapset_open(navit_get_mapset(search->nav));
-
- selected=item_from_name(search->selected_cat);
- while ((m=mapset_next(h, 1))) {
- selm=map_selection_dup_pro(sel, projection_mg, map_projection(m));
- mr=map_rect_new(m, selm);
- if (mr) {
- while ((item=map_rect_get_item(mr))) {
- struct attr label_attr;
- item_attr_get(item,attr_label,&label_attr);
- item_coord_get(item,&coord_item,1);
- idist=transform_distance(1,&center,&coord_item);
- if (item->type==selected && idist<=search_distance_meters) {
- char direction[5];
- gtk_list_store_append(search->store_poi, &iter);
- get_compass_direction(direction,transform_get_angle_delta(&center,&coord_item,0),1);
-
- /**
- * If the user has selected imperial, translate idist from meters to
- * feet. We convert to feet only, and not miles, because the code
- * sorts on the numeric value of the distance, so it doesn't like two
- * different units. Possible future enhancement?
- */
- if (imperial != FALSE) {
- idist = idist * (FEET_PER_METER); /* convert meters to feet. */
- }
-
- gtk_list_store_set(search->store_poi, &iter, 0,direction, 1,idist,
- 2,g_strdup(label_attr.u.str), 3,coord_item.x, 4,coord_item.y,-1);
- }
- }
- map_rect_destroy(mr);
- }
- map_selection_destroy(selm);
- }
- map_selection_destroy(sel);
- mapset_close(h);
-
- return GTK_TREE_MODEL (search->store_poi_sorted);
+static GtkTreeModel *
+model_poi (struct gtk_poi_search *search)
+{
+ GtkTreeIter iter;
+ struct map_selection *sel,*selm;
+ struct coord coord_item,center;
+ struct pcoord pc;
+ struct mapset_handle *h;
+ int search_distance_meters; /* distance to search the POI database, in meters, from the center of the screen. */
+ int idist; /* idist appears to be the distance in meters from the center of the screen to a POI. */
+ struct map *m;
+ struct map_rect *mr;
+ struct item *item;
+ struct point cursor_position;
+ enum item_type selected;
+
+ /* Respect the Imperial attribute as we enlighten the user. */
+ struct attr attr;
+ int imperial = FALSE; /* default to using metric measures. */
+ if (navit_get_attr(gtk_poi_search.nav, attr_imperial, &attr, NULL))
+ imperial=attr.u.num;
+
+ if (imperial == FALSE) {
+ /* Input is in kilometers */
+ search_distance_meters=1000*atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance)));
+ gtk_label_set_text(GTK_LABEL(search->label_distance),_("Select a search radius from screen center in km"));
+ } else {
+ /* Input is in miles. */
+ search_distance_meters=atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance)))/METERS_TO_MILES;
+ gtk_label_set_text(GTK_LABEL(search->label_distance),_("Select a search radius from screen center in miles"));
+ }
+
+ cursor_position.x=navit_get_width(search->nav)/2;
+ cursor_position.y=navit_get_height(search->nav)/2;
+
+ transform_reverse(navit_get_trans(search->nav), &cursor_position, &center);
+ pc.pro = transform_get_projection(navit_get_trans(search->nav));
+ pc.x = center.x;
+ pc.y = center.y;
+
+ //Search in the map, for pois
+ sel=map_selection_rect_new(&pc ,search_distance_meters*transform_scale(abs(center.y)+search_distance_meters*1.5),18);
+ gtk_list_store_clear(search->store_poi);
+
+ h=mapset_open(navit_get_mapset(search->nav));
+
+ selected=item_from_name(search->selected_cat);
+ while ((m=mapset_next(h, 1))) {
+ selm=map_selection_dup_pro(sel, projection_mg, map_projection(m));
+ mr=map_rect_new(m, selm);
+ if (mr) {
+ while ((item=map_rect_get_item(mr))) {
+ struct attr label_attr;
+ item_attr_get(item,attr_label,&label_attr);
+ item_coord_get(item,&coord_item,1);
+ idist=transform_distance(1,&center,&coord_item);
+ if (item->type==selected && idist<=search_distance_meters){
+ char direction[5];
+ gtk_list_store_append(search->store_poi, &iter);
+ get_compass_direction(direction,transform_get_angle_delta(&center,&coord_item,0),1);
+
+ /**
+ * If the user has selected imperial, translate idist from meters to
+ * feet. We convert to feet only, and not miles, because the code
+ * sorts on the numeric value of the distance, so it doesn't like two
+ * different units. Currently, the distance is an int. Can it be made
+ * a float? Possible future enhancement?
+ */
+ if (imperial != FALSE) {
+ idist = idist * (FEET_PER_METER); /* convert meters to feet. */
+ }
+
+ gtk_list_store_set(search->store_poi, &iter, 0,direction, 1,idist,
+ 2,g_strdup(label_attr.u.str), 3,coord_item.x, 4,coord_item.y ,-1);
+ }
+ }
+ map_rect_destroy(mr);
+ }
+ map_selection_destroy(selm);
+ }
+ map_selection_destroy(sel);
+ mapset_close(h);
+
+ return GTK_TREE_MODEL (search->store_poi_sorted);
}
/** Enable button if there is a selected row. */
@@ -291,89 +295,98 @@ static void button_visit_clicked(GtkWidget *widget, struct gtk_poi_search *searc
}
/** Create UI and connect objects to functions. */
-void gtk_gui_poi(struct navit *nav) {
- GtkWidget *window2,*vbox, *keyboard, *table;
- GtkWidget *label_category, *label_poi;
- GtkWidget *listbox_cat, *listbox_poi;
- GtkCellRenderer *renderer;
-
- struct gtk_poi_search *search=&gtk_poi_search;
- search->nav=nav;
-
- window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(window2),_("POI search"));
- gtk_window_set_wmclass (GTK_WINDOW (window2), "navit", "Navit");
- gtk_window_set_default_size (GTK_WINDOW (window2),700,550);
- vbox = gtk_vbox_new(FALSE, 0);
- table = gtk_table_new(4, 4, FALSE);
-
- label_category = gtk_label_new(_("Select a category"));
- search->label_distance = gtk_label_new(_("Select a distance to look for (km)"));
- label_poi=gtk_label_new(_("Select a POI"));
-
- search->entry_distance=gtk_entry_new_with_max_length(2);
- gtk_entry_set_text(GTK_ENTRY(search->entry_distance),"10");
-
- search->treeview_cat=gtk_tree_view_new();
- listbox_cat = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (listbox_cat), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(listbox_cat),search->treeview_cat);
- search->store_cat = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
- renderer=gtk_cell_renderer_pixbuf_new();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_cat),-1, _(" "), renderer, "pixbuf", 0,
- NULL);
- renderer=gtk_cell_renderer_text_new();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_cat),-1, _("Category"), renderer, "text",
- 1, NULL);
- search->store_cat_sorted=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(search->store_cat));
- gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(search->store_cat_sorted),1,GTK_SORT_ASCENDING);
- gtk_tree_view_set_model (GTK_TREE_VIEW (search->treeview_cat), category_list_model(search));
-
- search->treeview_poi=gtk_tree_view_new();
- listbox_poi = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (listbox_poi), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(listbox_poi),search->treeview_poi);
- search->store_poi = gtk_list_store_new (5, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_LONG, G_TYPE_LONG);
- renderer=gtk_cell_renderer_text_new();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Direction"), renderer, "text",
- 0,NULL);
- renderer=gtk_cell_renderer_text_new();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Distance(m)"), renderer,
- "text", 1, NULL);
- renderer=gtk_cell_renderer_text_new();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Name"), renderer, "text", 2,
- NULL);
- search->store_poi_sorted=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(search->store_poi));
- gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(search->store_poi_sorted),1,GTK_SORT_ASCENDING);
-
- search->button_visit = gtk_button_new_with_label(_("Visit Before"));
- search->button_destination = gtk_button_new_with_label(_("Destination"));
- search->button_map = gtk_button_new_with_label(_("Map"));
- gtk_widget_set_sensitive(search->button_visit,FALSE);
- gtk_widget_set_sensitive(search->button_map,FALSE);
- gtk_widget_set_sensitive(search->button_destination,FALSE);
-
- gtk_table_attach(GTK_TABLE(table), search->label_distance, 0, 1, 0, 1, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), search->entry_distance, 1, 2, 0, 1, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), label_category, 0, 1, 2, 3, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), listbox_cat, 0, 1, 3, 4, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
- gtk_table_attach(GTK_TABLE(table), label_poi, 1, 4, 2, 3, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), listbox_poi, 1, 4, 3, 4, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
- gtk_table_attach(GTK_TABLE(table), search->button_map, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), search->button_visit, 1, 2, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), search->button_destination, 2, 3, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
- gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
-
- g_signal_connect(G_OBJECT(search->entry_distance), "changed", G_CALLBACK(treeview_poi_reload), search);
- g_signal_connect(G_OBJECT(search->button_visit), "clicked", G_CALLBACK(button_visit_clicked), search);
- g_signal_connect(G_OBJECT(search->button_map), "clicked", G_CALLBACK(button_map_clicked), search);
- g_signal_connect(G_OBJECT(search->button_destination), "clicked", G_CALLBACK(button_destination_clicked), search);
- g_signal_connect(G_OBJECT(search->treeview_cat), "cursor_changed", G_CALLBACK(treeview_poi_reload), search);
- g_signal_connect(G_OBJECT(search->treeview_poi), "cursor_changed", G_CALLBACK(treeview_poi_changed), search);
-
- keyboard=gtk_socket_new();
- gtk_box_pack_end(GTK_BOX(vbox), keyboard, FALSE, FALSE, 0);
- gtk_container_add(GTK_CONTAINER(window2), vbox);
- gtk_widget_show_all(window2);
+void gtk_gui_poi(struct navit *nav)
+{
+ GtkWidget *window2,*vbox, *keyboard, *table;
+ GtkWidget *label_category, *label_poi;
+ GtkWidget *listbox_cat, *listbox_poi;
+ GtkCellRenderer *renderer;
+
+ struct gtk_poi_search *search=&gtk_poi_search;
+ search->nav=nav;
+
+ window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title(GTK_WINDOW(window2),_("POI search"));
+ gtk_window_set_wmclass (GTK_WINDOW (window2), "navit", "Navit");
+ gtk_window_set_default_size (GTK_WINDOW (window2),700,550);
+ vbox = gtk_vbox_new(FALSE, 0);
+ table = gtk_table_new(4, 4, FALSE);
+
+ label_category = gtk_label_new(_("Select a category"));
+ label_poi=gtk_label_new(_("Select a POI"));
+
+ /* Respect the Imperial attribute as we enlighten the user. */
+ struct attr attr;
+ int imperial = FALSE; /* default to using metric measures. */
+ if (navit_get_attr(gtk_poi_search.nav, attr_imperial, &attr, NULL))
+ imperial=attr.u.num;
+
+ if (imperial == FALSE) {
+ /* Input is in kilometers */
+ search->label_distance = gtk_label_new(_("Select a search radius from screen center in km"));
+ } else {
+ /* Input is in miles. */
+ search->label_distance = gtk_label_new(_("Select a search radius from screen center in miles"));
+ }
+
+ search->entry_distance=gtk_entry_new_with_max_length(2);
+ gtk_entry_set_text(GTK_ENTRY(search->entry_distance),"10");
+
+ search->treeview_cat=gtk_tree_view_new();
+ listbox_cat = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (listbox_cat), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(listbox_cat),search->treeview_cat);
+ search->store_cat = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
+ renderer=gtk_cell_renderer_pixbuf_new();
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_cat),-1, _(" "), renderer, "pixbuf", 0, NULL);
+ renderer=gtk_cell_renderer_text_new();
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_cat),-1, _("Category"), renderer, "text", 1, NULL);
+ search->store_cat_sorted=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(search->store_cat));
+ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(search->store_cat_sorted),1,GTK_SORT_ASCENDING);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (search->treeview_cat), category_list_model(search));
+
+ search->treeview_poi=gtk_tree_view_new();
+ listbox_poi = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (listbox_poi), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(listbox_poi),search->treeview_poi);
+ search->store_poi = gtk_list_store_new (5, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_LONG, G_TYPE_LONG);
+ renderer=gtk_cell_renderer_text_new();
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Direction"), renderer, "text",0,NULL);
+ renderer=gtk_cell_renderer_text_new();
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Distance"), renderer, "text", 1, NULL);
+ renderer=gtk_cell_renderer_text_new();
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Name"), renderer, "text", 2, NULL);
+ search->store_poi_sorted=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(search->store_poi));
+ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(search->store_poi_sorted),1,GTK_SORT_ASCENDING);
+
+ search->button_visit = gtk_button_new_with_label(_("Visit Before"));
+ search->button_destination = gtk_button_new_with_label(_("Destination"));
+ search->button_map = gtk_button_new_with_label(_("Map"));
+ gtk_widget_set_sensitive(search->button_visit,FALSE);
+ gtk_widget_set_sensitive(search->button_map,FALSE);
+ gtk_widget_set_sensitive(search->button_destination,FALSE);
+
+ gtk_table_attach(GTK_TABLE(table), search->label_distance, 0, 1, 0, 1, 0, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), search->entry_distance, 1, 2, 0, 1, 0, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), label_category, 0, 1, 2, 3, 0, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), listbox_cat, 0, 1, 3, 4, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), label_poi, 1, 4, 2, 3, 0, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), listbox_poi, 1, 4, 3, 4, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), search->button_map, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), search->button_visit, 1, 2, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), search->button_destination, 2, 3, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
+
+ g_signal_connect(G_OBJECT(search->entry_distance), "changed", G_CALLBACK(treeview_poi_reload), search);
+ g_signal_connect(G_OBJECT(search->button_visit), "clicked", G_CALLBACK(button_visit_clicked), search);
+ g_signal_connect(G_OBJECT(search->button_map), "clicked", G_CALLBACK(button_map_clicked), search);
+ g_signal_connect(G_OBJECT(search->button_destination), "clicked", G_CALLBACK(button_destination_clicked), search);
+ g_signal_connect(G_OBJECT(search->treeview_cat), "cursor_changed", G_CALLBACK(treeview_poi_reload), search);
+ g_signal_connect(G_OBJECT(search->treeview_poi), "cursor_changed", G_CALLBACK(treeview_poi_changed), search);
+
+ keyboard=gtk_socket_new();
+ gtk_box_pack_end(GTK_BOX(vbox), keyboard, FALSE, FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(window2), vbox);
+ gtk_widget_show_all(window2);
}