From: tegzed Date: Sun, 7 Nov 2010 09:00:45 +0000 (+0000) Subject: Add:Core:Make navit_destroy() emit callback "destroy" on exit; added function to... X-Git-Tag: navit-0.5.0.5194svn~1538 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8cd88b7f58262ef2a01afd2a51d9aa191fbefc16;p=profile%2Fivi%2Fnavit.git Add:Core:Make navit_destroy() emit callback "destroy" on exit; added function to get user data dir git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@3654 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- diff --git a/navit/navit/attr_def.h b/navit/navit/attr_def.h index 96eb38a..05dfeb9 100644 --- a/navit/navit/attr_def.h +++ b/navit/navit/attr_def.h @@ -401,6 +401,7 @@ ATTR(window_closed) ATTR(log_gpx) ATTR(log_textfile) ATTR(graphics_ready) +ATTR(destroy) ATTR2(0x000bffff,type_callback_end) ATTR2(0x000c0000,type_int64_begin) ATTR(osm_nodeid) diff --git a/navit/navit/navit.c b/navit/navit/navit.c index 541bfda..2bad1cb 100644 --- a/navit/navit/navit.c +++ b/navit/navit/navit.c @@ -190,6 +190,31 @@ navit_get_tracking(struct navit *this_) return this_->tracking; } +/** + * @brief Get the user data directory. + * @param[in] create - create the directory if it does not exist + * + * @return char * to the data directory string. + * + * returns the directory used to store user data files (center.txt, + * destination.txt, bookmark.txt, ...) + * + */ +char* +navit_get_user_data_directory(int create) { + char *dir; + dir = getenv("NAVIT_USER_DATADIR"); + if (create && !file_exists(dir)) { + dbg(0,"creating dir %s\n", dir); + if (file_mkdir(dir,0)) { + dbg(0,"failed creating dir %s\n", dir); + return NULL; + } + } + return dir; +} /* end: navit_get_user_data_directory(gboolean create) */ + + static void navit_draw_async(struct navit *this_, int async) { @@ -2414,6 +2439,8 @@ navit_block(struct navit *this_, int block) void navit_destroy(struct navit *this_) { + callback_list_call_attr_1(this_->attr_cbl, attr_destroy, this_); + /* TODO: destroy objects contained in this_ */ if (this_->vehicle) vehicle_destroy(this_->vehicle->vehicle);