From 22c147c6fe7e0d98b758d5b036561e843aa4a235 Mon Sep 17 00:00:00 2001 From: horwitz Date: Tue, 12 Feb 2008 22:28:12 +0000 Subject: [PATCH] Core:Add:Add callback to laymout menu. git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@860 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/src/navit.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/navit/src/navit.c b/navit/src/navit.c index 6725f71..7dd0d00 100644 --- a/navit/src/navit.c +++ b/navit/src/navit.c @@ -656,11 +656,13 @@ navit_add_menu_layouts(struct navit *this_, struct menu *men) { GList *layouts; struct layout *l; + struct callback *cb; layouts = this_->layouts; while (layouts) { l=layouts->data; - menu_add(men, l->name, menu_type_menu, NULL); + cb=callback_new_2(callback_cast(navit_set_attr), this_, attr_new_from_text("layout",l->name)); + menu_add(men, l->name, menu_type_menu, cb); layouts=g_list_next(layouts); } } @@ -1244,6 +1246,7 @@ navit_set_attr(struct navit *this_, struct attr *attr) l=layouts->data; if(!strcmp(attr->u.str,l->name) && this_->layout_current!=l) { this_->layout_current=l; + navit_draw(this_); attr_updated=1; } layouts=g_list_next(layouts); @@ -1276,6 +1279,9 @@ navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr) case attr_orientation: attr->u.num=this_->orient_north_flag; break; + case attr_layout: + attr->u.str=g_strdup(this_->layout_current->name); + break; default: return 0; } -- 2.7.4