aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-tree-selection-model.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-10-26 17:00:36 +0800
committerChris Lahey <clahey@src.gnome.org>2001-10-26 17:00:36 +0800
commitec99a182715d6c2efe1167adde2a2b4120a5b8b7 (patch)
tree94c1a73052b79b62a43680f01690d53de2832ee2 /widgets/table/e-tree-selection-model.c
parent464c50e4d7ed2099c1929cfb184187a1c623197d (diff)
downloadgsoc2013-evolution-ec99a182715d6c2efe1167adde2a2b4120a5b8b7.tar.gz
gsoc2013-evolution-ec99a182715d6c2efe1167adde2a2b4120a5b8b7.tar.zst
gsoc2013-evolution-ec99a182715d6c2efe1167adde2a2b4120a5b8b7.zip
If the root node is hidden and selected, don't count it in the selected
2001-10-26 Christopher James Lahey <clahey@ximian.com> * e-tree-selection-model.c (etsm_selected_count): If the root node is hidden and selected, don't count it in the selected path count. * e-tree.c (et_canvas_root_event): Attach to the event handler on the root canvas item instead of the canvas itself when making the ETree leave editing state. svn path=/trunk/; revision=14128
Diffstat (limited to 'widgets/table/e-tree-selection-model.c')
-rw-r--r--widgets/table/e-tree-selection-model.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c
index fca526eaf0..6f7a51d651 100644
--- a/widgets/table/e-tree-selection-model.c
+++ b/widgets/table/e-tree-selection-model.c
@@ -599,19 +599,18 @@ etsm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
}
static ETreeSelectionModelNode *
-etsm_recurse_is_path_selected (ESelectionModel *selection,
+etsm_recurse_is_path_selected (ETreeSelectionModel *etsm,
ETreePath path,
gboolean *is_selected)
{
ETreeSelectionModelNode *selection_node;
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
ETreeSorted *ets = etsm->priv->ets;
ETreePath parent;
parent = e_tree_model_node_get_parent(E_TREE_MODEL(ets), path);
if (parent) {
- selection_node = etsm_recurse_is_path_selected (selection, parent, is_selected);
+ selection_node = etsm_recurse_is_path_selected (etsm, parent, is_selected);
if (selection_node) {
int position = e_tree_sorted_orig_position(ets, path);
if (position < 0 || position >= selection_node->num_children) {
@@ -651,6 +650,21 @@ etsm_recurse_is_path_selected (ESelectionModel *selection,
}
}
+static gboolean
+etsm_is_path_selected (ETreeSelectionModel *etsm,
+ ETreePath path)
+{
+ ETreeSelectionModelNode *selection_node;
+ gboolean ret_val;
+
+ selection_node = etsm_recurse_is_path_selected (etsm, path, &ret_val);
+
+ if (selection_node)
+ ret_val = selection_node->selected;
+
+ return ret_val;
+}
+
/**
* e_selection_model_is_row_selected
* @selection: #ESelectionModel to check
@@ -666,22 +680,13 @@ etsm_is_row_selected (ESelectionModel *selection,
{
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
ETreePath path;
- ETreeSelectionModelNode *selection_node;
-
- gboolean ret_val;
g_return_val_if_fail(row < e_table_model_row_count(E_TABLE_MODEL(etsm->priv->etta)), FALSE);
g_return_val_if_fail(row >= 0, FALSE);
- g_return_val_if_fail(selection != NULL, FALSE);
+ g_return_val_if_fail(etsm != NULL, FALSE);
path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row);
-
- selection_node = etsm_recurse_is_path_selected (selection, path, &ret_val);
-
- if (selection_node)
- ret_val = selection_node->selected;
-
- return ret_val;
+ return etsm_is_path_selected (etsm, path);
}
@@ -803,6 +808,9 @@ etsm_selected_count (ESelectionModel *selection)
ETreePath model_root;
model_root = e_tree_model_get_root(etsm->priv->model);
etsm_selected_count_recurse(etsm, etsm->priv->root, model_root, &count);
+ if (!e_tree_table_adapter_root_node_is_visible (etsm->priv->etta) && etsm_is_path_selected (etsm, e_tree_model_get_root(etsm->priv->model))) {
+ count --;
+ }
}
return count;
}