From 9aecf47408f22f4f0a01e41648f25e1a7307b332 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 10 Aug 2016 18:36:41 +0100 Subject: Treeview: Rationalise initialisation and finalisation. Previously the expected behaviour for front ends using the correct API for hotlist, global history, cookie manager, and ssl cert viewer was that the front end would initialise the treeview module on startup and finalise it on application exit. However, this meant that the front ends had to include the core treeview header, which they didn't otherwise need. Since the tree module provided access to the new treeview utilities through the old tree API, and was used by front ends with no changes for the new treeview API, the tree layer refcounted initialisations of treeview-based widgets, and only called the underlying treeview init/fini functions when needed. This change moves that refcounting into the treeview module. Now the hotlist, global history, cookie manager, and ssl cert viewer widgets call call treeview init/fini as part of their own initialisation and finalisation. This means that front ends using the correct APIs for treeview-based widgets don't need to know anything about the underlying treeview, and the tree module compatibility layer has had its treeview refcounting removed. Finally, the treeview_init function took a font size parameter. Now it does not and lit gets font size from config. We probably want to add a new `treeview_font_size` option to nsoptions, and have differnent defaults on different platforms. 12pt on RISC OS, and 11pt elsewhere, most likely. --- desktop/tree.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'desktop/tree.c') diff --git a/desktop/tree.c b/desktop/tree.c index bfe8e9874..a5c97c33c 100644 --- a/desktop/tree.c +++ b/desktop/tree.c @@ -55,7 +55,6 @@ struct tree { struct sslcert_session_data *ssl_current_session = NULL; const char *tree_hotlist_path = NULL; -int treeview_inits; static void treeview_test_redraw_request(struct core_window *cw, const struct rect *r) @@ -128,11 +127,6 @@ static bool treeview_test_init(struct tree *tree) { nserror err; - treeview_inits++; - - if (treeview_inits == 1) - treeview_init(0); - switch (tree->flags) { case TREE_COOKIES: assert(ssl_current_session == NULL && @@ -195,10 +189,6 @@ static bool treeview_test_fini(struct tree *tree) break; } - if (treeview_inits == 1) - treeview_fini(); - treeview_inits--; - return true; } -- cgit v1.2.3