Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/21cd01a9b34d2c881bde8...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/21cd01a9b34d2c881bde8fb...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/21cd01a9b34d2c881bde8fbe8...
The branch, master has been updated
via 21cd01a9b34d2c881bde8fbe8273ce78a0b67445 (commit)
from bc37046c6c3ef8004ccb9fb11de4bfce1e672a40 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=21cd01a9b34d2c881bd...
commit 21cd01a9b34d2c881bde8fbe8273ce78a0b67445
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Add quite param to insertion calls to suppress treeview height callback.
diff --git a/desktop/global_history.c b/desktop/global_history.c
index 0a1e549..20bf3c9 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -56,6 +56,7 @@ struct global_history_ctx {
struct global_history_folder folders[GH_N_FOLDERS];
time_t today;
int weekday;
+ bool built;
};
struct global_history_ctx gh_ctx;
@@ -183,7 +184,8 @@ static nserror global_history_create_dir(enum global_history_folders
f)
&gh_ctx.folders[f].folder,
relation, rel,
&gh_ctx.folders[f].data,
- &gh_ctx.folders[f]);
+ &gh_ctx.folders[f],
+ !gh_ctx.built);
return err;
}
@@ -308,7 +310,8 @@ static nserror global_history_entry_insert(struct global_history_entry
*e,
}
err = treeview_create_node_entry(gh_ctx.tree, &(e->entry),
- parent, TREE_REL_FIRST_CHILD, e->data, e);
+ parent, TREE_REL_FIRST_CHILD, e->data, e,
+ !gh_ctx.built);
if (err != NSERROR_OK) {
return err;
}
@@ -691,6 +694,11 @@ nserror global_history_init(struct core_window_callback_table *cw_t,
return err;
}
+ /* History tree is built
+ * We suppress the treeview height callback on entry insertion before
+ * the treeview is built. */
+ gh_ctx.built = true;
+
/* Expand the "Today" folder node */
err = treeview_node_expand(gh_ctx.tree,
gh_ctx.folders[GH_TODAY].folder);
diff --git a/desktop/treeview.c b/desktop/treeview.c
index 1a3530c..13d35a2 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -285,7 +285,7 @@ nserror treeview_create_node_folder(struct treeview *tree,
struct treeview_node *relation,
enum treeview_relationship rel,
const struct treeview_field_data *field,
- void *data)
+ void *data, bool quiet)
{
struct treeview_node *n;
@@ -324,7 +324,8 @@ nserror treeview_create_node_folder(struct treeview *tree,
*folder = n;
/* Inform front end of change in dimensions */
- tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
+ if (!quiet)
+ tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
return NSERROR_OK;
}
@@ -397,7 +398,7 @@ nserror treeview_create_node_entry(struct treeview *tree,
struct treeview_node *relation,
enum treeview_relationship rel,
const struct treeview_field_data fields[],
- void *data)
+ void *data, bool quiet)
{
bool match;
struct treeview_node_entry *e;
@@ -459,7 +460,8 @@ nserror treeview_create_node_entry(struct treeview *tree,
*entry = n;
/* Inform front end of change in dimensions */
- tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
+ if (!quiet)
+ tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
return NSERROR_OK;
}
diff --git a/desktop/treeview.h b/desktop/treeview.h
index 9692d0a..3539cf5 100644
--- a/desktop/treeview.h
+++ b/desktop/treeview.h
@@ -138,6 +138,7 @@ nserror treeview_destroy(struct treeview *tree);
* \param rel Folder's relationship to relation
* \param field Field data
* \param data Client data for node event callbacks
+ * \param quiet True to suppress corewindow height update callback
* \return NSERROR_OK on success, appropriate error otherwise
*
* Field name must match name past in treeview_create fields[N-1].
@@ -149,7 +150,7 @@ nserror treeview_create_node_folder(struct treeview *tree,
struct treeview_node *relation,
enum treeview_relationship rel,
const struct treeview_field_data *field,
- void *data);
+ void *data, bool quiet);
/**
* Create an entry node in given treeview
@@ -160,6 +161,7 @@ nserror treeview_create_node_folder(struct treeview *tree,
* \param rel Folder's relationship to relation
* \param fields Array of field data
* \param data Client data for node event callbacks
+ * \param quiet True to suppress corewindow height update callback
* \return NSERROR_OK on success, appropriate error otherwise
*
* Fields array names must match names past in treeview_create fields[0...N-2].
@@ -171,7 +173,7 @@ nserror treeview_create_node_entry(struct treeview *tree,
struct treeview_node *relation,
enum treeview_relationship rel,
const struct treeview_field_data fields[],
- void *data);
+ void *data, bool quiet);
/**
* Update an entry node in given treeview
@@ -278,4 +280,12 @@ bool treeview_clear_selection(struct treeview *tree, struct rect
*rect);
*/
bool treeview_select_all(struct treeview *tree, struct rect *rect);
+/**
+ * Find current height of a treeview
+ *
+ * \param tree Treeview object to find height of
+ * \return height of treeview in px
+ */
+int treeview_get_height(struct treeview *tree);
+
#endif
-----------------------------------------------------------------------
Summary of changes:
desktop/global_history.c | 12 ++++++++++--
desktop/treeview.c | 10 ++++++----
desktop/treeview.h | 14 ++++++++++++--
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/desktop/global_history.c b/desktop/global_history.c
index 0a1e549..20bf3c9 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -56,6 +56,7 @@ struct global_history_ctx {
struct global_history_folder folders[GH_N_FOLDERS];
time_t today;
int weekday;
+ bool built;
};
struct global_history_ctx gh_ctx;
@@ -183,7 +184,8 @@ static nserror global_history_create_dir(enum global_history_folders
f)
&gh_ctx.folders[f].folder,
relation, rel,
&gh_ctx.folders[f].data,
- &gh_ctx.folders[f]);
+ &gh_ctx.folders[f],
+ !gh_ctx.built);
return err;
}
@@ -308,7 +310,8 @@ static nserror global_history_entry_insert(struct global_history_entry
*e,
}
err = treeview_create_node_entry(gh_ctx.tree, &(e->entry),
- parent, TREE_REL_FIRST_CHILD, e->data, e);
+ parent, TREE_REL_FIRST_CHILD, e->data, e,
+ !gh_ctx.built);
if (err != NSERROR_OK) {
return err;
}
@@ -691,6 +694,11 @@ nserror global_history_init(struct core_window_callback_table *cw_t,
return err;
}
+ /* History tree is built
+ * We suppress the treeview height callback on entry insertion before
+ * the treeview is built. */
+ gh_ctx.built = true;
+
/* Expand the "Today" folder node */
err = treeview_node_expand(gh_ctx.tree,
gh_ctx.folders[GH_TODAY].folder);
diff --git a/desktop/treeview.c b/desktop/treeview.c
index 1a3530c..13d35a2 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -285,7 +285,7 @@ nserror treeview_create_node_folder(struct treeview *tree,
struct treeview_node *relation,
enum treeview_relationship rel,
const struct treeview_field_data *field,
- void *data)
+ void *data, bool quiet)
{
struct treeview_node *n;
@@ -324,7 +324,8 @@ nserror treeview_create_node_folder(struct treeview *tree,
*folder = n;
/* Inform front end of change in dimensions */
- tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
+ if (!quiet)
+ tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
return NSERROR_OK;
}
@@ -397,7 +398,7 @@ nserror treeview_create_node_entry(struct treeview *tree,
struct treeview_node *relation,
enum treeview_relationship rel,
const struct treeview_field_data fields[],
- void *data)
+ void *data, bool quiet)
{
bool match;
struct treeview_node_entry *e;
@@ -459,7 +460,8 @@ nserror treeview_create_node_entry(struct treeview *tree,
*entry = n;
/* Inform front end of change in dimensions */
- tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
+ if (!quiet)
+ tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
return NSERROR_OK;
}
diff --git a/desktop/treeview.h b/desktop/treeview.h
index 9692d0a..3539cf5 100644
--- a/desktop/treeview.h
+++ b/desktop/treeview.h
@@ -138,6 +138,7 @@ nserror treeview_destroy(struct treeview *tree);
* \param rel Folder's relationship to relation
* \param field Field data
* \param data Client data for node event callbacks
+ * \param quiet True to suppress corewindow height update callback
* \return NSERROR_OK on success, appropriate error otherwise
*
* Field name must match name past in treeview_create fields[N-1].
@@ -149,7 +150,7 @@ nserror treeview_create_node_folder(struct treeview *tree,
struct treeview_node *relation,
enum treeview_relationship rel,
const struct treeview_field_data *field,
- void *data);
+ void *data, bool quiet);
/**
* Create an entry node in given treeview
@@ -160,6 +161,7 @@ nserror treeview_create_node_folder(struct treeview *tree,
* \param rel Folder's relationship to relation
* \param fields Array of field data
* \param data Client data for node event callbacks
+ * \param quiet True to suppress corewindow height update callback
* \return NSERROR_OK on success, appropriate error otherwise
*
* Fields array names must match names past in treeview_create fields[0...N-2].
@@ -171,7 +173,7 @@ nserror treeview_create_node_entry(struct treeview *tree,
struct treeview_node *relation,
enum treeview_relationship rel,
const struct treeview_field_data fields[],
- void *data);
+ void *data, bool quiet);
/**
* Update an entry node in given treeview
@@ -278,4 +280,12 @@ bool treeview_clear_selection(struct treeview *tree, struct rect
*rect);
*/
bool treeview_select_all(struct treeview *tree, struct rect *rect);
+/**
+ * Find current height of a treeview
+ *
+ * \param tree Treeview object to find height of
+ * \return height of treeview in px
+ */
+int treeview_get_height(struct treeview *tree);
+
#endif
--
NetSurf Browser