summaryrefslogtreecommitdiff
path: root/navit/bookmarks.c
diff options
context:
space:
mode:
authorakashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-06-16 21:03:23 +0000
committerakashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-06-16 21:03:23 +0000
commitf70c5983d90a1f5f1f4a03b9797d7512e318afe2 (patch)
tree225b68aee14d76623fa3aea3dd9534d4f8d19d4e /navit/bookmarks.c
parent79207436eb735dfcd73e7f48e6588b00679fc3d0 (diff)
downloadnavit-svn-f70c5983d90a1f5f1f4a03b9797d7512e318afe2.tar.gz
Fix:core:Bookmarks saving procedure now produces a message in case of
failure. This closes ticket#165 git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@3362 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/bookmarks.c')
-rw-r--r--navit/bookmarks.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/navit/bookmarks.c b/navit/bookmarks.c
index 65571435..cf8a113e 100644
--- a/navit/bookmarks.c
+++ b/navit/bookmarks.c
@@ -29,6 +29,7 @@
#include "map.h"
#include "command.h"
#include "bookmarks.h"
+#include "navit_nls.h"
struct bookmarks {
//data storage
@@ -46,7 +47,7 @@ struct bookmarks {
struct transformation *trans;
struct attr **attrs;
struct callback_list *attr_cbl;
- struct attr *parent;
+ struct attr *parent;
};
struct bookmark_item_priv {
@@ -203,6 +204,10 @@ struct bookmarks *
bookmarks_new(struct attr *parent, struct attr **attrs, struct transformation *trans) {
struct bookmarks *this_;
+ if (parent->type!=attr_navit) {
+ return NULL;
+ }
+
this_ = g_new0(struct bookmarks,1);
this_->attr_cbl=callback_list_new();
this_->parent=parent;
@@ -260,10 +265,12 @@ bookmarks_store_bookmarks_to_file(struct bookmarks *this_, int limit,int replac
struct bookmark_item_priv *item,*parent_item;
char *fullname;
const char *prostr;
+ int result;
GHashTable *dedup=g_hash_table_new_full(g_str_hash,g_str_equal,g_free,NULL);
f=fopen(this_->working_file, replace ? "w+" : "a+");
if (f==NULL) {
+ navit_add_message(this_->parent->u.navit,_("Failed to write bookmarks file"));
return FALSE;
}
@@ -325,7 +332,12 @@ bookmarks_store_bookmarks_to_file(struct bookmarks *this_, int limit,int replac
g_hash_table_destroy(dedup);
- return rename(this_->working_file,this_->bookmark_file)==0;
+ result=(rename(this_->working_file,this_->bookmark_file)==0);
+ if (!result)
+ {
+ navit_add_message(this_->parent->u.navit,_("Failed to write bookmarks file"));
+ }
+ return result;
}
/*