summaryrefslogtreecommitdiff
path: root/desktop/tree_url_node.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2011-11-10 13:07:47 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2011-11-10 13:07:47 +0000
commitdd6d1ce527ec4c8c1999f7fc646cea755ac00ca7 (patch)
tree3333e0c431665ecb19049b14b958bb05a9af9030 /desktop/tree_url_node.c
parent10237e0bde004c5a6db6674d7f521b67dbfde9b9 (diff)
downloadnetsurf-dd6d1ce527ec4c8c1999f7fc646cea755ac00ca7.tar.gz
netsurf-dd6d1ce527ec4c8c1999f7fc646cea755ac00ca7.tar.bz2
Make default hotlist folder persistent across sessions
svn path=/trunk/netsurf/; revision=13141
Diffstat (limited to 'desktop/tree_url_node.c')
-rw-r--r--desktop/tree_url_node.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/desktop/tree_url_node.c b/desktop/tree_url_node.c
index c1e72bfc4..fee361b85 100644
--- a/desktop/tree_url_node.c
+++ b/desktop/tree_url_node.c
@@ -576,6 +576,7 @@ static void tree_url_load_directory(xmlNode *ul, struct tree *tree,
char *title;
struct node *dir;
xmlNode *xmlnode;
+ xmlChar *id;
assert(ul != NULL);
assert(directory != NULL);
@@ -595,6 +596,7 @@ static void tree_url_load_directory(xmlNode *ul, struct tree *tree,
} else if (strcmp((const char *)xmlnode->name, "h4") == 0) {
/* directory */
+ bool dir_is_default = false;
title = (char *) xmlNodeGetContent(xmlnode );
if (!title) {
warn_user("TreeLoadError", "(Empty <h4> "
@@ -613,6 +615,13 @@ static void tree_url_load_directory(xmlNode *ul, struct tree *tree,
warn_user("TreeLoadError", "(Expected "
"<ul> not present.)");
return;
+ } else {
+ id = xmlGetProp(xmlnode, "id");
+ if (id != NULL) {
+ if(strcmp((const char *)id, "default") == 0)
+ dir_is_default = true;
+ xmlFree(id);
+ }
}
dir = tree_create_folder_node(tree, directory, title,
@@ -622,6 +631,10 @@ static void tree_url_load_directory(xmlNode *ul, struct tree *tree,
return;
}
+ if(dir_is_default == true) {
+ tree_set_default_folder_node(tree, dir);
+ }
+
if (callback != NULL)
tree_set_node_user_callback(dir, callback,
callback_data);
@@ -738,6 +751,8 @@ static bool tree_url_save_directory(struct node *directory, xmlNode *node)
ul = xmlNewChild(node, NULL, (const xmlChar *)"ul", NULL);
if (ul == NULL)
return false;
+ if (tree_node_is_default(directory) == true)
+ xmlSetProp(ul, "id", "default");
for (child = tree_node_get_child(directory); child;
child = tree_node_get_next(child)) {
@@ -767,12 +782,6 @@ static bool tree_url_save_directory(struct node *directory, xmlNode *node)
}
-
-
-
-
-
-
/**
* Perform a save to a specified file in the form of a html page
*