summaryrefslogtreecommitdiff
path: root/navit/navit.c
diff options
context:
space:
mode:
authorkorrosa <korrosa@ffa7fe5e-494d-0410-b361-a75ebd5db220>2011-09-29 22:20:42 +0000
committerkorrosa <korrosa@ffa7fe5e-494d-0410-b361-a75ebd5db220>2011-09-29 22:20:42 +0000
commit1e1009ccbcbb80b6e03ef06756267f4f65105dcc (patch)
tree47dd253d269038fddd2c7317af3545b6be0d8465 /navit/navit.c
parent7c7b1e61219a0ca49fd4b27d6651118fcbb10fb9 (diff)
downloadnavit-1e1009ccbcbb80b6e03ef06756267f4f65105dcc.tar.gz
Add:gui/internal:Insert new "Former destinations" menu entry in "Actions". Closes #943|Great work sleske!
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@4801 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/navit.c')
-rw-r--r--navit/navit.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/navit/navit.c b/navit/navit.c
index 479e4578e..af920ec09 100644
--- a/navit/navit.c
+++ b/navit/navit.c
@@ -1553,40 +1553,40 @@ navit_former_destinations_active(struct navit *this_)
return active;
}
-static void
-navit_add_former_destinations_from_file(struct navit *this_)
-{
- char *destination_file = bookmarks_get_destination_file(FALSE);
- struct attr *attrs[4];
- struct map_rect *mr;
- struct item *item;
- int i,valid=0,count=0;
- struct coord c[16];
- struct pcoord pc[16];
- struct attr parent;
+struct map* read_former_destinations_from_file(){
struct attr type;
- struct attr data;
- struct attr flags;
-
- parent.type=attr_navit;
- parent.u.navit=this_;
-
type.type=attr_type;
type.u.str="textfile";
+ struct attr data;
data.type=attr_data;
+ char *destination_file = bookmarks_get_destination_file(FALSE);
data.u.str=destination_file;
+ struct attr flags;
flags.type=attr_flags;
flags.u.num=1;
+ struct attr *attrs[4];
attrs[0]=&type; attrs[1]=&data; attrs[2]=&flags; attrs[3]=NULL;
- this_->former_destination=map_new(&parent, attrs);
+ struct map* m=map_new(NULL, attrs);
g_free(destination_file);
+ return m;
+}
+
+static void
+navit_add_former_destinations_from_file(struct navit *this_)
+{
+ struct item *item;
+ int i,valid=0,count=0;
+ struct coord c[16];
+ struct pcoord pc[16];
+
+ this_->former_destination=read_former_destinations_from_file();
if (!this_->route || !navit_former_destinations_active(this_))
return;
- mr=map_rect_new(this_->former_destination, NULL);
+ struct map_rect *mr=map_rect_new(this_->former_destination, NULL);
while ((item=map_rect_get_item(mr))) {
if ((item->type == type_former_destination || item->type == type_former_itinerary || item->type == type_former_itinerary_part) && (count=item_coord_get(item, c, 16)))
valid=1;