aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-table-item.c4
-rw-r--r--widgets/table/e-tree-memory.c3
-rw-r--r--widgets/table/e-tree-model.c28
-rw-r--r--widgets/table/e-tree-model.h8
-rw-r--r--widgets/table/e-tree-selection-model.c26
-rw-r--r--widgets/table/e-tree-sorted.c13
6 files changed, 78 insertions, 4 deletions
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index d090aa9b43..df8474eb15 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -978,6 +978,7 @@ eti_freeze (ETableItem *eti)
static void
eti_unfreeze (ETableItem *eti)
{
+ g_return_if_fail (eti->frozen_count != 0);
eti->frozen_count --;
if (eti->frozen_count == 0 && eti->queue_show_cursor) {
eti_show_cursor (eti, 0);
@@ -1210,7 +1211,8 @@ eti_add_table_model (ETableItem *eti, ETableModel *table_model)
if (eti->source_model)
gtk_object_ref(GTK_OBJECT(eti->source_model));
}
-
+
+ eti_freeze (eti);
eti_table_model_changed (table_model, eti);
}
diff --git a/widgets/table/e-tree-memory.c b/widgets/table/e-tree-memory.c
index 1d266ae1d1..9f6af6535c 100644
--- a/widgets/table/e-tree-memory.c
+++ b/widgets/table/e-tree-memory.c
@@ -571,6 +571,9 @@ e_tree_memory_node_remove (ETreeMemory *etree, ETreePath node)
if (path == etree->priv->root)
etree->priv->root = NULL;
+ if (!etree->priv->frozen)
+ e_tree_model_node_deleted(E_TREE_MODEL(etree), path);
+
return ret;
}
diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c
index d6974ada97..12253bcd09 100644
--- a/widgets/table/e-tree-model.c
+++ b/widgets/table/e-tree-model.c
@@ -52,6 +52,7 @@ enum {
NODE_COL_CHANGED,
NODE_INSERTED,
NODE_REMOVED,
+ NODE_DELETED,
LAST_SIGNAL
};
@@ -121,6 +122,14 @@ e_tree_model_class_init (GtkObjectClass *klass)
e_marshal_NONE__POINTER_POINTER_INT,
GTK_TYPE_NONE, 3, GTK_TYPE_POINTER, GTK_TYPE_POINTER, GTK_TYPE_INT);
+ e_tree_model_signals [NODE_DELETED] =
+ gtk_signal_new ("node_deleted",
+ GTK_RUN_LAST,
+ E_OBJECT_CLASS_TYPE (klass),
+ GTK_SIGNAL_OFFSET (ETreeModelClass, node_deleted),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+
E_OBJECT_CLASS_ADD_SIGNALS (klass, e_tree_model_signals, LAST_SIGNAL);
tree_class->get_root = NULL;
@@ -165,6 +174,7 @@ e_tree_model_class_init (GtkObjectClass *klass)
tree_class->node_col_changed = NULL;
tree_class->node_inserted = NULL;
tree_class->node_removed = NULL;
+ tree_class->node_deleted = NULL;
}
static void
@@ -312,6 +322,24 @@ e_tree_model_node_removed (ETreeModel *tree_model, ETreePath parent_node, ETree
parent_node, removed_node, old_position);
}
+/**
+ * e_tree_model_node_deleted:
+ * @tree_model:
+ * @deleted_node:
+ *
+ *
+ **/
+void
+e_tree_model_node_deleted (ETreeModel *tree_model, ETreePath deleted_node)
+{
+ g_return_if_fail (tree_model != NULL);
+ g_return_if_fail (E_IS_TREE_MODEL (tree_model));
+
+ gtk_signal_emit (GTK_OBJECT (tree_model),
+ e_tree_model_signals [NODE_DELETED],
+ deleted_node);
+}
+
/**
diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h
index f7d3497841..c80a131b1c 100644
--- a/widgets/table/e-tree-model.h
+++ b/widgets/table/e-tree-model.h
@@ -97,6 +97,11 @@ struct ETreeModelClass {
/*
* Signals
*/
+ /* During remove, the ETreePath of the child is removed from
+ * the tree but is still valid. At node_deleted, the
+ * ETreePath is no longer valid.
+ */
+
void (*pre_change) (ETreeModel *etm);
void (*no_change) (ETreeModel *etm);
void (*node_changed) (ETreeModel *etm, ETreePath node);
@@ -104,6 +109,7 @@ struct ETreeModelClass {
void (*node_col_changed) (ETreeModel *etm, ETreePath node, int col);
void (*node_inserted) (ETreeModel *etm, ETreePath parent, ETreePath inserted_node);
void (*node_removed) (ETreeModel *etm, ETreePath parent, ETreePath removed_node, int old_position);
+ void (*node_deleted) (ETreeModel *etm, ETreePath deleted_node);
};
GtkType e_tree_model_get_type (void);
ETreeModel *e_tree_model_new (void);
@@ -201,6 +207,8 @@ void e_tree_model_node_removed (ETreeModel *tree_model,
ETreePath parent_node,
ETreePath removed_node,
int old_position);
+void e_tree_model_node_deleted (ETreeModel *tree_model,
+ ETreePath deleted_node);
#ifdef __cplusplus
}
diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c
index 7914cb022a..87c17b7e80 100644
--- a/widgets/table/e-tree-selection-model.c
+++ b/widgets/table/e-tree-selection-model.c
@@ -79,6 +79,7 @@ struct ETreeSelectionModelPriv {
int tree_model_node_col_changed_id;
int tree_model_node_inserted_id;
int tree_model_node_removed_id;
+ int tree_model_node_deleted_id;
int sorted_model_node_resorted_id;
};
@@ -378,7 +379,7 @@ etsm_no_change (ETreeModel *etm, ETreeSelectionModel *etsm)
}
static void
-etsm_node_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm)
+clear_tree (ETreeSelectionModel *etsm, ETreeModel *etm)
{
int cursor_row;
@@ -407,6 +408,12 @@ etsm_node_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm)
g_free (etsm->priv->cursor_save_id);
etsm->priv->cursor_save_id = NULL;
+}
+
+static void
+etsm_node_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm)
+{
+ clear_tree (etsm, etm);
etsm_unfreeze (etsm);
}
@@ -429,7 +436,8 @@ etsm_node_col_changed (ETreeModel *etm, ETreePath node, int col, ETreeSelectionM
static void
etsm_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETreeSelectionModel *etsm)
{
- etsm_node_changed(etm, parent, etsm);
+ clear_tree (etsm, etm);
+ etsm_unfreeze (etsm);
#if 0
ETreeSelectionModelNode *node;
ETreePath path;
@@ -451,7 +459,13 @@ etsm_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETreeSel
static void
etsm_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, int old_position, ETreeSelectionModel *etsm)
{
- etsm_node_changed(etm, parent, etsm);
+}
+
+static void
+etsm_node_deleted (ETreeModel *etm, ETreePath parent, ETreePath child, int old_position, ETreeSelectionModel *etsm)
+{
+ clear_tree (etsm, etm);
+ etsm_unfreeze (etsm);
}
@@ -492,6 +506,8 @@ add_model(ETreeSelectionModel *etsm, ETreeModel *model)
GTK_SIGNAL_FUNC (etsm_node_inserted), etsm);
priv->tree_model_node_removed_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_removed",
GTK_SIGNAL_FUNC (etsm_node_removed), etsm);
+ priv->tree_model_node_deleted_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_deleted",
+ GTK_SIGNAL_FUNC (etsm_node_deleted), etsm);
}
static void
@@ -516,6 +532,8 @@ drop_model(ETreeSelectionModel *etsm)
priv->tree_model_node_inserted_id);
gtk_signal_disconnect (GTK_OBJECT (priv->model),
priv->tree_model_node_removed_id);
+ gtk_signal_disconnect (GTK_OBJECT (priv->model),
+ priv->tree_model_node_deleted_id);
gtk_object_unref (GTK_OBJECT (priv->model));
priv->model = NULL;
@@ -527,6 +545,7 @@ drop_model(ETreeSelectionModel *etsm)
priv->tree_model_node_col_changed_id = 0;
priv->tree_model_node_inserted_id = 0;
priv->tree_model_node_removed_id = 0;
+ priv->tree_model_node_deleted_id = 0;
}
@@ -1231,6 +1250,7 @@ e_tree_selection_model_init (ETreeSelectionModel *etsm)
priv->tree_model_node_col_changed_id = 0;
priv->tree_model_node_inserted_id = 0;
priv->tree_model_node_removed_id = 0;
+ priv->tree_model_node_deleted_id = 0;
priv->sorted_model_node_resorted_id = 0;
}
diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c
index 21b49b339c..56bd3d3db6 100644
--- a/widgets/table/e-tree-sorted.c
+++ b/widgets/table/e-tree-sorted.c
@@ -99,6 +99,7 @@ struct ETreeSortedPriv {
int tree_model_node_col_changed_id;
int tree_model_node_inserted_id;
int tree_model_node_removed_id;
+ int tree_model_node_deleted_id;
int sort_info_changed_id;
int sort_idle_id;
@@ -611,6 +612,8 @@ ets_destroy (GtkObject *object)
priv->tree_model_node_inserted_id);
gtk_signal_disconnect (GTK_OBJECT (priv->source),
priv->tree_model_node_removed_id);
+ gtk_signal_disconnect (GTK_OBJECT (priv->source),
+ priv->tree_model_node_deleted_id);
gtk_object_unref (GTK_OBJECT (priv->source));
priv->source = NULL;
@@ -622,6 +625,7 @@ ets_destroy (GtkObject *object)
priv->tree_model_node_col_changed_id = 0;
priv->tree_model_node_inserted_id = 0;
priv->tree_model_node_removed_id = 0;
+ priv->tree_model_node_deleted_id = 0;
}
if (priv->sort_info) {
@@ -1154,6 +1158,12 @@ ets_proxy_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, int
}
static void
+ets_proxy_node_deleted (ETreeModel *etm, ETreePath child, ETreeSorted *ets)
+{
+ e_tree_model_node_deleted(E_TREE_MODEL(ets), NULL);
+}
+
+static void
ets_sort_info_changed (ETableSortInfo *sort_info, ETreeSorted *ets)
{
schedule_resort(ets, ets->priv->root, TRUE, TRUE);
@@ -1256,6 +1266,7 @@ e_tree_sorted_init (GtkObject *object)
priv->tree_model_node_col_changed_id = 0;
priv->tree_model_node_inserted_id = 0;
priv->tree_model_node_removed_id = 0;
+ priv->tree_model_node_deleted_id = 0;
priv->sort_info_changed_id = 0;
priv->sort_idle_id = 0;
@@ -1300,6 +1311,8 @@ e_tree_sorted_construct (ETreeSorted *ets, ETreeModel *source, ETableHeader *ful
GTK_SIGNAL_FUNC (ets_proxy_node_inserted), ets);
ets->priv->tree_model_node_removed_id = gtk_signal_connect (GTK_OBJECT (source), "node_removed",
GTK_SIGNAL_FUNC (ets_proxy_node_removed), ets);
+ ets->priv->tree_model_node_deleted_id = gtk_signal_connect (GTK_OBJECT (source), "node_deleted",
+ GTK_SIGNAL_FUNC (ets_proxy_node_deleted), ets);
ets->priv->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed",
GTK_SIGNAL_FUNC (ets_sort_info_changed), ets);