aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-tree-sorted.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-10-31 18:33:51 +0800
committerChris Lahey <clahey@src.gnome.org>2001-10-31 18:33:51 +0800
commit23587bebe83c772d08ab2ae7faa31dffa45b0987 (patch)
tree610958e3503f902d708b7facdbc381315b62f317 /widgets/table/e-tree-sorted.c
parenta06c0a0d1265e81e0672c859742474c623f3d2d8 (diff)
downloadgsoc2013-evolution-23587bebe83c772d08ab2ae7faa31dffa45b0987.tar.gz
gsoc2013-evolution-23587bebe83c772d08ab2ae7faa31dffa45b0987.tar.zst
gsoc2013-evolution-23587bebe83c772d08ab2ae7faa31dffa45b0987.zip
Added frozen_count variable to know not to show the cursor while a change
2001-10-31 Christopher James Lahey <clahey@ximian.com> * e-table-item.c, e-table-item.h: Added frozen_count variable to know not to show the cursor while a change is going on. * e-table-model.c, e-table-model.h, e-tree-model.c, e-tree-model.h: Added a model_no_change signal to pair with a pre_change if there's no change. * e-table-selection-model.h: Removed an unused frozen field here. * e-table-sorted.c, e-table-subset.c, e-table-subset.h, e-table-without.c, e-tree-memory.c, e-tree-sorted.c, e-tree-table-adapter.c: Made sure pre_changes were all matched by some change. Proxy no_change signal where appropriate. * e-tree-selection-model.c: Keep track of the frozen_count variable to know whether a change is going on. svn path=/trunk/; revision=14523
Diffstat (limited to 'widgets/table/e-tree-sorted.c')
-rw-r--r--widgets/table/e-tree-sorted.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c
index 632fc650dd..21b49b339c 100644
--- a/widgets/table/e-tree-sorted.c
+++ b/widgets/table/e-tree-sorted.c
@@ -93,6 +93,7 @@ struct ETreeSortedPriv {
ETreeSortedPath *last_access;
int tree_model_pre_change_id;
+ int tree_model_no_change_id;
int tree_model_node_changed_id;
int tree_model_node_data_changed_id;
int tree_model_node_col_changed_id;
@@ -390,12 +391,13 @@ new_path (ETreeSortedPath *parent, ETreePath corresponding)
return path;
}
-static void
+static gboolean
reposition_path (ETreeSorted *ets, ETreeSortedPath *path)
{
int new_index;
int old_index = path->position;
ETreeSortedPath *parent = path->parent;
+ gboolean changed = FALSE;
if (parent) {
if (ets->priv->sort_idle_id == 0) {
if (ets->priv->insert_count > ETS_INSERT_MAX) {
@@ -422,9 +424,9 @@ reposition_path (ETreeSorted *ets, ETreeSortedPath *path)
parent->children[new_index] = path;
for (i = old_index; i <= new_index; i++)
parent->children[i]->position = i;
+ changed = TRUE;
e_tree_model_node_changed(E_TREE_MODEL(ets), parent);
e_tree_sorted_node_resorted(ets, parent);
- e_tree_model_pre_change(E_TREE_MODEL(ets));
} else if (new_index < old_index) {
int i;
ets->priv->insert_count++;
@@ -432,14 +434,15 @@ reposition_path (ETreeSorted *ets, ETreeSortedPath *path)
parent->children[new_index] = path;
for (i = new_index; i <= old_index; i++)
parent->children[i]->position = i;
+ changed = TRUE;
e_tree_model_node_changed(E_TREE_MODEL(ets), parent);
e_tree_sorted_node_resorted(ets, parent);
- e_tree_model_pre_change(E_TREE_MODEL(ets));
}
}
} else
mark_path_needs_resort(ets, parent, TRUE, FALSE);
}
+ return changed;
}
static void
@@ -597,6 +600,8 @@ ets_destroy (GtkObject *object)
gtk_signal_disconnect (GTK_OBJECT (priv->source),
priv->tree_model_pre_change_id);
gtk_signal_disconnect (GTK_OBJECT (priv->source),
+ priv->tree_model_no_change_id);
+ gtk_signal_disconnect (GTK_OBJECT (priv->source),
priv->tree_model_node_changed_id);
gtk_signal_disconnect (GTK_OBJECT (priv->source),
priv->tree_model_node_data_changed_id);
@@ -611,6 +616,7 @@ ets_destroy (GtkObject *object)
priv->source = NULL;
priv->tree_model_pre_change_id = 0;
+ priv->tree_model_no_change_id = 0;
priv->tree_model_node_changed_id = 0;
priv->tree_model_node_data_changed_id = 0;
priv->tree_model_node_col_changed_id = 0;
@@ -991,6 +997,12 @@ ets_proxy_pre_change (ETreeModel *etm, ETreeSorted *ets)
}
static void
+ets_proxy_no_change (ETreeModel *etm, ETreeSorted *ets)
+{
+ e_tree_model_no_change(E_TREE_MODEL(ets));
+}
+
+static void
ets_proxy_node_changed (ETreeModel *etm, ETreePath node, ETreeSorted *ets)
{
ets->priv->last_access = NULL;
@@ -1009,8 +1021,8 @@ ets_proxy_node_changed (ETreeModel *etm, ETreePath node, ETreeSorted *ets)
if (path) {
free_children(path);
- reposition_path(ets, path);
- e_tree_model_node_changed(E_TREE_MODEL(ets), path);
+ if (!reposition_path(ets, path))
+ e_tree_model_node_changed(E_TREE_MODEL(ets), path);
}
}
}
@@ -1021,8 +1033,8 @@ ets_proxy_node_data_changed (ETreeModel *etm, ETreePath node, ETreeSorted *ets)
ETreeSortedPath *path = find_path(ets, node);
if (path) {
- reposition_path(ets, path);
- e_tree_model_node_data_changed(E_TREE_MODEL(ets), path);
+ if (!reposition_path(ets, path))
+ e_tree_model_node_data_changed(E_TREE_MODEL(ets), path);
}
}
@@ -1032,9 +1044,11 @@ ets_proxy_node_col_changed (ETreeModel *etm, ETreePath node, int col, ETreeSorte
ETreeSortedPath *path = find_path(ets, node);
if (path) {
+ gboolean changed = FALSE;
if (e_table_sorting_utils_affects_sort(ets->priv->sort_info, ets->priv->full_header, col))
- reposition_path(ets, path);
- e_tree_model_node_col_changed(E_TREE_MODEL(ets), path, col);
+ changed = reposition_path(ets, path);
+ if (!changed)
+ e_tree_model_node_col_changed(E_TREE_MODEL(ets), path, col);
}
}
@@ -1236,6 +1250,7 @@ e_tree_sorted_init (GtkObject *object)
priv->last_access = NULL;
priv->tree_model_pre_change_id = 0;
+ priv->tree_model_no_change_id = 0;
priv->tree_model_node_changed_id = 0;
priv->tree_model_node_data_changed_id = 0;
priv->tree_model_node_col_changed_id = 0;
@@ -1271,8 +1286,10 @@ e_tree_sorted_construct (ETreeSorted *ets, ETreeModel *source, ETableHeader *ful
ets->priv->sort_info = sort_info;
if (sort_info) gtk_object_ref(GTK_OBJECT(sort_info));
- ets->priv->tree_model_pre_change_id = gtk_signal_connect (GTK_OBJECT (source), "pre_change",
- GTK_SIGNAL_FUNC (ets_proxy_pre_change), ets);
+ ets->priv->tree_model_pre_change_id = gtk_signal_connect (GTK_OBJECT (source), "pre_change",
+ GTK_SIGNAL_FUNC (ets_proxy_pre_change), ets);
+ ets->priv->tree_model_no_change_id = gtk_signal_connect (GTK_OBJECT (source), "no_change",
+ GTK_SIGNAL_FUNC (ets_proxy_no_change), ets);
ets->priv->tree_model_node_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_changed",
GTK_SIGNAL_FUNC (ets_proxy_node_changed), ets);
ets->priv->tree_model_node_data_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_data_changed",