//this_->attrs=attr_list_dup(attrs);
this_->trans=trans;
- this_->bookmark_file=g_strjoin(NULL, bookmarks_get_user_data_directory(TRUE), "/bookmark.txt", NULL);
- this_->working_file=g_strjoin(NULL, bookmarks_get_user_data_directory(TRUE), "/bookmark.txt.tmp", NULL);
+ this_->bookmark_file=g_strjoin(NULL, navit_get_user_data_directory(TRUE), "/bookmark.txt", NULL);
+ this_->working_file=g_strjoin(NULL, navit_get_user_data_directory(TRUE), "/bookmark.txt.tmp", NULL);
this_->clipboard=g_new0(struct bookmark_item_priv,1);
}
/*
- * bookmarks_get_user_data_directory
- *
- * returns the directory used to store user data files (center.txt,
- * destination.txt, bookmark.txt, ...)
- *
- * arg: gboolean create: create the directory if it does not exist
- */
-char*
-bookmarks_get_user_data_directory(gboolean 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;
-}
-
-/*
* bookmarks_get_destination_file
*
* returns the name of the file used to store destinations with its
char*
bookmarks_get_destination_file(gboolean create)
{
- return g_strjoin(NULL, bookmarks_get_user_data_directory(create), "/destination.txt", NULL);
+ return g_strjoin(NULL, navit_get_user_data_directory(create), "/destination.txt", NULL);
}
/*
char*
bookmarks_get_center_file(gboolean create)
{
- return g_strjoin(NULL, bookmarks_get_user_data_directory(create), "/center.txt", NULL);
+ return g_strjoin(NULL, navit_get_user_data_directory(create), "/center.txt", NULL);
}
void
void navit_set_center_screen(struct navit *this_, struct point *p, int set_timeout);
int navit_set_attr(struct navit *this_, struct attr *attr);
int navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+char* navit_get_user_data_directory(int create);
int navit_add_attr(struct navit *this_, struct attr *attr);
int navit_remove_attr(struct navit *this_, struct attr *attr);
struct attr_iter *navit_attr_iter_new(void);
osd_odometer_draw(this, nav, NULL);
}
-/*
- * osd_get_user_data_directory
- *
- * returns the directory used to store user data files (center.txt,
- * destination.txt, bookmark.txt, ...)
- *
- * arg: gboolean create: create the directory if it does not exist
- */
-char*
-osd_get_user_data_directory(gboolean 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;
-}
-
-
static void
osd_odometer_destroy(struct navit* nav)
{
odometers_saved = 1;
//save odometers that are persistent(ie have name)
GList* list = odometer_list;
- char* fn = g_strdup_printf("%s/odometer.txt",osd_get_user_data_directory(TRUE));
+ char* fn = g_strdup_printf("%s/odometer.txt",navit_get_user_data_directory(TRUE));
f = fopen(fn,"w+");
g_free(fn);
if(!f) {
//load state from file
FILE* f;
- char* fn = g_strdup_printf("%s/odometer.txt",osd_get_user_data_directory(FALSE));
+ char* fn = g_strdup_printf("%s/odometer.txt",navit_get_user_data_directory(FALSE));
f = fopen(fn,"r+");
if(f) {
#endif
-/**
- * @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*
-popup_get_user_data_directory(gboolean 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: popup_get_user_data_directory(gboolean create) */
-
static void
popup_traffic_distortion(struct item *item, char *attr)
{
/* add the configuration directory to the name of the file to use */
- char *dist_filename = g_strjoin(NULL, popup_get_user_data_directory(TRUE),
+ char *dist_filename = g_strjoin(NULL, navit_get_user_data_directory(TRUE),
"/distortion.txt", NULL);
if (dist_filename) /* if we built the filename */
{