summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2010-12-14 00:18:24 +0000
committerVincent Sanders <vince@netsurf-browser.org>2010-12-14 00:18:24 +0000
commit60c840628f4f2aebc86adea495258be1ecc738e8 (patch)
tree45a947044dbf5629d0c928ad7f82321060ee2dc7 /desktop
parent67556f54feaba380bb48459beb9b85329e67fc7c (diff)
downloadnetsurf-60c840628f4f2aebc86adea495258be1ecc738e8.tar.gz
netsurf-60c840628f4f2aebc86adea495258be1ecc738e8.tar.bz2
Small refactor to change icon names to being passed in from frontends instead of core treeview globals
svn path=/trunk/netsurf/; revision=11053
Diffstat (limited to 'desktop')
-rw-r--r--desktop/cookies.c6
-rw-r--r--desktop/cookies.h2
-rw-r--r--desktop/history_global_core.c6
-rw-r--r--desktop/history_global_core.h2
-rw-r--r--desktop/hotlist.c8
-rw-r--r--desktop/hotlist.h10
-rw-r--r--desktop/sslcert.c4
-rw-r--r--desktop/sslcert.h2
-rw-r--r--desktop/tree.h4
-rw-r--r--desktop/tree_url_node.c4
-rw-r--r--desktop/tree_url_node.h2
11 files changed, 27 insertions, 23 deletions
diff --git a/desktop/cookies.c b/desktop/cookies.c
index 09aa079a9..e22dcc289 100644
--- a/desktop/cookies.c
+++ b/desktop/cookies.c
@@ -371,14 +371,14 @@ static void cookies_schedule_callback(void *scheduled_data)
* \param end_redraw callback function called after every redraw
* \return true on success, false on memory exhaustion
*/
-bool cookies_initialise(struct tree *tree)
+bool cookies_initialise(struct tree *tree, const char* folder_icon_name, const char* cookie_icon_name)
{
if (tree == NULL)
return false;
- folder_icon = tree_load_icon(tree_directory_icon_name);
- cookie_icon = tree_load_icon(tree_content_icon_name);
+ folder_icon = tree_load_icon(folder_icon_name);
+ cookie_icon = tree_load_icon(cookie_icon_name);
/* Create an empty tree */
cookies_tree = tree;
diff --git a/desktop/cookies.h b/desktop/cookies.h
index 06278c006..9e0d79fbb 100644
--- a/desktop/cookies.h
+++ b/desktop/cookies.h
@@ -29,7 +29,7 @@
struct cookie_data;
-bool cookies_initialise(struct tree *tree);
+bool cookies_initialise(struct tree *tree, const char* folder_icon_name, const char* cookie_icon_name);
unsigned int cookies_get_tree_flags(void);
/**
diff --git a/desktop/history_global_core.c b/desktop/history_global_core.c
index 3589346ed..771928467 100644
--- a/desktop/history_global_core.c
+++ b/desktop/history_global_core.c
@@ -278,10 +278,10 @@ static bool history_global_initialise_nodes(void)
* \param end_redraw callback function called after every redraw
* \return true on success, false on memory exhaustion
*/
-bool history_global_initialise(struct tree *tree)
+bool history_global_initialise(struct tree *tree, const char* folder_icon_name)
{
- folder_icon = tree_load_icon(tree_directory_icon_name);
- tree_url_node_init();
+ folder_icon = tree_load_icon(folder_icon_name);
+ tree_url_node_init(folder_icon_name);
if (tree == NULL)
return false;
diff --git a/desktop/history_global_core.h b/desktop/history_global_core.h
index 97c578f3d..1bb343dd6 100644
--- a/desktop/history_global_core.h
+++ b/desktop/history_global_core.h
@@ -24,7 +24,7 @@
#include "desktop/tree.h"
-bool history_global_initialise(struct tree *tree);
+bool history_global_initialise(struct tree *tree, const char* folder_icon_name);
unsigned int history_global_get_tree_flags(void);
void history_global_cleanup(void);
diff --git a/desktop/hotlist.c b/desktop/hotlist.c
index 74b071d8e..cb5362050 100644
--- a/desktop/hotlist.c
+++ b/desktop/hotlist.c
@@ -111,8 +111,8 @@ static node_callback_resp hotlist_node_callback(void *user_data,
return NODE_CALLBACK_NOT_HANDLED;
}
-
-bool hotlist_initialise(struct tree *tree, const char *hotlist_path)
+/* exported interface documented in hotlist.h */
+bool hotlist_initialise(struct tree *tree, const char *hotlist_path, const char* folder_icon_name)
{
struct node *node;
const struct url_data *url_data;
@@ -123,9 +123,9 @@ bool hotlist_initialise(struct tree *tree, const char *hotlist_path)
creating_node = false;
- folder_icon = tree_load_icon(tree_directory_icon_name);
+ folder_icon = tree_load_icon(folder_icon_name);
- tree_url_node_init();
+ tree_url_node_init(folder_icon_name);
if (tree == NULL)
return false;
diff --git a/desktop/hotlist.h b/desktop/hotlist.h
index 84f573a90..efce84696 100644
--- a/desktop/hotlist.h
+++ b/desktop/hotlist.h
@@ -30,7 +30,15 @@
#include "desktop/tree.h"
-bool hotlist_initialise(struct tree *tree, const char *hotlist_path);
+/**
+ * Initialise the hotlist from a frontend.
+ *
+ * \param tree The tree object which holds the hotlist.
+ * \param hotlist_path The file path to initialise the hotlist entries from.
+ * \param folder_icon_name The name to use for folder icons.
+ */
+bool hotlist_initialise(struct tree *tree, const char *hotlist_path, const char* folder_icon_name);
+
unsigned int hotlist_get_tree_flags(void);
void hotlist_cleanup(const char *hotlist_path);
diff --git a/desktop/sslcert.c b/desktop/sslcert.c
index 2d10b4719..9aff25700 100644
--- a/desktop/sslcert.c
+++ b/desktop/sslcert.c
@@ -59,9 +59,9 @@ struct sslcert_session_data {
static hlcache_handle *sslcert_icon;
/** Initialise ssl certificate window. */
-void sslcert_init(void)
+void sslcert_init(const char* icon_name)
{
- sslcert_icon = tree_load_icon(tree_content_icon_name);
+ sslcert_icon = tree_load_icon(icon_name);
}
diff --git a/desktop/sslcert.h b/desktop/sslcert.h
index bc1b8bef8..8fe534846 100644
--- a/desktop/sslcert.h
+++ b/desktop/sslcert.h
@@ -26,7 +26,7 @@
struct sslcert_session_data;
-void sslcert_init(void);
+void sslcert_init(const char* icon_name);
unsigned int sslcert_get_tree_flags(void);
void sslcert_cleanup(void);
diff --git a/desktop/tree.h b/desktop/tree.h
index aaf82af83..1703c3784 100644
--- a/desktop/tree.h
+++ b/desktop/tree.h
@@ -55,10 +55,6 @@ enum tree_flags {
*/
#define TREE_ELEMENT_TITLE 0x00
-/* these should be defined in front end code */
-extern const char tree_directory_icon_name[];
-extern const char tree_content_icon_name[];
-
struct tree;
struct node;
struct node_element;
diff --git a/desktop/tree_url_node.c b/desktop/tree_url_node.c
index ff21d97bf..182c9332d 100644
--- a/desktop/tree_url_node.c
+++ b/desktop/tree_url_node.c
@@ -103,7 +103,7 @@ struct icon_entry icon_table[] = {
};
-void tree_url_node_init(void)
+void tree_url_node_init(const char *folder_icon_name)
{
struct icon_entry *entry;
char icon_name[MAX_ICON_NAME_LEN];
@@ -112,7 +112,7 @@ void tree_url_node_init(void)
return;
initialised = true;
- folder_icon = tree_load_icon(tree_directory_icon_name);
+ folder_icon = tree_load_icon(folder_icon_name);
entry = icon_table;
do {
diff --git a/desktop/tree_url_node.h b/desktop/tree_url_node.h
index 4bee73ebc..fbecf7f28 100644
--- a/desktop/tree_url_node.h
+++ b/desktop/tree_url_node.h
@@ -27,7 +27,7 @@
#include "desktop/tree.h"
-void tree_url_node_init(void);
+void tree_url_node_init(const char *folder_icon_name);
struct node *tree_create_URL_node(struct tree *tree,
struct node *parent, const char *url, const char *title,
tree_node_user_callback, void *callback_data);