From 4313d4c4ec8bc45886f0ace9bdfea3f529ba433d Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 2 Jul 2013 17:30:52 +0100 Subject: [PATCH] Make flags for suppress resize. --- desktop/global_history.c | 6 ++++-- desktop/treeview.c | 8 ++++---- desktop/treeview.h | 13 +++++++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/desktop/global_history.c b/desktop/global_history.c index 29d744e0a..5196c1692 100644 --- a/desktop/global_history.c +++ b/desktop/global_history.c @@ -185,7 +185,8 @@ static nserror global_history_create_dir(enum global_history_folders f) relation, rel, &gh_ctx.folders[f].data, &gh_ctx.folders[f], - !gh_ctx.built); + gh_ctx.built ? TREE_CREATE_NONE : + TREE_CREATE_SUPPRESS_RESIZE); return err; } @@ -311,7 +312,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, - !gh_ctx.built); + gh_ctx.built ? TREE_CREATE_NONE : + TREE_CREATE_SUPPRESS_RESIZE); if (err != NSERROR_OK) { return err; } diff --git a/desktop/treeview.c b/desktop/treeview.c index 13d35a242..de57c490c 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, bool quiet) + void *data, treeview_node_create_flags flags) { struct treeview_node *n; @@ -324,7 +324,7 @@ nserror treeview_create_node_folder(struct treeview *tree, *folder = n; /* Inform front end of change in dimensions */ - if (!quiet) + if (!(flags & TREE_CREATE_SUPPRESS_RESIZE)) tree->cw_t->update_size(tree->cw_h, -1, tree->root->height); return NSERROR_OK; @@ -398,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, bool quiet) + void *data, treeview_node_create_flags flags) { bool match; struct treeview_node_entry *e; @@ -460,7 +460,7 @@ nserror treeview_create_node_entry(struct treeview *tree, *entry = n; /* Inform front end of change in dimensions */ - if (!quiet) + if (!(flags & TREE_CREATE_SUPPRESS_RESIZE)) 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 3539cf5ed..ad6aafca6 100644 --- a/desktop/treeview.h +++ b/desktop/treeview.h @@ -38,6 +38,11 @@ enum treeview_relationship { TREE_REL_NEXT_SIBLING }; /**< Relationship between nodes */ +typedef enum { + TREE_CREATE_NONE = (0), /* No flags set */ + TREE_CREATE_SUPPRESS_RESIZE = (1 << 0) /* Suppress callback */ +} treeview_node_create_flags; + enum treeview_msg { TREE_MSG_NODE_DELETE, /**< Node to be deleted */ TREE_MSG_NODE_EDIT, /**< Node to be edited */ @@ -138,7 +143,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 + * \param flags Node creation flags * \return NSERROR_OK on success, appropriate error otherwise * * Field name must match name past in treeview_create fields[N-1]. @@ -150,7 +155,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, bool quiet); + void *data, treeview_node_create_flags flags); /** * Create an entry node in given treeview @@ -161,7 +166,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 + * \param flags Node creation flags * \return NSERROR_OK on success, appropriate error otherwise * * Fields array names must match names past in treeview_create fields[0...N-2]. @@ -173,7 +178,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, bool quiet); + void *data, treeview_node_create_flags flags); /** * Update an entry node in given treeview