summaryrefslogtreecommitdiff
path: root/amiga/hotlist.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2008-10-11 21:38:04 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2008-10-11 21:38:04 +0000
commit86042c61eae1b38474b8e20ece95b2220a659ae4 (patch)
tree4beae93c3cb85d5e6f6be1c36764660e643864e4 /amiga/hotlist.c
parent3b0c91c91ddc42bb76fbf30b0f2384c7369415c7 (diff)
downloadnetsurf-86042c61eae1b38474b8e20ece95b2220a659ae4.tar.gz
netsurf-86042c61eae1b38474b8e20ece95b2220a659ae4.tar.bz2
Improved Amiga treeview support. Now creates trees for cookies and history (history
doesn't populate at the moment). Can add folders and edit titles in hotlist treeviews, and delete entries in all treeviews. svn path=/trunk/netsurf/; revision=5542
Diffstat (limited to 'amiga/hotlist.c')
-rwxr-xr-xamiga/hotlist.c58
1 files changed, 56 insertions, 2 deletions
diff --git a/amiga/hotlist.c b/amiga/hotlist.c
index 2b61f93bd..3dbd1e00f 100755
--- a/amiga/hotlist.c
+++ b/amiga/hotlist.c
@@ -21,15 +21,68 @@
#include "desktop/tree.h"
#include <proto/exec.h>
#include "content/urldb.h"
+#include "amiga/hotlist.h"
+
+void ami_gui_hotlist_visited(struct content *content, struct tree *tree,
+ struct node *node);
+
+static const struct {
+ const char *url;
+ const char *msg_key;
+} default_entries[] = {
+ { "http://www.netsurf-browser.org/", "HotlistHomepage" },
+// { "http://www.netsurf-browser.org/builds/", "HotlistTestBuild" },
+ { "http://www.netsurf-browser.org/documentation/", "HotlistDocumentation" },
+ { "http://sourceforge.net/tracker/?atid=464312&group_id=51719",
+ "HotlistBugTracker" },
+ { "http://sourceforge.net/tracker/?atid=464315&group_id=51719",
+ "HotlistFeatureRequest" },
+ { "http://www.unsatisfactorysoftware.co.uk",
+ "Unsatisfactory Software" }
+};
+#define ENTRIES_COUNT (sizeof(default_entries) / sizeof(default_entries[0]))
void hotlist_visited(struct content *content)
{
+ if ((!content) || (!content->url) || (!hotlist))
+ return;
+ ami_gui_hotlist_visited(content, hotlist, hotlist->root);
+}
+
+/**
+ * Informs the hotlist that some content has been visited
+ *
+ * \param content the content visited
+ * \param tree the tree to find the URL data from
+ * \param node the node to update siblings and children of
+ */
+void ami_gui_hotlist_visited(struct content *content, struct tree *tree,
+ struct node *node)
+{
+ struct node_element *element;
+
+ for (; node; node = node->next) {
+ if (!node->folder) {
+ element = tree_find_element(node, TREE_ELEMENT_URL);
+ if ((element) && (!strcmp(element->text,
+ content->url))) {
+ tree_update_URL_node(node, content->url, NULL);
+ tree_handle_node_changed(tree, node, true,
+ false);
+ }
+ }
+ if (node->child)
+ ami_gui_hotlist_visited(content, tree, node->child);
+ }
}
void ami_hotlist_init(struct tree **hotlist)
{
struct tree *hotlist_tree;
struct node *node;
+ int i;
+ const struct url_data *data;
+
*hotlist = AllocVec(sizeof(struct tree),MEMF_CLEAR);
hotlist_tree = *hotlist;
@@ -50,7 +103,6 @@ void ami_hotlist_init(struct tree **hotlist)
if (!node)
node = hotlist_tree->root;
-/*
for (i = 0; i != ENTRIES_COUNT; i++) {
data = urldb_get_url_data(default_entries[i].url);
if (!data) {
@@ -67,7 +119,7 @@ void ami_hotlist_init(struct tree **hotlist)
messages_get(default_entries[i].msg_key));
}
}
-*/
+
tree_initialise(hotlist_tree);
}
@@ -87,4 +139,6 @@ void ami_hotlist_add(struct node *node,struct content *c)
{
tree_create_URL_node(node,c->url,data,c->title);
}
+
+ tree_handle_node_changed(hotlist,node,false,true);
}