summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-07-01 16:16:11 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2013-07-01 16:16:11 +0100
commit21cd01a9b34d2c881bde8fbe8273ce78a0b67445 (patch)
treeafda162c6f0fc74e75bbc76a93c821167f89060d /desktop
parentbc37046c6c3ef8004ccb9fb11de4bfce1e672a40 (diff)
downloadnetsurf-21cd01a9b34d2c881bde8fbe8273ce78a0b67445.tar.gz
netsurf-21cd01a9b34d2c881bde8fbe8273ce78a0b67445.tar.bz2
Add quite param to insertion calls to suppress treeview height callback.
Diffstat (limited to 'desktop')
-rw-r--r--desktop/global_history.c12
-rw-r--r--desktop/treeview.c10
-rw-r--r--desktop/treeview.h14
3 files changed, 28 insertions, 8 deletions
diff --git a/desktop/global_history.c b/desktop/global_history.c
index 0a1e549d6..20bf3c9b6 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 1a3530c8a..13d35a242 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 9692d0aa7..3539cf5ed 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