Ticket #1113: gtk_gui_poi.diff

File gtk_gui_poi.diff, 23.8 KB (added by me.yahoo.com/a/_ij44v97roulszbeztrzcqzaaiyvlg--#9d14a, 7 years ago)
  • ../navit/navit/gui/gtk/CMakeLists.txt

     
    1 module_add_library(gui_gtk datawindow.c destination.c gui_gtk_statusbar.c gui_gtk_action.c gui_gtk_window.c)
     1module_add_library(gui_gtk datawindow.c destination.c gui_gtk_statusbar.c gui_gtk_action.c gui_gtk_window.c gui_gtk_poi.c)
    22
  • ../navit/navit/gui/gtk/Makefile.am

     
    11include $(top_srcdir)/Makefile.inc
    22AM_CPPFLAGS = -I$(top_srcdir)/navit @NAVIT_CFLAGS@ @HILDON_CFLAGS@ @GTK2_CFLAGS@ -DMODULE=gui_gtk
    33modulegui_LTLIBRARIES = libgui_gtk.la
    4 libgui_gtk_la_SOURCES = datawindow.c destination.c gui_gtk_statusbar.c gui_gtk_action.c gui_gtk_window.c gui_gtk.h
     4libgui_gtk_la_SOURCES = datawindow.c destination.c gui_gtk_statusbar.c gui_gtk_action.c gui_gtk_window.c gui_gtk.h gui_gtk_poi.h
    55libgui_gtk_la_LIBADD = @GTK2_LIBS@
    66libgui_gtk_la_LDFLAGS = -module -avoid-version
  • ../navit/navit/gui/gtk/gui_gtk_action.c

     
    3333#include "debug.h"
    3434#include "destination.h"
    3535#include "navit_nls.h"
     36#include "gui_gtk_poi.h"
    3637
    3738struct menu_priv {
    3839        char *path;
     
    180181        navit_set_destination(gui->nav, NULL, NULL, 0);
    181182}
    182183
     184/*Action that shows search poi window*/
    183185static void
     186poi_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
     187{
     188        gtk_gui_poi(gui->nav);
     189}
     190
     191static void
    184192destination_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
    185193{
    186194        destination_address(gui->nav);
     
    213221        { "InfoAction", NULL, _n("_Info"), NULL, NULL, G_CALLBACK(info_action) },
    214222#endif /*GTK_STOCK_INFO*/
    215223        { "DestinationAction", "flag_icon", _n("Set _destination"), "<control>D", _n("Opens address search dialog"), G_CALLBACK(destination_action) },
     224        { "POIAction", "flag_icon", _n("Set _POI"), "<control>P", _n("Opens POI search dialog"), G_CALLBACK(poi_action) },
    216225        { "RouteClearAction", NULL, _n("_Stop Navigation"), "<control>S", NULL, G_CALLBACK(route_clear_action) },
    217226        { "Test", NULL, _n("Test"), NULL, NULL, G_CALLBACK(destination_action) },
    218227        { "QuitAction", GTK_STOCK_QUIT, _n("_Quit"), "<control>Q",_n("Quit the application"), G_CALLBACK (quit_action) }
     
    388397                        <menu name=\"Route\" action=\"RouteMenuAction\">\
    389398                                <menuitem name=\"Refresh\" action=\"RefreshAction\" />\
    390399                                <menuitem name=\"Destination\" action=\"DestinationAction\" />\
     400                                <menuitem name=\"POI\" action=\"POIAction\" />\
    391401                                <menuitem name=\"Clear\" action=\"RouteClearAction\" />\
    392402                                <menu name=\"FormerDestinations\" action=\"FormerDestinationMenuAction\">\
    393403                                        <placeholder name=\"FormerDestinationMenuAdditions\" />\
     
    419429                                <!-- <toolitem name=\"Cursor\" action=\"CursorAction\"/> -->\
    420430                                <toolitem name=\"Orientation\" action=\"OrientationAction\"/>\
    421431                                <toolitem name=\"Destination\" action=\"DestinationAction\"/>\
     432                                <toolitem name=\"POI\" action=\"POIAction\"/>\
    422433                                <!-- <toolitem name=\"Info\" action=\"InfoAction\"/> -->\
    423434                                <toolitem name=\"Roadbook\" action=\"RoadbookAction\"/>\
    424435                                <toolitem name=\"Autozoom\" action=\"AutozoomAction\"/>\
  • ../navit/navit/gui/gtk/gui_gtk_poi.c

     
     1/**
     2 * Navit, a modular navigation system.
     3 * Copyright (C) 2005-2013 Navit Team
     4 *
     5 * This program is free software; you can redistribute it and/or
     6 * modify it under the terms of the GNU General Public License
     7 * version 2 as published by the Free Software Foundation.
     8 *
     9 * This program is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 * GNU General Public License for more details.
     13 *
     14 * You should have received a copy of the GNU General Public License
     15 * along with this program; if not, write to the
     16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     17 * Boston, MA  02110-1301, USA.
     18 */
     19
     20#include <stdlib.h>
     21#include <gtk/gtk.h>
     22#include "gui_gtk_poi.h"
     23#include "popup.h"
     24#include "debug.h"
     25#include "navit_nls.h"
     26#include "coord.h"
     27#include "point.h"
     28#include "callback.h"
     29#include "graphics.h"
     30#include "navit.h"
     31#include "item.h"
     32#include "map.h"
     33#include "mapset.h"
     34#include "transform.h"
     35#include "attr.h"
     36#include "vehicle.h"
     37
     38static struct gtk_poi_search{
     39        GtkWidget *entry_distance;
     40        GtkWidget *label_distance;
     41        GtkWidget *treeview_cat;
     42        GtkWidget *treeview_poi;
     43        GtkWidget *button_visit, *button_destination, *button_map;   
     44        GtkListStore *store_poi;
     45        GtkListStore *store_cat;
     46        GtkTreeModel *store_poi_sorted;
     47        GtkTreeModel *store_cat_sorted;
     48        char *selected_cat;
     49        struct navit *nav;
     50} gtk_poi_search;
     51
     52
     53/*Returns an icon with GdkPIxbuf*/
     54static GdkPixbuf *
     55geticon(const char *name){
     56        GdkPixbuf *icon=NULL;
     57        GError *error=NULL;
     58        icon=gdk_pixbuf_new_from_file(graphics_icon_path(name),&error);
     59        return icon;
     60}
     61
     62/*Builds the category list and adds icons to improve UI*/
     63static GtkTreeModel *
     64model_cat (struct gtk_poi_search *search)
     65{
     66        GtkTreeIter iter;
     67        gtk_list_store_append (search->store_cat, &iter);
     68        gtk_list_store_set (search->store_cat, &iter, 0,geticon("pharmacy.png"), 1, _("Pharmacy"),  2, "poi_pharmacy", -1);
     69        gtk_list_store_append (search->store_cat, &iter);
     70        gtk_list_store_set (search->store_cat, &iter, 0, geticon("restaurant.png"), 1, _("Restaurant"),  2, "poi_restaurant", -1);
     71        gtk_list_store_append (search->store_cat, &iter);
     72        gtk_list_store_set (search->store_cat, &iter,0, geticon("restaurant.png"), 1, _("Restaurant. Fast food"),2, "poi_fastfood",  -1);
     73        gtk_list_store_append (search->store_cat, &iter);
     74        gtk_list_store_set (search->store_cat, &iter,0, geticon("hotel.png"), 1, _("Hotel"),2, "poi_hotel",  -1);
     75        gtk_list_store_append (search->store_cat, &iter);
     76        gtk_list_store_set (search->store_cat, &iter,0, geticon("parking.png"), 1, _("Car parking"),2, "poi_car_parking",  -1);
     77        gtk_list_store_append (search->store_cat, &iter);
     78        gtk_list_store_set (search->store_cat, &iter,0, geticon("fuel.png"), 1, _("Fuel station"),2, "poi_fuel",  -1);
     79        gtk_list_store_append (search->store_cat, &iter);
     80        gtk_list_store_set (search->store_cat, &iter,0, geticon("bank.png"), 1, _("Bank"),2, "poi_bank",  -1);
     81        gtk_list_store_append (search->store_cat, &iter);
     82        gtk_list_store_set (search->store_cat, &iter,0, geticon("hospital.png"), 1, _("Hospital"),2, "poi_hospital",  -1);
     83        gtk_list_store_append (search->store_cat, &iter);
     84        gtk_list_store_set (search->store_cat, &iter,0, geticon("cinema.png"), 1, _("Cinema"),2, "poi_cinema",  -1);
     85        gtk_list_store_append (search->store_cat, &iter);
     86        gtk_list_store_set (search->store_cat, &iter,0, geticon("rail_station.png"), 1, _("Train station"),2, "poi_rail_station",  -1);
     87        gtk_list_store_append (search->store_cat, &iter);
     88        gtk_list_store_set (search->store_cat, &iter,0, geticon("school.png"), 1, _("School"),2, "poi_school",  -1);
     89        gtk_list_store_append (search->store_cat, &iter);
     90        gtk_list_store_set (search->store_cat, &iter,0, geticon("police.png"), 1, _("Police"),2, "poi_police",  -1);
     91        gtk_list_store_append (search->store_cat, &iter);
     92        gtk_list_store_set (search->store_cat, &iter,0, geticon("justice.png"), 1, _("Justice"),2, "poi_justice",  -1);
     93        gtk_list_store_append (search->store_cat, &iter);
     94        gtk_list_store_set (search->store_cat, &iter,0, geticon("taxi.png"), 1, _("Taxi"),2, "poi_taxi",  -1);
     95        gtk_list_store_append (search->store_cat, &iter);
     96        gtk_list_store_set (search->store_cat, &iter,0, geticon("shopping.png"), 1, _("Shopping"),2, "poi_shopping",  -1);
     97        return GTK_TREE_MODEL (search->store_cat_sorted);
     98}
     99
     100/*Copied from gui_internal_poi.c. I didn't know how to reference it. Gets the cardinal direction from the angle*/
     101static void
     102get_direction(char *buffer, int angle, int mode)
     103{
     104        angle=angle%360;
     105        switch (mode) {
     106        case 0:
     107                sprintf(buffer,"%d",angle);
     108                break;
     109        case 1:
     110                if (angle < 69 || angle > 291)
     111                        *buffer++='N';
     112                if (angle > 111 && angle < 249)
     113                        *buffer++='S';
     114                if (angle > 22 && angle < 158)
     115                        *buffer++='E';
     116                if (angle > 202 && angle < 338)
     117                        *buffer++='W';
     118                *buffer++='\0';
     119                break;
     120        case 2:
     121                angle=(angle+15)/30;
     122                if (! angle)
     123                        angle=12;
     124                sprintf(buffer,"%d H", angle);
     125                break;
     126        }
     127}
     128
     129/*Constructs model of pois from map information*/
     130static GtkTreeModel *
     131model_poi (struct gtk_poi_search *search)
     132{
     133        GtkTreeIter iter;
     134        struct map_selection *sel,*selm;
     135        struct coord coord_item,center;
     136        struct pcoord pc;
     137        struct mapset_handle *h;
     138        int dist,idist;
     139        struct map *m;
     140        struct map_rect *mr;
     141        struct item *item;
     142        struct point p;//Cursor position in screen
     143        struct attr attr, vehicle_attr;
     144        struct vehicle *v;
     145        enum item_type selected;
     146
     147        //distance in meters
     148        dist=1000*atoi((char *) gtk_entry_get_text(GTK_ENTRY(search->entry_distance)));
     149
     150        //Searches if vehicle has coord_geo to show distance from vehicle.
     151        //If vehicle hasn't coord_geo show distance from center of screen
     152        navit_get_attr(search->nav,attr_vehicle, &vehicle_attr,NULL);
     153        v=vehicle_attr.u.vehicle;
     154
     155        vehicle_get_attr(v,attr_position_coord_geo, &attr, NULL);
     156        if (attr.u.coord_geo->lng==0.0f && attr.u.coord_geo->lat==0.0f){
     157                p.x=navit_get_width(search->nav)/2;
     158                p.y=navit_get_height(search->nav)/2;
     159                gtk_label_set_text(GTK_LABEL(search->label_distance),_("Distance from center screen (Km)"));
     160        }else{
     161                printf("%f\n",attr.u.coord_geo->lng);
     162               
     163                p.x=navit_get_width(search->nav)/2;
     164                p.y=navit_get_height(search->nav)*4/5;
     165                gtk_label_set_text(GTK_LABEL(search->label_distance),_("Distance from vehicle cursor (Km)"));
     166        }
     167
     168        transform_reverse(navit_get_trans(search->nav), &p, &center);
     169        pc.pro = transform_get_projection(navit_get_trans(search->nav));
     170        pc.x = center.x;
     171        pc.y = center.y;
     172
     173        //Search in the map, for pois
     174        sel=map_selection_rect_new(&pc ,dist*transform_scale(abs(center.y)+dist*1.5),18);
     175        gtk_list_store_clear(search->store_poi);
     176
     177        h=mapset_open(navit_get_mapset(search->nav));
     178
     179        selected=item_from_name(search->selected_cat);
     180        while ((m=mapset_next(h, 1))) {
     181                selm=map_selection_dup_pro(sel, 1, map_projection(m));//pro vale 1
     182                mr=map_rect_new(m, selm);
     183                if (mr) {
     184                        while ((item=map_rect_get_item(mr))) {
     185                                struct attr attr;
     186                                item_attr_get(item,attr_label,&attr);
     187                                item_coord_get(item,&coord_item,1);
     188                                idist=transform_distance(1,&center,&coord_item);
     189                                if (item->type==selected && idist<=dist){
     190                                        gtk_list_store_append (search->store_poi, &iter);
     191                                        char rumbo[5];
     192                                        get_direction(rumbo,transform_get_angle_delta(&center,&coord_item,0),1);
     193                                        gtk_list_store_set (search->store_poi, &iter, 0,rumbo, 1,idist, 2,g_strdup(attr.u.str),   3,coord_item.x, 4,coord_item.y ,-1);
     194                                }
     195                        }
     196                        map_rect_destroy(mr);
     197                }
     198                map_selection_destroy(selm);
     199        }
     200        map_selection_destroy(sel);
     201        mapset_close(h);
     202
     203        return GTK_TREE_MODEL (search->store_poi_sorted);
     204}
     205
     206/*Sets button enabled if there is a row selected*/
     207static void
     208treeview_poi_changed(GtkWidget *widget, struct gtk_poi_search *search)
     209{
     210        GtkTreePath *path;
     211        GtkTreeViewColumn *focus_column;
     212        GtkTreeIter iter;
     213
     214        gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview_cat), &path, &focus_column);
     215        if(!path) return;
     216        if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(search->store_cat_sorted), &iter, path)) return;
     217
     218        gtk_widget_set_sensitive(search->button_visit,TRUE);
     219        gtk_widget_set_sensitive(search->button_map,TRUE);
     220        gtk_widget_set_sensitive(search->button_destination,TRUE);
     221}
     222
     223/*Reloads the poi list, and sets buttons disabled*/
     224static void
     225treeview_poi_reload(GtkWidget *widget, struct gtk_poi_search *search)
     226{
     227        GtkTreePath *path;
     228        GtkTreeViewColumn *focus_column;
     229        GtkTreeIter iter;
     230
     231        gtk_widget_set_sensitive(search->button_visit,FALSE);
     232        gtk_widget_set_sensitive(search->button_map,FALSE);
     233        gtk_widget_set_sensitive(search->button_destination,FALSE);
     234
     235        gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview_cat), &path, &focus_column);
     236        if(!path) return;
     237        if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(search->store_cat_sorted), &iter, path)) return;
     238        gtk_tree_model_get(GTK_TREE_MODEL(search->store_cat_sorted), &iter, 2, &search->selected_cat, -1);
     239        gtk_tree_view_set_model(GTK_TREE_VIEW (search->treeview_poi), model_poi(search));
     240}
     241
     242/*Function when button destination is clicked. It sets the selected poi position as destination*/
     243static void
     244button_destination_clicked(GtkWidget *widget, struct gtk_poi_search *search)
     245{
     246        GtkTreePath *path;
     247        GtkTreeViewColumn *focus_column;
     248        GtkTreeIter iter;
     249        long int lat, lon;
     250        char *label;
     251        char *category;
     252        char buffer[2000];
     253
     254        //Get category
     255        gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview_cat), &path, &focus_column);
     256        if(!path) return;
     257        if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(search->store_cat_sorted), &iter, path)) return;
     258        gtk_tree_model_get(GTK_TREE_MODEL(search->store_cat_sorted), &iter, 1, &category, -1);
     259
     260        //Get label, lat, lon
     261        gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview_poi), &path, &focus_column);
     262        if(!path) return;
     263        if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(search->store_poi_sorted), &iter, path)) return;
     264        gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 2, &label, -1);
     265        gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 3, &lat, -1);
     266        gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 4, &lon, -1);
     267        sprintf(buffer, _("POI %s. %s"), category, label);
     268
     269        struct pcoord dest;
     270        dest.x=lat;
     271        dest.y=lon;
     272        dest.pro=1;
     273        navit_set_destination(search->nav, &dest, buffer, 1);
     274        dbg(1,_("Set destination to %ld, %ld \n"),lat,lon);
     275}
     276
     277/*Function when button map is clicked. It shows the poi position in the map*/
     278static void
     279button_map_clicked(GtkWidget *widget, struct gtk_poi_search *search)
     280{
     281        GtkTreePath *path;
     282        GtkTreeViewColumn *focus_column;
     283        GtkTreeIter iter;
     284        long int lat,lon;
     285
     286        gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview_poi), &path, &focus_column);
     287        if(!path) return;
     288        if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(search->store_poi_sorted), &iter, path)) return;
     289        gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 3, &lat, -1);
     290        gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 4, &lon, -1);
     291
     292        struct pcoord dest;
     293        dest.x=lat;
     294        dest.y=lon;
     295        dest.pro=1;
     296        navit_set_center(search->nav, &dest,1);
     297        dbg(1,_("Set map to %ld, %ld \n"),lat,lon);
     298}
     299
     300/*Function when button visitbefore is clicked. It sets the first visit before of the waypoint when it's clicked*/
     301static void
     302button_visit_clicked(GtkWidget *widget, struct gtk_poi_search *search)
     303{
     304        GtkTreePath *path;
     305        GtkTreeViewColumn *focus_column;
     306        GtkTreeIter iter;
     307        long int lat,lon;
     308
     309        gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview_poi), &path, &focus_column);
     310        if(!path) return;
     311        if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(search->store_poi_sorted), &iter, path)) return;
     312        gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 3, &lat, -1);
     313        gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 4, &lon, -1);
     314        dbg(1,_("Set next visit to %ld, %ld \n"),lat,lon);
     315
     316        struct pcoord dest;
     317        dest.x=lat;
     318        dest.y=lon;
     319        dest.pro=1;
     320        popup_set_visitbefore(search->nav,&dest,0);
     321}
     322
     323/*Create UI and connects objects to functions*/
     324void gtk_gui_poi(struct navit *nav)
     325{
     326        GtkWidget *window2,*vbox, *keyboard, *table;
     327        GtkWidget *label_category, *label_poi;
     328        GtkWidget *listbox_cat, *listbox_poi;
     329        GtkCellRenderer *renderer;
     330
     331        struct gtk_poi_search *search=&gtk_poi_search;
     332        search->nav=nav;
     333
     334        window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     335        gtk_window_set_title(GTK_WINDOW(window2),_("Search of POI's"));
     336        gtk_window_set_wmclass (GTK_WINDOW (window2), "navit", "Navit");
     337        gtk_window_set_default_size (GTK_WINDOW (window2),700,550);
     338        vbox = gtk_vbox_new(FALSE, 0);
     339        table = gtk_table_new(4, 4, FALSE);
     340
     341        label_category = gtk_label_new(_("Select a category"));
     342        search->label_distance = gtk_label_new(_("Select a distance to look for (Km)"));
     343        label_poi=gtk_label_new(_("Select a POI"));
     344
     345        search->entry_distance=gtk_entry_new_with_max_length(2);
     346        gtk_entry_set_text(GTK_ENTRY(search->entry_distance),"10");
     347
     348        search->treeview_cat=gtk_tree_view_new();
     349        listbox_cat = gtk_scrolled_window_new (NULL, NULL);
     350        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (listbox_cat), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
     351        gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(listbox_cat),search->treeview_cat);
     352        search->store_cat = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
     353        renderer=gtk_cell_renderer_pixbuf_new();
     354        gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_cat),-1, _(" "), renderer, "pixbuf", 0, NULL);
     355        renderer=gtk_cell_renderer_text_new();
     356        gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_cat),-1, _("Category"), renderer, "text", 1, NULL);
     357        search->store_cat_sorted=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(search->store_cat));
     358        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(search->store_cat_sorted),1,GTK_SORT_ASCENDING);
     359        gtk_tree_view_set_model (GTK_TREE_VIEW (search->treeview_cat), model_cat(search));
     360
     361        search->treeview_poi=gtk_tree_view_new();
     362        listbox_poi = gtk_scrolled_window_new (NULL, NULL);
     363        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (listbox_poi), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
     364        gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(listbox_poi),search->treeview_poi);
     365        search->store_poi = gtk_list_store_new (5, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_LONG, G_TYPE_LONG);
     366        renderer=gtk_cell_renderer_text_new();
     367        gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, " ", renderer, "text",0,NULL);
     368        renderer=gtk_cell_renderer_text_new();
     369        gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Meters"), renderer, "text", 1, NULL);
     370        renderer=gtk_cell_renderer_text_new();
     371        gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (search->treeview_poi),-1, _("Name"), renderer, "text", 2, NULL);
     372        search->store_poi_sorted=NULL;
     373        search->store_poi_sorted=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(search->store_poi));
     374        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(search->store_poi_sorted),1,GTK_SORT_ASCENDING);
     375
     376        search->button_visit = gtk_button_new_with_label(_("Visit Before"));
     377        search->button_destination = gtk_button_new_with_label(_("Destination"));
     378        search->button_map = gtk_button_new_with_label(_("Map"));
     379        gtk_widget_set_sensitive(search->button_visit,FALSE);
     380        gtk_widget_set_sensitive(search->button_map,FALSE);
     381        gtk_widget_set_sensitive(search->button_destination,FALSE);
     382
     383        gtk_table_attach(GTK_TABLE(table), search->label_distance,      0, 1, 0, 1,  0, GTK_FILL, 0, 0);
     384        gtk_table_attach(GTK_TABLE(table), search->entry_distance,     1, 2, 0, 1,  0, GTK_FILL, 0, 0);
     385        gtk_table_attach(GTK_TABLE(table), label_category,     0, 1, 2, 3,  0, GTK_FILL, 0, 0);
     386        gtk_table_attach(GTK_TABLE(table), listbox_cat,        0, 1, 3, 4,  GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
     387        gtk_table_attach(GTK_TABLE(table), label_poi,          1, 4, 2, 3,  0, GTK_FILL, 0, 0);
     388        gtk_table_attach(GTK_TABLE(table), listbox_poi,        1, 4, 3, 4,  GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
     389        gtk_table_attach(GTK_TABLE(table), search->button_map,         0, 1, 4, 5,  GTK_FILL, GTK_FILL, 0, 0);
     390        gtk_table_attach(GTK_TABLE(table), search->button_visit,       1, 2, 4, 5,  GTK_FILL, GTK_FILL, 0, 0);
     391        gtk_table_attach(GTK_TABLE(table), search->button_destination, 2, 3, 4, 5,  GTK_FILL, GTK_FILL, 0, 0);
     392        gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
     393
     394        g_signal_connect(G_OBJECT(search->entry_distance), "changed", G_CALLBACK(treeview_poi_reload), search);
     395        g_signal_connect(G_OBJECT(search->button_visit), "clicked", G_CALLBACK(button_visit_clicked), search);
     396        g_signal_connect(G_OBJECT(search->button_map), "clicked", G_CALLBACK(button_map_clicked), search);
     397        g_signal_connect(G_OBJECT(search->button_destination), "clicked", G_CALLBACK(button_destination_clicked), search);
     398        g_signal_connect(G_OBJECT(search->treeview_cat), "cursor_changed", G_CALLBACK(treeview_poi_reload), search);
     399        g_signal_connect(G_OBJECT(search->treeview_poi), "cursor_changed", G_CALLBACK(treeview_poi_changed), search);
     400
     401        keyboard=gtk_socket_new();
     402        gtk_box_pack_end(GTK_BOX(vbox), keyboard, FALSE, FALSE, 0);
     403        gtk_container_add(GTK_CONTAINER(window2), vbox);
     404        gtk_widget_show_all(window2);
     405}
     406
  • ../navit/navit/gui/gtk/gui_gtk_poi.h

     
     1/**
     2 * Navit, a modular navigation system.
     3 * Copyright (C) 2005-2013 Navit Team
     4 *
     5 * This program is free software; you can redistribute it and/or
     6 * modify it under the terms of the GNU Library General Public License
     7 * version 2 as published by the Free Software Foundation.
     8 *
     9 * This program is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 * GNU Library General Public License for more details.
     13 *
     14 * You should have received a copy of the GNU Library General Public
     15 * License along with this program; if not, write to the
     16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     17 * Boston, MA  02110-1301, USA.
     18 */
     19
     20#ifndef NAVIT_GTK_POI_H
     21#define NAVIT_GTK_POI_H
     22
     23struct navit;
     24struct pcoord;
     25void gtk_gui_poi(struct navit *nav);
     26
     27#endif
     28
  • ../navit/navit/popup.c

     
    135135}
    136136
    137137
    138 static void
     138void
    139139popup_set_visitbefore(struct navit *nav, struct pcoord *pc,int visitbefore)
    140140{
    141141        struct pcoord *dst;
  • ../navit/navit/popup.h

     
    2222
    2323struct navit;
    2424struct point;
     25struct pcoord;
    2526void popup(struct navit *nav, int button, struct point *p);
    26 
     27void popup_set_visitbefore(struct navit *nav, struct pcoord *pc, int visitbefore);
    2728#endif
  • ../navit/po/CMakeLists.txt

     
    1111      ${PROJECT_SOURCE_DIR}/navit/bookmarks.c
    1212      ${PROJECT_SOURCE_DIR}/navit/gui/gtk/destination.c
    1313      ${PROJECT_SOURCE_DIR}/navit/gui/gtk/gui_gtk_action.c
     14      ${PROJECT_SOURCE_DIR}/navit/gui/gtk/gui_gtk_poi.c
    1415      ${PROJECT_SOURCE_DIR}/navit/gui/gtk/gui_gtk_statusbar.c
    1516      ${PROJECT_SOURCE_DIR}/navit/gui/internal/gui_internal.c
    1617      ${PROJECT_SOURCE_DIR}/navit/gui/internal/gui_internal_bookmark.c
  • ../navit/po/Makefile.am

     
    1313        $(top_srcdir)/navit/country.c \
    1414        $(top_srcdir)/navit/gui/gtk/destination.c \
    1515        $(top_srcdir)/navit/gui/gtk/gui_gtk_action.c \
     16        $(top_srcdir)/navit/gui/gtk/gui_gtk_poi.c \
    1617        $(top_srcdir)/navit/gui/gtk/gui_gtk_statusbar.c \
    1718        $(top_srcdir)/navit/gui/internal/gui_internal.c \
    1819        $(top_srcdir)/navit/gui/internal/gui_internal_bookmark.c \