aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-04-01 04:23:20 +0800
committerChris Lahey <clahey@src.gnome.org>2001-04-01 04:23:20 +0800
commit2e9fe25b8edb725fdb14bd65e9333b701c23614d (patch)
treebb9eba1b0c8e8c46f30f1f6fd50b483945417b91
parent48e35cdf4cb43d172a61ffa86e24e0c25b156680 (diff)
downloadgsoc2013-evolution-2e9fe25b8edb725fdb14bd65e9333b701c23614d.tar
gsoc2013-evolution-2e9fe25b8edb725fdb14bd65e9333b701c23614d.tar.gz
gsoc2013-evolution-2e9fe25b8edb725fdb14bd65e9333b701c23614d.tar.bz2
gsoc2013-evolution-2e9fe25b8edb725fdb14bd65e9333b701c23614d.tar.lz
gsoc2013-evolution-2e9fe25b8edb725fdb14bd65e9333b701c23614d.tar.xz
gsoc2013-evolution-2e9fe25b8edb725fdb14bd65e9333b701c23614d.tar.zst
gsoc2013-evolution-2e9fe25b8edb725fdb14bd65e9333b701c23614d.zip
Include <gal/util/e-util.h> here.
2001-03-31 Christopher James Lahey <clahey@ximian.com> * e-tree-scrolled.c: Include <gal/util/e-util.h> here. * e-tree-selection-model.c, e-tree-selection-model.h: Privatized this class. Cleaned this up a bit. Added handlers for signals from the model. * e-tree.c, e-tree.h: Privatized this class. svn path=/trunk/; revision=9075
-rw-r--r--widgets/table/e-tree-scrolled.c1
-rw-r--r--widgets/table/e-tree-selection-model.c649
-rw-r--r--widgets/table/e-tree-selection-model.h23
-rw-r--r--widgets/table/e-tree.c694
-rw-r--r--widgets/table/e-tree.h68
5 files changed, 796 insertions, 639 deletions
diff --git a/widgets/table/e-tree-scrolled.c b/widgets/table/e-tree-scrolled.c
index 35a5be3729..ba1780036c 100644
--- a/widgets/table/e-tree-scrolled.c
+++ b/widgets/table/e-tree-scrolled.c
@@ -17,6 +17,7 @@
#include <gtk/gtksignal.h>
#include <gnome-xml/parser.h>
#include <gnome-xml/xmlmemory.h>
+#include <gal/util/e-util.h>
#include "e-tree-scrolled.h"
diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c
index ac34653362..6198973395 100644
--- a/widgets/table/e-tree-selection-model.c
+++ b/widgets/table/e-tree-selection-model.c
@@ -10,9 +10,12 @@
#include <config.h>
#include <gtk/gtksignal.h>
#include "e-tree-selection-model.h"
-#include "gal/util/e-bit-array.h"
-#include "gal/util/e-util.h"
+#include <gal/util/e-bit-array.h>
+#include <gal/util/e-sorter.h>
+#include <gal/util/e-util.h>
#include <gdk/gdkkeysyms.h>
+#include <gal/e-table/e-tree-sorted.h>
+#include <gal/e-table/e-tree-table-adapter.h>
#define ETSM_CLASS(e) ((ETreeSelectionModelClass *)((GtkObject *)e)->klass)
@@ -29,14 +32,40 @@ enum {
ARG_ETS,
};
-struct ETreeSelectionModelNode {
+typedef struct ETreeSelectionModelNode {
guint selected : 1;
guint all_children_selected : 1;
guint any_children_selected : 1;
EBitArray *all_children_selected_array;
EBitArray *any_children_selected_array;
- ETreeSelectionModelNode **children;
+ struct ETreeSelectionModelNode **children;
int num_children;
+} ETreeSelectionModelNode;
+
+struct ETreeSelectionModelPriv {
+ ETreeTableAdapter *etta;
+ ETreeSorted *ets;
+ ETreeModel *model;
+
+ ETreeSelectionModelNode *root;
+
+ ETreePath cursor_path;
+ gint cursor_col;
+ gint selection_start_row;
+
+ guint model_changed_id;
+ guint model_row_inserted_id, model_row_deleted_id;
+
+ guint frozen : 1;
+ guint selection_model_changed : 1;
+ guint group_info_changed : 1;
+
+ int tree_model_pre_change_id;
+ int tree_model_node_changed_id;
+ int tree_model_node_data_changed_id;
+ int tree_model_node_col_changed_id;
+ int tree_model_node_inserted_id;
+ int tree_model_node_removed_id;
};
/* ETreeSelectionModelNode helpers */
@@ -61,7 +90,7 @@ static void
e_tree_selection_model_node_fill_children(ETreeSelectionModel *etsm, ETreePath path, ETreeSelectionModelNode *selection_node)
{
int i;
- selection_node->num_children = e_tree_sorted_node_num_children(etsm->ets, path);
+ selection_node->num_children = e_tree_sorted_node_num_children(etsm->priv->ets, path);
selection_node->children = g_new(ETreeSelectionModelNode *, selection_node->num_children);
for (i = 0; i < selection_node->num_children; i++) {
selection_node->children[i] = NULL;
@@ -87,15 +116,16 @@ e_tree_selection_model_node_free(ETreeSelectionModelNode *node)
}
+/* Other helper functions */
static ETreePath
etsm_node_at_row(ETreeSelectionModel *etsm, int row)
{
ETreePath path;
- path = e_tree_table_adapter_node_at_row(etsm->etta, row);
+ path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row);
if (path)
- path = e_tree_sorted_view_to_model_path(etsm->ets, path);
+ path = e_tree_sorted_view_to_model_path(etsm->priv->ets, path);
return path;
}
@@ -103,10 +133,10 @@ etsm_node_at_row(ETreeSelectionModel *etsm, int row)
static int
etsm_row_of_node(ETreeSelectionModel *etsm, ETreePath path)
{
- path = e_tree_sorted_model_to_view_path(etsm->ets, path);
+ path = e_tree_sorted_model_to_view_path(etsm->priv->ets, path);
if (path)
- return e_tree_table_adapter_row_of_node(etsm->etta, path);
+ return e_tree_table_adapter_row_of_node(etsm->priv->etta, path);
else
return 0;
}
@@ -114,8 +144,8 @@ etsm_row_of_node(ETreeSelectionModel *etsm, ETreePath path)
static int
etsm_cursor_row_real (ETreeSelectionModel *etsm)
{
- if (etsm->cursor_path)
- return etsm_row_of_node(etsm, etsm->cursor_path);
+ if (etsm->priv->cursor_path)
+ return etsm_row_of_node(etsm, etsm->priv->cursor_path);
else
return -1;
}
@@ -123,13 +153,287 @@ etsm_cursor_row_real (ETreeSelectionModel *etsm)
static void
etsm_real_clear (ETreeSelectionModel *etsm)
{
- if (etsm->root) {
- e_tree_selection_model_node_free(etsm->root);
- etsm->root = NULL;
+ if (etsm->priv->root) {
+ e_tree_selection_model_node_free(etsm->priv->root);
+ etsm->priv->root = NULL;
+ }
+}
+
+static ETreeSelectionModelNode *
+etsm_find_node_unless_equals (ETreeSelectionModel *etsm,
+ ETreePath path,
+ gboolean grow)
+{
+ ETreeSelectionModelNode *selection_node;
+ ETreeSorted *ets = etsm->priv->ets;
+ ETreePath parent;
+
+ parent = e_tree_model_node_get_parent(E_TREE_MODEL(ets), path);
+
+ if (parent) {
+ selection_node = etsm_find_node_unless_equals(etsm, parent, grow);
+ if (selection_node) {
+ int position = e_tree_sorted_orig_position(ets, path);
+ if (selection_node->all_children_selected && grow)
+ return NULL;
+ if (!(selection_node->any_children_selected || grow))
+ return NULL;
+ if (selection_node->all_children_selected_array && e_bit_array_value_at(selection_node->all_children_selected_array, position) && grow)
+ return NULL;
+ if (selection_node->any_children_selected_array && ! (e_bit_array_value_at(selection_node->any_children_selected_array, position) || grow))
+ return NULL;
+ if (selection_node->children == NULL) {
+ e_tree_selection_model_node_fill_children(etsm, parent, selection_node);
+ }
+ if (!selection_node->children[position])
+ selection_node->children[position] = e_tree_selection_model_node_new();
+
+ return selection_node->children[position];
+ } else
+ return NULL;
+ } else {
+ if (!etsm->priv->root)
+ etsm->priv->root = e_tree_selection_model_node_new();
+ return etsm->priv->root;
+ }
+}
+
+#if 0
+static ETreeSelectionModelNode *
+find_or_create_node (ETreeSelectionModel *etsm,
+ ETreePath path)
+{
+ ETreeSelectionModelNode *selection_node;
+ ETreeSelectionModelNode **place = NULL;
+ ETreeSorted *ets = etsm->priv->ets;
+ ETreePath parent;
+
+ parent = e_tree_model_node_get_parent(E_TREE_MODEL(ets), path);
+
+ if (parent) {
+ selection_node = find_or_create_node(etsm, parent);
+ if (selection_node) {
+ int position = e_tree_sorted_orig_position(ets, path);
+ if (!selection_node->children) {
+ e_tree_selection_model_node_fill_children(etsm, parent, selection_node);
+ }
+ if (!selection_node->children[position])
+ slection_node->children[position] = e_tree_selection_model_node_new();
+
+ return selection_node->children[position];
+ } else
+ return NULL;
+ } else {
+ if (!etsm->priv->root)
+ etsm->priv->root = e_tree_selection_model_node_new();
+ return etsm->priv->root;
+ }
+}
+#endif
+
+static void
+update_parents (ETreeSelectionModel *etsm, ETreePath path)
+{
+ int i;
+ int depth;
+ ETreeSorted *ets = etsm->priv->ets;
+ int *orig_position_sequence;
+ ETreeSelectionModelNode **node_sequence;
+ ETreePath parents;
+
+ if (!etsm->priv->root)
+ return;
+
+ depth = e_tree_model_node_depth (E_TREE_MODEL(ets), path);
+
+ orig_position_sequence = g_new(int, depth + 1);
+ node_sequence = g_new(ETreeSelectionModelNode *, depth + 1);
+
+ parents = path;
+
+ for (i = depth; i > 0; i--) {
+ if (!parents) {
+ g_free(orig_position_sequence);
+ g_free(node_sequence);
+ return;
+ }
+ orig_position_sequence[i] = e_tree_sorted_orig_position(etsm->priv->ets, parents);
+ parents = e_tree_model_node_get_parent(E_TREE_MODEL(etsm->priv->ets), parents);
+ }
+
+ node_sequence[0] = etsm->priv->root;
+ for (i = 0; i < depth; i++) {
+ node_sequence[i + 1] = NULL;
+
+ if (node_sequence[i]->children)
+ node_sequence[i + 1] = node_sequence[i]->children[orig_position_sequence[i + 1]];
+
+ if (node_sequence[i + 1] == NULL) {
+ g_free(orig_position_sequence);
+ g_free(node_sequence);
+ return;
+ }
+ }
+
+ if (node_sequence[depth]->num_children == -1)
+ e_tree_selection_model_node_fill_children(etsm, path, node_sequence[depth]);
+
+ if (!node_sequence[depth]->all_children_selected_array)
+ node_sequence[depth]->all_children_selected_array = e_bit_array_new(node_sequence[depth]->num_children);
+ if (!node_sequence[depth]->any_children_selected_array)
+ node_sequence[depth]->any_children_selected_array = e_bit_array_new(node_sequence[depth]->num_children);
+
+ node_sequence[depth]->all_children_selected =
+ e_bit_array_cross_and(node_sequence[depth]->all_children_selected_array) &&
+ node_sequence[depth]->selected;
+
+ node_sequence[depth]->any_children_selected =
+ e_bit_array_cross_or(node_sequence[depth]->any_children_selected_array) ||
+ node_sequence[depth]->selected;
+
+ for (i = depth - 1; i >= 0; i--) {
+ gboolean all_children, any_children;
+
+ if (!node_sequence[i]->all_children_selected_array)
+ node_sequence[i]->all_children_selected_array = e_bit_array_new(node_sequence[i]->num_children);
+ if (!node_sequence[i]->any_children_selected_array)
+ node_sequence[i]->any_children_selected_array = e_bit_array_new(node_sequence[i]->num_children);
+
+ e_bit_array_change_one_row(node_sequence[i]->all_children_selected_array,
+ orig_position_sequence[i + 1], node_sequence[i + 1]->all_children_selected);
+ e_bit_array_change_one_row(node_sequence[i]->any_children_selected_array,
+ orig_position_sequence[i + 1], node_sequence[i + 1]->any_children_selected);
+
+ all_children = node_sequence[i]->all_children_selected;
+ any_children = node_sequence[i]->any_children_selected;
+
+ node_sequence[i]->all_children_selected =
+ e_bit_array_cross_and(node_sequence[i]->all_children_selected_array) &&
+ node_sequence[i]->selected;
+ node_sequence[i]->any_children_selected =
+ e_bit_array_cross_or(node_sequence[i]->any_children_selected_array) ||
+ node_sequence[i]->selected;
+
+ if (all_children == node_sequence[i]->all_children_selected &&
+ any_children == node_sequence[i]->any_children_selected)
+ break;
}
+
+ g_free(orig_position_sequence);
+ g_free(node_sequence);
+}
+
+
+/* Signal handlers */
+
+static void
+etsm_pre_change (ETreeModel *etm, ETreeSelectionModel *etsm)
+{
+}
+
+static void
+etsm_node_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm)
+{
+ etsm_real_clear (etsm);
+}
+
+static void
+etsm_node_data_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm)
+{
}
static void
+etsm_node_col_changed (ETreeModel *etm, ETreePath node, int col, ETreeSelectionModel *etsm)
+{
+}
+
+static void
+etsm_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETreeSelectionModel *etsm)
+{
+ etsm_node_changed(etm, parent, etsm);
+#if 0
+ ETreeSelectionModelNode *node;
+ ETreePath path;
+
+ path = e_tree_sorted_model_to_view_path(etsm->priv->ets, parent);
+
+ if (!path)
+ return;
+
+ node = etsm_find_node_unless_equals (etsm, path, FALSE);
+
+ if (node) {
+ node->selected = FALSE;
+ update_parents(etsm, path);
+ }
+#endif
+}
+
+static void
+etsm_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, int old_position, ETreeSelectionModel *etsm)
+{
+ etsm_node_changed(etm, parent, etsm);
+}
+
+
+static void
+add_model(ETreeSelectionModel *etsm, ETreeModel *model)
+{
+ ETreeSelectionModelPriv *priv = etsm->priv;
+ priv->model = model;
+
+ if (!priv->model)
+ return;
+
+ gtk_object_ref(GTK_OBJECT(priv->model));
+ priv->tree_model_pre_change_id = gtk_signal_connect (GTK_OBJECT (priv->model), "pre_change",
+ GTK_SIGNAL_FUNC (etsm_pre_change), etsm);
+ priv->tree_model_node_changed_id = gtk_signal_connect (GTK_OBJECT (priv->model), "node_changed",
+ GTK_SIGNAL_FUNC (etsm_node_changed), etsm);
+ priv->tree_model_node_data_changed_id = gtk_signal_connect (GTK_OBJECT (priv->model), "node_data_changed",
+ GTK_SIGNAL_FUNC (etsm_node_data_changed), etsm);
+ priv->tree_model_node_col_changed_id = gtk_signal_connect (GTK_OBJECT (priv->model), "node_col_changed",
+ GTK_SIGNAL_FUNC (etsm_node_col_changed), etsm);
+ priv->tree_model_node_inserted_id = gtk_signal_connect (GTK_OBJECT (priv->model), "node_inserted",
+ GTK_SIGNAL_FUNC (etsm_node_inserted), etsm);
+ priv->tree_model_node_removed_id = gtk_signal_connect (GTK_OBJECT (priv->model), "node_removed",
+ GTK_SIGNAL_FUNC (etsm_node_removed), etsm);
+}
+
+static void
+drop_model(ETreeSelectionModel *etsm)
+{
+ ETreeSelectionModelPriv *priv = etsm->priv;
+
+ if (!priv->model)
+ return;
+
+ gtk_signal_disconnect (GTK_OBJECT (priv->model),
+ priv->tree_model_pre_change_id);
+ gtk_signal_disconnect (GTK_OBJECT (priv->model),
+ priv->tree_model_node_changed_id);
+ gtk_signal_disconnect (GTK_OBJECT (priv->model),
+ priv->tree_model_node_data_changed_id);
+ gtk_signal_disconnect (GTK_OBJECT (priv->model),
+ priv->tree_model_node_col_changed_id);
+ gtk_signal_disconnect (GTK_OBJECT (priv->model),
+ priv->tree_model_node_inserted_id);
+ gtk_signal_disconnect (GTK_OBJECT (priv->model),
+ priv->tree_model_node_removed_id);
+
+ gtk_object_unref (GTK_OBJECT (priv->model));
+ priv->model = NULL;
+
+ priv->tree_model_pre_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;
+ priv->tree_model_node_inserted_id = 0;
+ priv->tree_model_node_removed_id = 0;
+}
+
+/* Virtual functions */
+static void
etsm_destroy (GtkObject *object)
{
ETreeSelectionModel *etsm;
@@ -137,6 +441,8 @@ etsm_destroy (GtkObject *object)
etsm = E_TREE_SELECTION_MODEL (object);
etsm_real_clear (etsm);
+ drop_model(etsm);
+ g_free(etsm->priv);
}
static void
@@ -150,19 +456,19 @@ etsm_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
break;
case ARG_CURSOR_COL:
- GTK_VALUE_INT(*arg) = etsm->cursor_col;
+ GTK_VALUE_INT(*arg) = etsm->priv->cursor_col;
break;
case ARG_MODEL:
- GTK_VALUE_OBJECT(*arg) = (GtkObject *) etsm->model;
+ GTK_VALUE_OBJECT(*arg) = (GtkObject *) etsm->priv->model;
break;
case ARG_ETTA:
- GTK_VALUE_OBJECT(*arg) = (GtkObject *) etsm->etta;
+ GTK_VALUE_OBJECT(*arg) = (GtkObject *) etsm->priv->etta;
break;
case ARG_ETS:
- GTK_VALUE_OBJECT(*arg) = (GtkObject *) etsm->ets;
+ GTK_VALUE_OBJECT(*arg) = (GtkObject *) etsm->priv->ets;
break;
}
}
@@ -175,7 +481,7 @@ etsm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
switch (arg_id){
case ARG_CURSOR_ROW:
- e_selection_model_do_something(esm, GTK_VALUE_INT(*arg), etsm->cursor_col, 0);
+ e_selection_model_do_something(esm, GTK_VALUE_INT(*arg), etsm->priv->cursor_col, 0);
break;
case ARG_CURSOR_COL:
@@ -183,15 +489,16 @@ etsm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
break;
case ARG_MODEL:
- etsm->model = (ETreeModel *) GTK_VALUE_OBJECT(*arg);
+ drop_model(etsm);
+ add_model(etsm, (ETreeModel *) GTK_VALUE_OBJECT(*arg));
break;
case ARG_ETTA:
- etsm->etta = (ETreeTableAdapter *) GTK_VALUE_OBJECT(*arg);
+ etsm->priv->etta = (ETreeTableAdapter *) GTK_VALUE_OBJECT(*arg);
break;
case ARG_ETS:
- etsm->ets = (ETreeSorted *) GTK_VALUE_OBJECT(*arg);
+ etsm->priv->ets = (ETreeSorted *) GTK_VALUE_OBJECT(*arg);
break;
}
}
@@ -203,7 +510,7 @@ etsm_recurse_is_path_selected (ESelectionModel *selection,
{
ETreeSelectionModelNode *selection_node;
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- ETreeSorted *ets = etsm->ets;
+ ETreeSorted *ets = etsm->priv->ets;
ETreePath parent;
parent = e_tree_model_node_get_parent(E_TREE_MODEL(ets), path);
@@ -240,8 +547,8 @@ etsm_recurse_is_path_selected (ESelectionModel *selection,
} else
return NULL;
} else {
- if (etsm->root) {
- return etsm->root;
+ if (etsm->priv->root) {
+ return etsm->priv->root;
} else {
*is_selected = FALSE;
return NULL;
@@ -268,7 +575,7 @@ etsm_is_row_selected (ESelectionModel *selection,
gboolean ret_val;
- path = e_tree_table_adapter_node_at_row(etsm->etta, row);
+ path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row);
selection_node = etsm_recurse_is_path_selected (selection, path, &ret_val);
@@ -330,8 +637,8 @@ etsm_clear(ESelectionModel *selection)
etsm_real_clear (etsm);
- etsm->cursor_path = NULL;
- etsm->cursor_col = -1;
+ etsm->priv->cursor_path = NULL;
+ etsm->priv->cursor_col = -1;
e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), -1, -1);
}
@@ -350,7 +657,7 @@ etsm_selected_count (ESelectionModel *selection)
{
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- return g_hash_table_size(etsm->data);
+ return g_hash_table_size(etsm->priv->data);
}
#endif
@@ -368,24 +675,24 @@ etsm_select_all (ESelectionModel *selection)
etsm_real_clear (etsm);
- etsm->root = e_tree_selection_model_node_new();
- etsm->root->selected = TRUE;
- etsm->root->all_children_selected = TRUE;
- etsm->root->any_children_selected = TRUE;
-
- e_tree_selection_model_node_fill_children(etsm, e_tree_model_get_root(E_TREE_MODEL(etsm->ets)), etsm->root);
- etsm->root->all_children_selected_array = e_bit_array_new(etsm->root->num_children);
- etsm->root->any_children_selected_array = e_bit_array_new(etsm->root->num_children);
- e_bit_array_select_all(etsm->root->all_children_selected_array);
- e_bit_array_select_all(etsm->root->any_children_selected_array);
-
- if (etsm->cursor_col == -1)
- etsm->cursor_col = 0;
- if (etsm->cursor_path == NULL)
- etsm->cursor_path = etsm_node_at_row(etsm, 0);
- etsm->selection_start_row = 0;
+ etsm->priv->root = e_tree_selection_model_node_new();
+ etsm->priv->root->selected = TRUE;
+ etsm->priv->root->all_children_selected = TRUE;
+ etsm->priv->root->any_children_selected = TRUE;
+
+ e_tree_selection_model_node_fill_children(etsm, e_tree_model_get_root(E_TREE_MODEL(etsm->priv->ets)), etsm->priv->root);
+ etsm->priv->root->all_children_selected_array = e_bit_array_new(etsm->priv->root->num_children);
+ etsm->priv->root->any_children_selected_array = e_bit_array_new(etsm->priv->root->num_children);
+ e_bit_array_select_all(etsm->priv->root->all_children_selected_array);
+ e_bit_array_select_all(etsm->priv->root->any_children_selected_array);
+
+ if (etsm->priv->cursor_col == -1)
+ etsm->priv->cursor_col = 0;
+ if (etsm->priv->cursor_path == NULL)
+ etsm->priv->cursor_path = etsm_node_at_row(etsm, 0);
+ etsm->priv->selection_start_row = 0;
e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), etsm_cursor_row_real(etsm), etsm->cursor_col);
+ e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), etsm_cursor_row_real(etsm), etsm->priv->cursor_col);
}
static void
@@ -428,12 +735,12 @@ etsm_invert_selection (ESelectionModel *selection)
{
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- if (etsm->root)
- etsm_invert_selection_recurse (etsm, etsm->root);
+ if (etsm->priv->root)
+ etsm_invert_selection_recurse (etsm, etsm->priv->root);
- etsm->cursor_col = -1;
- etsm->cursor_path = NULL;
- etsm->selection_start_row = 0;
+ etsm->priv->cursor_col = -1;
+ etsm->priv->cursor_path = NULL;
+ etsm->priv->selection_start_row = 0;
e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), -1, -1);
}
@@ -442,171 +749,7 @@ static int
etsm_row_count (ESelectionModel *selection)
{
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- return e_table_model_row_count(E_TABLE_MODEL(etsm->etta));
-}
-
-static ETreeSelectionModelNode *
-etsm_find_node_unless_equals (ETreeSelectionModel *etsm,
- ETreePath path,
- gboolean grow)
-{
- ETreeSelectionModelNode *selection_node;
- ETreeSorted *ets = etsm->ets;
- ETreePath parent;
-
- parent = e_tree_model_node_get_parent(E_TREE_MODEL(ets), path);
-
- if (parent) {
- selection_node = etsm_find_node_unless_equals(etsm, parent, grow);
- if (selection_node) {
- int position = e_tree_sorted_orig_position(ets, path);
- if (selection_node->all_children_selected && grow)
- return NULL;
- if (!(selection_node->any_children_selected || grow))
- return NULL;
- if (selection_node->all_children_selected_array && e_bit_array_value_at(selection_node->all_children_selected_array, position) && grow)
- return NULL;
- if (selection_node->any_children_selected_array && ! (e_bit_array_value_at(selection_node->any_children_selected_array, position) || grow))
- return NULL;
- if (selection_node->children == NULL) {
- e_tree_selection_model_node_fill_children(etsm, parent, selection_node);
- }
- if (!selection_node->children[position])
- selection_node->children[position] = e_tree_selection_model_node_new();
-
- return selection_node->children[position];
- } else
- return NULL;
- } else {
- if (!etsm->root)
- etsm->root = e_tree_selection_model_node_new();
- return etsm->root;
- }
-}
-
-#if 0
-static ETreeSelectionModelNode *
-find_or_create_node (ETreeSelectionModel *etsm,
- ETreePath path)
-{
- ETreeSelectionModelNode *selection_node;
- ETreeSelectionModelNode **place = NULL;
- ETreeSorted *ets = etsm->ets;
- ETreePath parent;
-
- parent = e_tree_model_node_get_parent(E_TREE_MODEL(ets), path);
-
- if (parent) {
- selection_node = find_or_create_node(etsm, parent);
- if (selection_node) {
- int position = e_tree_sorted_orig_position(ets, path);
- if (!selection_node->children) {
- e_tree_selection_model_node_fill_children(etsm, parent, selection_node);
- }
- if (!selection_node->children[position])
- slection_node->children[position] = e_tree_selection_model_node_new();
-
- return selection_node->children[position];
- } else
- return NULL;
- } else {
- if (!etsm->root)
- etsm->root = e_tree_selection_model_node_new();
- return etsm->root;
- }
-}
-#endif
-
-static void
-update_parents (ETreeSelectionModel *etsm, ETreePath path)
-{
- int i;
- int depth;
- ETreeSorted *ets = etsm->ets;
- int *orig_position_sequence;
- ETreeSelectionModelNode **node_sequence;
- ETreePath parents;
-
- if (!etsm->root)
- return;
-
- depth = e_tree_model_node_depth (E_TREE_MODEL(ets), path);
-
- orig_position_sequence = g_new(int, depth + 1);
- node_sequence = g_new(ETreeSelectionModelNode *, depth + 1);
-
- parents = path;
-
- for (i = depth; i > 0; i--) {
- if (!parents) {
- g_free(orig_position_sequence);
- g_free(node_sequence);
- return;
- }
- orig_position_sequence[i] = e_tree_sorted_orig_position(etsm->ets, parents);
- parents = e_tree_model_node_get_parent(E_TREE_MODEL(etsm->ets), parents);
- }
-
- node_sequence[0] = etsm->root;
- for (i = 0; i < depth; i++) {
- node_sequence[i + 1] = NULL;
-
- if (node_sequence[i]->children)
- node_sequence[i + 1] = node_sequence[i]->children[orig_position_sequence[i + 1]];
-
- if (node_sequence[i + 1] == NULL) {
- g_free(orig_position_sequence);
- g_free(node_sequence);
- return;
- }
- }
-
- if (node_sequence[depth]->num_children == -1)
- e_tree_selection_model_node_fill_children(etsm, path, node_sequence[depth]);
-
- if (!node_sequence[depth]->all_children_selected_array)
- node_sequence[depth]->all_children_selected_array = e_bit_array_new(node_sequence[depth]->num_children);
- if (!node_sequence[depth]->any_children_selected_array)
- node_sequence[depth]->any_children_selected_array = e_bit_array_new(node_sequence[depth]->num_children);
-
- node_sequence[depth]->all_children_selected =
- e_bit_array_cross_and(node_sequence[depth]->all_children_selected_array) &&
- node_sequence[depth]->selected;
-
- node_sequence[depth]->any_children_selected =
- e_bit_array_cross_or(node_sequence[depth]->any_children_selected_array) ||
- node_sequence[depth]->selected;
-
- for (i = depth - 1; i >= 0; i--) {
- gboolean all_children, any_children;
-
- if (!node_sequence[i]->all_children_selected_array)
- node_sequence[i]->all_children_selected_array = e_bit_array_new(node_sequence[i]->num_children);
- if (!node_sequence[i]->any_children_selected_array)
- node_sequence[i]->any_children_selected_array = e_bit_array_new(node_sequence[i]->num_children);
-
- e_bit_array_change_one_row(node_sequence[i]->all_children_selected_array,
- orig_position_sequence[i + 1], node_sequence[i + 1]->all_children_selected);
- e_bit_array_change_one_row(node_sequence[i]->any_children_selected_array,
- orig_position_sequence[i + 1], node_sequence[i + 1]->any_children_selected);
-
- all_children = node_sequence[i]->all_children_selected;
- any_children = node_sequence[i]->any_children_selected;
-
- node_sequence[i]->all_children_selected =
- e_bit_array_cross_and(node_sequence[i]->all_children_selected_array) &&
- node_sequence[i]->selected;
- node_sequence[i]->any_children_selected =
- e_bit_array_cross_or(node_sequence[i]->any_children_selected_array) ||
- node_sequence[i]->selected;
-
- if (all_children == node_sequence[i]->all_children_selected &&
- any_children == node_sequence[i]->any_children_selected)
- break;
- }
-
- g_free(orig_position_sequence);
- g_free(node_sequence);
+ return e_table_model_row_count(E_TABLE_MODEL(etsm->priv->etta));
}
static void
@@ -614,7 +757,7 @@ etsm_change_one_row(ESelectionModel *selection, int row, gboolean grow)
{
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
ETreeSelectionModelNode *node;
- ETreePath path = e_tree_table_adapter_node_at_row(etsm->etta, row);
+ ETreePath path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row);
if (!path)
return;
@@ -638,11 +781,11 @@ etsm_change_cursor (ESelectionModel *selection, int row, int col)
etsm = E_TREE_SELECTION_MODEL(selection);
if (row == -1) {
- etsm->cursor_path = NULL;
+ etsm->priv->cursor_path = NULL;
} else {
- etsm->cursor_path = etsm_node_at_row(etsm, row);
+ etsm->priv->cursor_path = etsm_node_at_row(etsm, row);
}
- etsm->cursor_col = col;
+ etsm->priv->cursor_col = col;
}
static void
@@ -672,7 +815,7 @@ static int
etsm_cursor_col (ESelectionModel *selection)
{
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- return etsm->cursor_col;
+ return etsm->priv->cursor_col;
}
static void
@@ -682,7 +825,7 @@ etsm_select_single_row (ESelectionModel *selection, int row)
etsm_real_clear (etsm);
etsm_change_one_row(selection, row, TRUE);
- etsm->selection_start_row = row;
+ etsm->priv->selection_start_row = row;
e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
}
@@ -692,7 +835,7 @@ etsm_toggle_single_row (ESelectionModel *selection, int row)
{
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- etsm->selection_start_row = row;
+ etsm->priv->selection_start_row = row;
etsm_change_one_row(selection, row, !etsm_is_row_selected(selection, row));
@@ -708,19 +851,19 @@ etsm_move_selection_end (ESelectionModel *selection, int row)
int new_start;
int new_end;
if (selection->sorter && e_sorter_needs_sorting(selection->sorter)) {
- old_start = MIN (e_sorter_model_to_sorted(selection->sorter, etsm->selection_start_row),
+ old_start = MIN (e_sorter_model_to_sorted(selection->sorter, etsm->priv->selection_start_row),
e_sorter_model_to_sorted(selection->sorter, etsm_cursor_row_real(etsm)));
- old_end = MAX (e_sorter_model_to_sorted(selection->sorter, etsm->selection_start_row),
+ old_end = MAX (e_sorter_model_to_sorted(selection->sorter, etsm->priv->selection_start_row),
e_sorter_model_to_sorted(selection->sorter, etsm_cursor_row_real(etsm))) + 1;
- new_start = MIN (e_sorter_model_to_sorted(selection->sorter, etsm->selection_start_row),
+ new_start = MIN (e_sorter_model_to_sorted(selection->sorter, etsm->priv->selection_start_row),
e_sorter_model_to_sorted(selection->sorter, row));
- new_end = MAX (e_sorter_model_to_sorted(selection->sorter, etsm->selection_start_row),
+ new_end = MAX (e_sorter_model_to_sorted(selection->sorter, etsm->priv->selection_start_row),
e_sorter_model_to_sorted(selection->sorter, row)) + 1;
} else {
- old_start = MIN (etsm->selection_start_row, etsm_cursor_row_real(etsm));
- old_end = MAX (etsm->selection_start_row, etsm_cursor_row_real(etsm)) + 1;
- new_start = MIN (etsm->selection_start_row, row);
- new_end = MAX (etsm->selection_start_row, row) + 1;
+ old_start = MIN (etsm->priv->selection_start_row, etsm_cursor_row_real(etsm));
+ old_end = MAX (etsm->priv->selection_start_row, etsm_cursor_row_real(etsm)) + 1;
+ new_start = MIN (etsm->priv->selection_start_row, row);
+ new_end = MAX (etsm->priv->selection_start_row, row) + 1;
}
/* This wouldn't work nearly so smoothly if one end of the selection weren't held in place. */
if (old_start < new_start)
@@ -738,14 +881,16 @@ static void
etsm_set_selection_end (ESelectionModel *selection, int row)
{
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- etsm_select_single_row(selection, etsm->selection_start_row);
- if (etsm->selection_start_row != -1)
- etsm->cursor_path = etsm_node_at_row(etsm, etsm->selection_start_row);
+ etsm_select_single_row(selection, etsm->priv->selection_start_row);
+ if (etsm->priv->selection_start_row != -1)
+ etsm->priv->cursor_path = etsm_node_at_row(etsm, etsm->priv->selection_start_row);
else
- etsm->cursor_path = NULL;
+ etsm->priv->cursor_path = NULL;
e_selection_model_move_selection_end(selection, row);
}
+
+/* Standard functions */
static void
etsm_foreach_all_recurse (ETreeSelectionModel *etsm,
ETreePath path,
@@ -755,11 +900,11 @@ etsm_foreach_all_recurse (ETreeSelectionModel *etsm,
ETreePath model_path;
ETreePath child;
- model_path = e_tree_sorted_view_to_model_path(etsm->ets, path);
+ model_path = e_tree_sorted_view_to_model_path(etsm->priv->ets, path);
callback(model_path, closure);
- child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->ets), path);
- for ( ; child; child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->ets), child))
+ child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->priv->ets), path);
+ for ( ; child; child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->priv->ets), child))
if (child)
etsm_foreach_all_recurse (etsm, child, callback, closure);
}
@@ -780,14 +925,14 @@ etsm_foreach_recurse (ETreeSelectionModel *etsm,
return;
if (selection_node->selected) {
- ETreePath model_path = e_tree_sorted_view_to_model_path(etsm->ets, path);
+ ETreePath model_path = e_tree_sorted_view_to_model_path(etsm->priv->ets, path);
callback(model_path, closure);
}
if (selection_node->children) {
- ETreePath child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->ets), path);
+ ETreePath child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->priv->ets), path);
int i;
- for (i = 0; i < selection_node->num_children; i++, child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->ets), child))
+ for (i = 0; i < selection_node->num_children; i++, child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->priv->ets), child))
if (selection_node->children[i])
etsm_foreach_recurse (etsm, selection_node->children[i], child, callback, closure);
}
@@ -798,8 +943,8 @@ e_tree_selection_model_foreach (ETreeSelectionModel *etsm,
ETreeForeachFunc callback,
gpointer closure)
{
- if (etsm->root) {
- etsm_foreach_recurse(etsm, etsm->root, e_tree_model_get_root(E_TREE_MODEL(etsm->ets)), callback, closure);
+ if (etsm->priv->root) {
+ etsm_foreach_recurse(etsm, etsm->priv->root, e_tree_model_get_root(E_TREE_MODEL(etsm->priv->ets)), callback, closure);
}
}
@@ -807,9 +952,21 @@ e_tree_selection_model_foreach (ETreeSelectionModel *etsm,
static void
e_tree_selection_model_init (ETreeSelectionModel *etsm)
{
- etsm->root = NULL;
- etsm->cursor_path = NULL;
- etsm->cursor_col = -1;
+ ETreeSelectionModelPriv *priv;
+ priv = g_new(ETreeSelectionModelPriv, 1);
+ etsm->priv = priv;
+
+ priv->root = NULL;
+ priv->cursor_path = NULL;
+ priv->cursor_col = -1;
+
+ priv->tree_model_pre_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;
+ priv->tree_model_node_inserted_id = 0;
+ priv->tree_model_node_removed_id = 0;
+
}
static void
diff --git a/widgets/table/e-tree-selection-model.h b/widgets/table/e-tree-selection-model.h
index 5a591053a0..10fb35a211 100644
--- a/widgets/table/e-tree-selection-model.h
+++ b/widgets/table/e-tree-selection-model.h
@@ -3,12 +3,8 @@
#define _E_TREE_SELECTION_MODEL_H_
#include <gtk/gtkobject.h>
-#include <gal/util/e-sorter.h>
-#include <gdk/gdktypes.h>
#include <gal/widgets/e-selection-model.h>
#include <gal/e-table/e-tree-model.h>
-#include <gal/e-table/e-tree-sorted.h>
-#include <gal/e-table/e-tree-table-adapter.h>
#ifdef __cplusplus
extern "C" {
@@ -17,7 +13,7 @@ extern "C" {
typedef void (*ETreeForeachFunc) (ETreePath path,
gpointer closure);
-typedef struct ETreeSelectionModelNode ETreeSelectionModelNode;
+typedef struct ETreeSelectionModelPriv ETreeSelectionModelPriv;
#define E_TREE_SELECTION_MODEL_TYPE (e_tree_selection_model_get_type ())
#define E_TREE_SELECTION_MODEL(o) (GTK_CHECK_CAST ((o), E_TREE_SELECTION_MODEL_TYPE, ETreeSelectionModel))
@@ -28,22 +24,7 @@ typedef struct ETreeSelectionModelNode ETreeSelectionModelNode;
typedef struct {
ESelectionModel base;
- ETreeTableAdapter *etta;
- ETreeSorted *ets;
- ETreeModel *model;
-
- ETreeSelectionModelNode *root;
-
- ETreePath cursor_path;
- gint cursor_col;
- gint selection_start_row;
-
- guint model_changed_id;
- guint model_row_inserted_id, model_row_deleted_id;
-
- guint frozen : 1;
- guint selection_model_changed : 1;
- guint group_info_changed : 1;
+ ETreeSelectionModelPriv *priv;
} ETreeSelectionModel;
typedef struct {
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index c7a9398627..ea2e4634c8 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -9,28 +9,28 @@
* Copyright 1999, 2000, 2001, Ximian, Inc
*/
#include <config.h>
+#include "e-tree.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include "gal/util/e-i18n.h"
-#include <libgnomeui/gnome-canvas.h>
#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "gal/widgets/e-canvas.h"
-#include "e-tree.h"
-#include "e-table-header-item.h"
-#include "e-table-header-utils.h"
-#include "e-table-subset.h"
-#include "e-table-item.h"
-#include "e-table-group.h"
-#include "e-table-group-leaf.h"
-#include "e-table-specification.h"
-#include "e-table-state.h"
-#include "e-table-column-specification.h"
-
-#include "e-table-utils.h"
+#include <gal/util/e-util.h>
+#include <gal/widgets/e-canvas.h>
+
+#include <gal/e-table/e-table-column-specification.h>
+#include <gal/e-table/e-table-header-item.h>
+#include <gal/e-table/e-table-header.h>
+#include <gal/e-table/e-table-item.h>
+#include <gal/e-table/e-table-sort-info.h>
+#include <gal/e-table/e-table-utils.h>
+
+#include <gal/e-table/e-tree-selection-model.h>
+#include <gal/e-table/e-tree-sorted.h>
+#include <gal/e-table/e-tree-table-adapter.h>
#define COLUMN_HEADER_HEIGHT 16
@@ -65,6 +65,55 @@ enum {
ARG_LENGTH_THRESHOLD,
};
+struct ETreePriv {
+ ETreeModel *model;
+ ETreeSorted *sorted;
+ ETreeTableAdapter *etta;
+
+ ETableHeader *full_header, *header;
+
+ ETableSortInfo *sort_info;
+ ESorter *sorter;
+
+ ESelectionModel *selection;
+ ETableSpecification *spec;
+
+ int reflow_idle_id;
+
+ GnomeCanvas *header_canvas, *table_canvas;
+
+ GnomeCanvasItem *header_item, *root;
+
+ GnomeCanvasItem *white_item;
+ GnomeCanvasItem *item;
+
+ gint length_threshold;
+
+ /*
+ * Configuration settings
+ */
+ guint horizontal_draw_grid : 1;
+ guint vertical_draw_grid : 1;
+ guint draw_focus : 1;
+ guint row_selection_active : 1;
+
+ guint horizontal_scrolling : 1;
+
+ ECursorMode cursor_mode;
+
+ int drop_row;
+ ETreePath drop_path;
+ int drop_col;
+
+ int drag_row;
+ ETreePath drag_path;
+ int drag_col;
+ ETreeDragSourceSite *site;
+
+ int drag_source_button_press_event_id;
+ int drag_source_motion_notify_event_id;
+};
+
static gint et_signals [LAST_SIGNAL] = { 0, };
static void et_grab_focus (GtkWidget *widget);
@@ -120,23 +169,25 @@ et_destroy (GtkObject *object)
{
ETree *et = E_TREE (object);
- if (et->reflow_idle_id)
- g_source_remove(et->reflow_idle_id);
- et->reflow_idle_id = 0;
+ if (et->priv->reflow_idle_id)
+ g_source_remove(et->priv->reflow_idle_id);
+ et->priv->reflow_idle_id = 0;
- gtk_object_unref (GTK_OBJECT (et->model));
- gtk_object_unref (GTK_OBJECT (et->sorted));
- gtk_object_unref (GTK_OBJECT (et->full_header));
- gtk_object_unref (GTK_OBJECT (et->header));
- gtk_object_unref (GTK_OBJECT (et->sort_info));
- gtk_object_unref (GTK_OBJECT (et->selection));
- if (et->spec)
- gtk_object_unref (GTK_OBJECT (et->spec));
+ gtk_object_unref (GTK_OBJECT (et->priv->model));
+ gtk_object_unref (GTK_OBJECT (et->priv->sorted));
+ gtk_object_unref (GTK_OBJECT (et->priv->full_header));
+ gtk_object_unref (GTK_OBJECT (et->priv->header));
+ gtk_object_unref (GTK_OBJECT (et->priv->sort_info));
+ gtk_object_unref (GTK_OBJECT (et->priv->selection));
+ if (et->priv->spec)
+ gtk_object_unref (GTK_OBJECT (et->priv->spec));
- if (et->header_canvas != NULL)
- gtk_widget_destroy (GTK_WIDGET (et->header_canvas));
+ if (et->priv->header_canvas != NULL)
+ gtk_widget_destroy (GTK_WIDGET (et->priv->header_canvas));
- gtk_widget_destroy (GTK_WIDGET (et->table_canvas));
+ gtk_widget_destroy (GTK_WIDGET (et->priv->table_canvas));
+
+ g_free(et->priv);
(*parent_class->destroy)(object);
}
@@ -151,31 +202,33 @@ e_tree_init (GtkObject *object)
gtk_table->homogeneous = FALSE;
- e_tree->sort_info = NULL;
- e_tree->reflow_idle_id = 0;
+ e_tree->priv = g_new(ETreePriv, 1);
+
+ e_tree->priv->sort_info = NULL;
+ e_tree->priv->reflow_idle_id = 0;
- e_tree->horizontal_draw_grid = 1;
- e_tree->vertical_draw_grid = 1;
- e_tree->draw_focus = 1;
- e_tree->cursor_mode = E_CURSOR_SIMPLE;
- e_tree->length_threshold = 200;
+ e_tree->priv->horizontal_draw_grid = 1;
+ e_tree->priv->vertical_draw_grid = 1;
+ e_tree->priv->draw_focus = 1;
+ e_tree->priv->cursor_mode = E_CURSOR_SIMPLE;
+ e_tree->priv->length_threshold = 200;
- e_tree->horizontal_scrolling = FALSE;
+ e_tree->priv->horizontal_scrolling = FALSE;
- e_tree->drop_row = -1;
- e_tree->drop_path = NULL;
- e_tree->drop_col = -1;
+ e_tree->priv->drop_row = -1;
+ e_tree->priv->drop_path = NULL;
+ e_tree->priv->drop_col = -1;
- e_tree->drag_row = -1;
- e_tree->drag_path = NULL;
- e_tree->drag_col = -1;
+ e_tree->priv->drag_row = -1;
+ e_tree->priv->drag_path = NULL;
+ e_tree->priv->drag_col = -1;
- e_tree->site = NULL;
- e_tree->drag_source_button_press_event_id = 0;
- e_tree->drag_source_motion_notify_event_id = 0;
+ e_tree->priv->site = NULL;
+ e_tree->priv->drag_source_button_press_event_id = 0;
+ e_tree->priv->drag_source_motion_notify_event_id = 0;
- e_tree->selection = E_SELECTION_MODEL(e_table_selection_model_new());
- e_tree->spec = NULL;
+ e_tree->priv->selection = E_SELECTION_MODEL(e_tree_selection_model_new());
+ e_tree->priv->spec = NULL;
}
/* Grab_focus handler for the ETree */
@@ -186,7 +239,7 @@ et_grab_focus (GtkWidget *widget)
e_tree = E_TREE (widget);
- gtk_widget_grab_focus (GTK_WIDGET (e_tree->table_canvas));
+ gtk_widget_grab_focus (GTK_WIDGET (e_tree->priv->table_canvas));
}
/* Focus handler for the ETree */
@@ -202,7 +255,7 @@ et_focus (GtkContainer *container, GtkDirectionType direction)
return FALSE;
}
- return gtk_container_focus (GTK_CONTAINER (e_tree->table_canvas), direction);
+ return gtk_container_focus (GTK_CONTAINER (e_tree->priv->table_canvas), direction);
}
static void
@@ -210,20 +263,20 @@ set_header_canvas_width (ETree *e_tree)
{
double oldwidth, oldheight, width;
- if (!(e_tree->header_item && e_tree->header_canvas && e_tree->table_canvas))
+ if (!(e_tree->priv->header_item && e_tree->priv->header_canvas && e_tree->priv->table_canvas))
return;
- gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->table_canvas),
+ gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->priv->table_canvas),
NULL, NULL, &width, NULL);
- gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->header_canvas),
+ gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->priv->header_canvas),
NULL, NULL, &oldwidth, &oldheight);
if (oldwidth != width ||
- oldheight != E_TABLE_HEADER_ITEM (e_tree->header_item)->height - 1)
+ oldheight != E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height - 1)
gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_tree->header_canvas),
+ GNOME_CANVAS (e_tree->priv->header_canvas),
0, 0, width, /* COLUMN_HEADER_HEIGHT - 1 */
- E_TABLE_HEADER_ITEM (e_tree->header_item)->height - 1);
+ E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height - 1);
}
@@ -236,29 +289,29 @@ header_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETree *e_t
as the font is only created when everything is realized.
So we set the usize here as well, so that the size of the
header is correct */
- if (GTK_WIDGET (e_tree->header_canvas)->allocation.height !=
- E_TABLE_HEADER_ITEM (e_tree->header_item)->height)
- gtk_widget_set_usize (GTK_WIDGET (e_tree->header_canvas), -1,
- E_TABLE_HEADER_ITEM (e_tree->header_item)->height);
+ if (GTK_WIDGET (e_tree->priv->header_canvas)->allocation.height !=
+ E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height)
+ gtk_widget_set_usize (GTK_WIDGET (e_tree->priv->header_canvas), -1,
+ E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height);
}
static void
e_tree_setup_header (ETree *e_tree)
{
char *pointer;
- e_tree->header_canvas = GNOME_CANVAS (e_canvas_new ());
- GTK_WIDGET_UNSET_FLAGS (e_tree->header_canvas, GTK_CAN_FOCUS);
+ e_tree->priv->header_canvas = GNOME_CANVAS (e_canvas_new ());
+ GTK_WIDGET_UNSET_FLAGS (e_tree->priv->header_canvas, GTK_CAN_FOCUS);
- gtk_widget_show (GTK_WIDGET (e_tree->header_canvas));
+ gtk_widget_show (GTK_WIDGET (e_tree->priv->header_canvas));
pointer = g_strdup_printf("%p", e_tree);
- e_tree->header_item = gnome_canvas_item_new (
- gnome_canvas_root (e_tree->header_canvas),
+ e_tree->priv->header_item = gnome_canvas_item_new (
+ gnome_canvas_root (e_tree->priv->header_canvas),
e_table_header_item_get_type (),
- "ETableHeader", e_tree->header,
- "full_header", e_tree->full_header,
- "sort_info", e_tree->sort_info,
+ "ETableHeader", e_tree->priv->header,
+ "full_header", e_tree->priv->full_header,
+ "sort_info", e_tree->priv->sort_info,
"dnd_code", pointer,
/* "table", e_tree, FIXME*/
NULL);
@@ -266,11 +319,11 @@ e_tree_setup_header (ETree *e_tree)
g_free(pointer);
gtk_signal_connect (
- GTK_OBJECT (e_tree->header_canvas), "size_allocate",
+ GTK_OBJECT (e_tree->priv->header_canvas), "size_allocate",
GTK_SIGNAL_FUNC (header_canvas_size_allocate), e_tree);
- gtk_widget_set_usize (GTK_WIDGET (e_tree->header_canvas), -1,
- E_TABLE_HEADER_ITEM (e_tree->header_item)->height);
+ gtk_widget_set_usize (GTK_WIDGET (e_tree->priv->header_canvas), -1,
+ E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height);
}
static gboolean
@@ -279,9 +332,9 @@ tree_canvas_reflow_idle (ETree *e_tree)
gdouble height, width;
gdouble item_height;
gdouble oldheight, oldwidth;
- GtkAllocation *alloc = &(GTK_WIDGET (e_tree->table_canvas)->allocation);
+ GtkAllocation *alloc = &(GTK_WIDGET (e_tree->priv->table_canvas)->allocation);
- gtk_object_get (GTK_OBJECT (e_tree->item),
+ gtk_object_get (GTK_OBJECT (e_tree->priv->item),
"height", &height,
"width", &width,
NULL);
@@ -289,21 +342,21 @@ tree_canvas_reflow_idle (ETree *e_tree)
height = MAX ((int)height, alloc->height);
width = MAX((int)width, alloc->width);
/* I have no idea why this needs to be -1, but it works. */
- gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->table_canvas),
+ gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->priv->table_canvas),
NULL, NULL, &oldwidth, &oldheight);
if (oldwidth != width - 1 ||
oldheight != height - 1) {
- gnome_canvas_set_scroll_region (GNOME_CANVAS (e_tree->table_canvas),
+ gnome_canvas_set_scroll_region (GNOME_CANVAS (e_tree->priv->table_canvas),
0, 0, width - 1, height - 1);
set_header_canvas_width (e_tree);
}
- gtk_object_set (GTK_OBJECT (e_tree->white_item),
+ gtk_object_set (GTK_OBJECT (e_tree->priv->white_item),
"y1", item_height,
"x2", width,
"y2", height,
NULL);
- e_tree->reflow_idle_id = 0;
+ e_tree->priv->reflow_idle_id = 0;
return FALSE;
}
@@ -316,35 +369,35 @@ tree_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
gdouble item_height;
width = alloc->width;
- gtk_object_get (GTK_OBJECT (e_tree->item),
+ gtk_object_get (GTK_OBJECT (e_tree->priv->item),
"height", &height,
NULL);
item_height = height;
height = MAX ((int)height, alloc->height);
- gtk_object_set (GTK_OBJECT (e_tree->item),
+ gtk_object_set (GTK_OBJECT (e_tree->priv->item),
"width", width,
NULL);
- gtk_object_set (GTK_OBJECT (e_tree->header),
+ gtk_object_set (GTK_OBJECT (e_tree->priv->header),
"width", width,
NULL);
- if (e_tree->reflow_idle_id)
- g_source_remove(e_tree->reflow_idle_id);
+ if (e_tree->priv->reflow_idle_id)
+ g_source_remove(e_tree->priv->reflow_idle_id);
tree_canvas_reflow_idle(e_tree);
}
static void
tree_canvas_reflow (GnomeCanvas *canvas, ETree *e_tree)
{
- if (!e_tree->reflow_idle_id)
- e_tree->reflow_idle_id = g_idle_add_full (400, (GSourceFunc) tree_canvas_reflow_idle, e_tree, NULL);
+ if (!e_tree->priv->reflow_idle_id)
+ e_tree->priv->reflow_idle_id = g_idle_add_full (400, (GSourceFunc) tree_canvas_reflow_idle, e_tree, NULL);
}
static void
item_cursor_change (ETableItem *eti, int row, ETree *et)
{
- ETreePath path = e_tree_table_adapter_node_at_row(et->etta, row);
- path = e_tree_sorted_view_to_model_path(et->sorted, path);
+ ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
+ path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
gtk_signal_emit (GTK_OBJECT (et),
et_signals [CURSOR_CHANGE],
row, path);
@@ -353,8 +406,8 @@ item_cursor_change (ETableItem *eti, int row, ETree *et)
static void
item_cursor_activated (ETableItem *eti, int row, ETree *et)
{
- ETreePath path = e_tree_table_adapter_node_at_row(et->etta, row);
- path = e_tree_sorted_view_to_model_path(et->sorted, path);
+ ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
+ path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
gtk_signal_emit (GTK_OBJECT (et),
et_signals [CURSOR_ACTIVATED],
row, path);
@@ -363,8 +416,8 @@ item_cursor_activated (ETableItem *eti, int row, ETree *et)
static void
item_double_click (ETableItem *eti, int row, int col, GdkEvent *event, ETree *et)
{
- ETreePath path = e_tree_table_adapter_node_at_row(et->etta, row);
- path = e_tree_sorted_view_to_model_path(et->sorted, path);
+ ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
+ path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
gtk_signal_emit (GTK_OBJECT (et),
et_signals [DOUBLE_CLICK],
row, path, col, event);
@@ -374,8 +427,8 @@ static gint
item_right_click (ETableItem *eti, int row, int col, GdkEvent *event, ETree *et)
{
int return_val = 0;
- ETreePath path = e_tree_table_adapter_node_at_row(et->etta, row);
- path = e_tree_sorted_view_to_model_path(et->sorted, path);
+ ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
+ path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
gtk_signal_emit (GTK_OBJECT (et),
et_signals [RIGHT_CLICK],
row, path, col, event, &return_val);
@@ -386,8 +439,8 @@ static gint
item_click (ETableItem *eti, int row, int col, GdkEvent *event, ETree *et)
{
int return_val = 0;
- ETreePath path = e_tree_table_adapter_node_at_row(et->etta, row);
- path = e_tree_sorted_view_to_model_path(et->sorted, path);
+ ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
+ path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
gtk_signal_emit (GTK_OBJECT (et),
et_signals [CLICK],
row, path, col, event, &return_val);
@@ -405,54 +458,54 @@ item_key_press (ETableItem *eti, int row, int col, GdkEvent *event, ETree *et)
switch (key->keyval) {
case GDK_Page_Down:
gtk_adjustment_set_value(
- gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas)),
- CLAMP(gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->value +
- (gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size - 20),
+ gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas)),
+ CLAMP(gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->value +
+ (gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->page_size - 20),
0,
- gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->upper -
- gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size));
+ gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->upper -
+ gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->page_size));
click.type = GDK_BUTTON_PRESS;
- click.window = GTK_LAYOUT (et->table_canvas)->bin_window;
+ click.window = GTK_LAYOUT (et->priv->table_canvas)->bin_window;
click.send_event = key->send_event;
click.time = key->time;
click.x = 30;
- click.y = gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size - 1;
+ click.y = gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->page_size - 1;
click.state = key->state;
click.button = 1;
- gtk_widget_event(GTK_WIDGET(et->table_canvas),
+ gtk_widget_event(GTK_WIDGET(et->priv->table_canvas),
(GdkEvent *) &click);
return_val = 1;
break;
case GDK_Page_Up:
gtk_adjustment_set_value(
- gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas)),
- gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->value -
- (gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas))->page_size - 20));
+ gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas)),
+ gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->value -
+ (gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas))->page_size - 20));
click.type = GDK_BUTTON_PRESS;
- click.window = GTK_LAYOUT (et->table_canvas)->bin_window;
+ click.window = GTK_LAYOUT (et->priv->table_canvas)->bin_window;
click.send_event = key->send_event;
click.time = key->time;
click.x = 30;
click.y = 1;
click.state = key->state;
click.button = 1;
- gtk_widget_event(GTK_WIDGET(et->table_canvas),
+ gtk_widget_event(GTK_WIDGET(et->priv->table_canvas),
(GdkEvent *) &click);
return_val = 1;
break;
case '=':
case GDK_Right:
- path = e_tree_table_adapter_node_at_row(et->etta, row);
- e_tree_table_adapter_node_set_expanded (et->etta, path, TRUE);
+ path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
+ e_tree_table_adapter_node_set_expanded (et->priv->etta, path, TRUE);
break;
case '-':
case GDK_Left:
- path = e_tree_table_adapter_node_at_row(et->etta, row);
- e_tree_table_adapter_node_set_expanded (et->etta, path, FALSE);
+ path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
+ e_tree_table_adapter_node_set_expanded (et->priv->etta, path, FALSE);
break;
default:
- path = e_tree_table_adapter_node_at_row(et->etta, row);
- path = e_tree_sorted_view_to_model_path(et->sorted, path);
+ path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
+ path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
gtk_signal_emit (GTK_OBJECT (et),
et_signals [KEY_PRESS],
row, path, col, event, &return_val);
@@ -471,29 +524,29 @@ et_selection_model_selection_change (ETableSelectionModel *etsm, ETable *et)
static void
et_build_item (ETree *et)
{
- et->item = gnome_canvas_item_new(GNOME_CANVAS_GROUP (gnome_canvas_root(et->table_canvas)),
+ et->priv->item = gnome_canvas_item_new(GNOME_CANVAS_GROUP (gnome_canvas_root(et->priv->table_canvas)),
e_table_item_get_type(),
- "ETableHeader", et->header,
- "ETableModel", et->etta,
- "selection_model", et->selection,
- "horizontal_draw_grid", et->horizontal_draw_grid,
- "vertical_draw_grid", et->vertical_draw_grid,
- "drawfocus", et->draw_focus,
- "cursor_mode", et->cursor_mode,
- "length_threshold", et->length_threshold,
+ "ETableHeader", et->priv->header,
+ "ETableModel", et->priv->etta,
+ "selection_model", et->priv->selection,
+ "horizontal_draw_grid", et->priv->horizontal_draw_grid,
+ "vertical_draw_grid", et->priv->vertical_draw_grid,
+ "drawfocus", et->priv->draw_focus,
+ "cursor_mode", et->priv->cursor_mode,
+ "length_threshold", et->priv->length_threshold,
NULL);
- gtk_signal_connect (GTK_OBJECT (et->item), "cursor_change",
+ gtk_signal_connect (GTK_OBJECT (et->priv->item), "cursor_change",
GTK_SIGNAL_FUNC (item_cursor_change), et);
- gtk_signal_connect (GTK_OBJECT (et->item), "cursor_activated",
+ gtk_signal_connect (GTK_OBJECT (et->priv->item), "cursor_activated",
GTK_SIGNAL_FUNC (item_cursor_activated), et);
- gtk_signal_connect (GTK_OBJECT (et->item), "double_click",
+ gtk_signal_connect (GTK_OBJECT (et->priv->item), "double_click",
GTK_SIGNAL_FUNC (item_double_click), et);
- gtk_signal_connect (GTK_OBJECT (et->item), "right_click",
+ gtk_signal_connect (GTK_OBJECT (et->priv->item), "right_click",
GTK_SIGNAL_FUNC (item_right_click), et);
- gtk_signal_connect (GTK_OBJECT (et->item), "click",
+ gtk_signal_connect (GTK_OBJECT (et->priv->item), "click",
GTK_SIGNAL_FUNC (item_click), et);
- gtk_signal_connect (GTK_OBJECT (et->item), "key_press",
+ gtk_signal_connect (GTK_OBJECT (et->priv->item), "key_press",
GTK_SIGNAL_FUNC (item_key_press), et);
}
@@ -501,8 +554,8 @@ static void
et_canvas_realize (GtkWidget *canvas, ETree *e_tree)
{
gnome_canvas_item_set(
- e_tree->white_item,
- "fill_color_gdk", &GTK_WIDGET(e_tree->table_canvas)->style->base[GTK_STATE_NORMAL],
+ e_tree->priv->white_item,
+ "fill_color_gdk", &GTK_WIDGET(e_tree->priv->table_canvas)->style->base[GTK_STATE_NORMAL],
NULL);
}
@@ -521,15 +574,15 @@ et_canvas_button_press (GtkWidget *canvas, GdkEvent *event, ETree *e_tree)
static void
e_tree_setup_table (ETree *e_tree)
{
- e_tree->table_canvas = GNOME_CANVAS (e_canvas_new ());
+ e_tree->priv->table_canvas = GNOME_CANVAS (e_canvas_new ());
gtk_signal_connect (
- GTK_OBJECT (e_tree->table_canvas), "size_allocate",
+ GTK_OBJECT (e_tree->priv->table_canvas), "size_allocate",
GTK_SIGNAL_FUNC (tree_canvas_size_allocate), e_tree);
gtk_signal_connect (
- GTK_OBJECT (e_tree->table_canvas), "focus_in_event",
+ GTK_OBJECT (e_tree->priv->table_canvas), "focus_in_event",
GTK_SIGNAL_FUNC (gtk_widget_queue_draw), e_tree);
gtk_signal_connect (
- GTK_OBJECT (e_tree->table_canvas), "focus_out_event",
+ GTK_OBJECT (e_tree->priv->table_canvas), "focus_out_event",
GTK_SIGNAL_FUNC (gtk_widget_queue_draw), e_tree);
gtk_signal_connect (
@@ -557,26 +610,26 @@ e_tree_setup_table (ETree *e_tree)
GTK_OBJECT (e_tree), "drag_data_received",
GTK_SIGNAL_FUNC (et_drag_data_received), e_tree);
- gtk_signal_connect (GTK_OBJECT(e_tree->table_canvas), "reflow",
+ gtk_signal_connect (GTK_OBJECT(e_tree->priv->table_canvas), "reflow",
GTK_SIGNAL_FUNC (tree_canvas_reflow), e_tree);
- gtk_widget_show (GTK_WIDGET (e_tree->table_canvas));
+ gtk_widget_show (GTK_WIDGET (e_tree->priv->table_canvas));
- e_tree->white_item = gnome_canvas_item_new(
- gnome_canvas_root(e_tree->table_canvas),
+ e_tree->priv->white_item = gnome_canvas_item_new(
+ gnome_canvas_root(e_tree->priv->table_canvas),
gnome_canvas_rect_get_type(),
"x1", (double) 0,
"y1", (double) 0,
"x2", (double) 100,
"y2", (double) 100,
- "fill_color_gdk", &GTK_WIDGET(e_tree->table_canvas)->style->base[GTK_STATE_NORMAL],
+ "fill_color_gdk", &GTK_WIDGET(e_tree->priv->table_canvas)->style->base[GTK_STATE_NORMAL],
NULL);
gtk_signal_connect (
- GTK_OBJECT(e_tree->table_canvas), "realize",
+ GTK_OBJECT(e_tree->priv->table_canvas), "realize",
GTK_SIGNAL_FUNC(et_canvas_realize), e_tree);
gtk_signal_connect (
- GTK_OBJECT(e_tree->table_canvas), "button_press_event",
+ GTK_OBJECT(e_tree->priv->table_canvas), "button_press_event",
GTK_SIGNAL_FUNC(et_canvas_button_press), e_tree);
et_build_item(e_tree);
@@ -585,38 +638,38 @@ e_tree_setup_table (ETree *e_tree)
void
e_tree_set_state_object(ETree *e_tree, ETableState *state)
{
- if (e_tree->header)
- gtk_object_unref(GTK_OBJECT(e_tree->header));
- e_tree->header = e_table_state_to_header (GTK_WIDGET(e_tree), e_tree->full_header, state);
- if (e_tree->header)
- gtk_object_ref(GTK_OBJECT(e_tree->header));
+ if (e_tree->priv->header)
+ gtk_object_unref(GTK_OBJECT(e_tree->priv->header));
+ e_tree->priv->header = e_table_state_to_header (GTK_WIDGET(e_tree), e_tree->priv->full_header, state);
+ if (e_tree->priv->header)
+ gtk_object_ref(GTK_OBJECT(e_tree->priv->header));
- gtk_object_set (GTK_OBJECT (e_tree->header),
- "width", (double) (GTK_WIDGET(e_tree->table_canvas)->allocation.width),
+ gtk_object_set (GTK_OBJECT (e_tree->priv->header),
+ "width", (double) (GTK_WIDGET(e_tree->priv->table_canvas)->allocation.width),
NULL);
- if (e_tree->sort_info)
- gtk_object_unref(GTK_OBJECT(e_tree->sort_info));
+ if (e_tree->priv->sort_info)
+ gtk_object_unref(GTK_OBJECT(e_tree->priv->sort_info));
if (state->sort_info)
- e_tree->sort_info = e_table_sort_info_duplicate(state->sort_info);
+ e_tree->priv->sort_info = e_table_sort_info_duplicate(state->sort_info);
else
- e_tree->sort_info = NULL;
+ e_tree->priv->sort_info = NULL;
- if (e_tree->header_item)
- gtk_object_set(GTK_OBJECT(e_tree->header_item),
- "ETableHeader", e_tree->header,
- "sort_info", e_tree->sort_info,
+ if (e_tree->priv->header_item)
+ gtk_object_set(GTK_OBJECT(e_tree->priv->header_item),
+ "ETableHeader", e_tree->priv->header,
+ "sort_info", e_tree->priv->sort_info,
NULL);
- if (e_tree->item)
- gtk_object_set(GTK_OBJECT(e_tree->item),
- "ETableHeader", e_tree->header,
+ if (e_tree->priv->item)
+ gtk_object_set(GTK_OBJECT(e_tree->priv->item),
+ "ETableHeader", e_tree->priv->header,
NULL);
- if (e_tree->sorted)
- gtk_object_set(GTK_OBJECT(e_tree->sorted),
- "sort_info", e_tree->sort_info,
+ if (e_tree->priv->sorted)
+ gtk_object_set(GTK_OBJECT(e_tree->priv->sorted),
+ "sort_info", e_tree->priv->sort_info,
NULL);
}
@@ -689,18 +742,18 @@ e_tree_get_state_object (ETree *e_tree)
int i, j;
state = e_table_state_new();
- state->sort_info = e_tree->sort_info;
+ state->sort_info = e_tree->priv->sort_info;
gtk_object_ref(GTK_OBJECT(state->sort_info));
- state->col_count = e_table_header_count (e_tree->header);
- full_col_count = e_table_header_count (e_tree->full_header);
+ state->col_count = e_table_header_count (e_tree->priv->header);
+ full_col_count = e_table_header_count (e_tree->priv->full_header);
state->columns = g_new(int, state->col_count);
state->expansions = g_new(double, state->col_count);
for (i = 0; i < state->col_count; i++) {
- ETableCol *col = e_table_header_get_column(e_tree->header, i);
+ ETableCol *col = e_table_header_get_column(e_tree->priv->header, i);
state->columns[i] = -1;
for (j = 0; j < full_col_count; j++) {
- if (col->col_idx == e_table_header_index(e_tree->full_header, j)) {
+ if (col->col_idx == e_table_header_index(e_tree->priv->full_header, j)) {
state->columns[i] = j;
break;
}
@@ -752,46 +805,44 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
else
ete = e_table_extras_new();
- e_tree->horizontal_draw_grid = specification->horizontal_draw_grid;
- e_tree->vertical_draw_grid = specification->vertical_draw_grid;
- e_tree->draw_focus = specification->draw_focus;
- e_tree->cursor_mode = specification->cursor_mode;
- e_tree->full_header = e_table_spec_to_full_header(specification, ete);
+ e_tree->priv->horizontal_draw_grid = specification->horizontal_draw_grid;
+ e_tree->priv->vertical_draw_grid = specification->vertical_draw_grid;
+ e_tree->priv->draw_focus = specification->draw_focus;
+ e_tree->priv->cursor_mode = specification->cursor_mode;
+ e_tree->priv->full_header = e_table_spec_to_full_header(specification, ete);
- e_tree->header = e_table_state_to_header (GTK_WIDGET(e_tree), e_tree->full_header, state);
- e_tree->horizontal_scrolling = specification->horizontal_scrolling;
+ e_tree->priv->header = e_table_state_to_header (GTK_WIDGET(e_tree), e_tree->priv->full_header, state);
+ e_tree->priv->horizontal_scrolling = specification->horizontal_scrolling;
- e_tree->sort_info = state->sort_info;
- gtk_object_ref (GTK_OBJECT (e_tree->sort_info));
+ e_tree->priv->sort_info = state->sort_info;
+ gtk_object_ref (GTK_OBJECT (e_tree->priv->sort_info));
- gtk_object_set(GTK_OBJECT(e_tree->header),
- "sort_info", e_tree->sort_info,
+ gtk_object_set(GTK_OBJECT(e_tree->priv->header),
+ "sort_info", e_tree->priv->sort_info,
NULL);
- e_tree->model = etm;
+ e_tree->priv->model = etm;
gtk_object_ref (GTK_OBJECT (etm));
- e_tree->sorted = e_tree_sorted_new(etm, e_tree->full_header, e_tree->sort_info);
+ e_tree->priv->sorted = e_tree_sorted_new(etm, e_tree->priv->full_header, e_tree->priv->sort_info);
- e_tree->etta = E_TREE_TABLE_ADAPTER(e_tree_table_adapter_new(E_TREE_MODEL(e_tree->sorted)));
+ e_tree->priv->etta = E_TREE_TABLE_ADAPTER(e_tree_table_adapter_new(E_TREE_MODEL(e_tree->priv->sorted)));
gtk_widget_push_visual (gdk_rgb_get_visual ());
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
- e_tree->sorter = e_sorter_new();
+ e_tree->priv->sorter = e_sorter_new();
- gtk_object_set (GTK_OBJECT (e_tree->selection),
- "model", e_tree->etta,
- "sorter", e_tree->sorter,
-#if 0
- "ets", e_tree->sorted,
- "model", e_tree->model,
-#endif
+ gtk_object_set (GTK_OBJECT (e_tree->priv->selection),
+ "model", e_tree->priv->model,
+ "sorter", e_tree->priv->sorter,
+ "ets", e_tree->priv->sorted,
+ "etta", e_tree->priv->etta,
"selection_mode", specification->selection_mode,
"cursor_mode", specification->cursor_mode,
NULL);
- gtk_signal_connect(GTK_OBJECT(e_tree->selection), "selection_changed",
+ gtk_signal_connect(GTK_OBJECT(e_tree->priv->selection), "selection_changed",
GTK_SIGNAL_FUNC(et_selection_model_selection_change), e_tree);
if (!specification->no_headers) {
@@ -799,20 +850,20 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
}
e_tree_setup_table (e_tree);
- gtk_layout_get_vadjustment (GTK_LAYOUT (e_tree->table_canvas))->step_increment = 20;
- gtk_adjustment_changed(gtk_layout_get_vadjustment (GTK_LAYOUT (e_tree->table_canvas)));
+ gtk_layout_get_vadjustment (GTK_LAYOUT (e_tree->priv->table_canvas))->step_increment = 20;
+ gtk_adjustment_changed(gtk_layout_get_vadjustment (GTK_LAYOUT (e_tree->priv->table_canvas)));
if (!specification->no_headers) {
/*
* The header
*/
- gtk_table_attach (GTK_TABLE (e_tree), GTK_WIDGET (e_tree->header_canvas),
+ gtk_table_attach (GTK_TABLE (e_tree), GTK_WIDGET (e_tree->priv->header_canvas),
0, 1, 0 + row, 1 + row,
GTK_FILL | GTK_EXPAND,
GTK_FILL, 0, 0);
row ++;
}
- gtk_table_attach (GTK_TABLE (e_tree), GTK_WIDGET (e_tree->table_canvas),
+ gtk_table_attach (GTK_TABLE (e_tree), GTK_WIDGET (e_tree->priv->table_canvas),
0, 1, 0 + row, 1 + row,
GTK_FILL | GTK_EXPAND,
GTK_FILL | GTK_EXPAND,
@@ -857,7 +908,7 @@ e_tree_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
e_tree = et_real_construct (e_tree, etm, ete, specification, state);
- e_tree->spec = specification;
+ e_tree->priv->spec = specification;
gtk_object_unref(GTK_OBJECT(state));
return e_tree;
@@ -902,7 +953,7 @@ e_tree_construct_from_spec_file (ETree *e_tree, ETreeModel *etm, ETableExtras *e
e_tree = et_real_construct (e_tree, etm, ete, specification, state);
- e_tree->spec = specification;
+ e_tree->priv->spec = specification;
gtk_object_unref(GTK_OBJECT(state));
return e_tree;
@@ -950,14 +1001,14 @@ e_tree_set_cursor (ETree *e_tree, ETreePath path)
g_return_if_fail(E_IS_TREE(e_tree));
g_return_if_fail(path != NULL);
- path = e_tree_sorted_model_to_view_path(e_tree->sorted, path);
+ path = e_tree_sorted_model_to_view_path(e_tree->priv->sorted, path);
- row = e_tree_table_adapter_row_of_node(E_TREE_TABLE_ADAPTER(e_tree->etta), path);
+ row = e_tree_table_adapter_row_of_node(E_TREE_TABLE_ADAPTER(e_tree->priv->etta), path);
if (row == -1)
return;
- gtk_object_set(GTK_OBJECT(e_tree->selection),
+ gtk_object_set(GTK_OBJECT(e_tree->priv->selection),
"cursor_row", row,
NULL);
}
@@ -970,11 +1021,11 @@ e_tree_get_cursor (ETree *e_tree)
g_return_val_if_fail(e_tree != NULL, NULL);
g_return_val_if_fail(E_IS_TREE(e_tree), NULL);
- gtk_object_get(GTK_OBJECT(e_tree->selection),
+ gtk_object_get(GTK_OBJECT(e_tree->priv->selection),
"cursor_row", &row,
NULL);
- path = e_tree_table_adapter_node_at_row(E_TREE_TABLE_ADAPTER(e_tree->etta), row);
- path = e_tree_sorted_view_to_model_path(e_tree->sorted, path);
+ path = e_tree_table_adapter_node_at_row(E_TREE_TABLE_ADAPTER(e_tree->priv->etta), row);
+ path = e_tree_sorted_view_to_model_path(e_tree->priv->sorted, path);
return path;
}
@@ -986,9 +1037,22 @@ e_tree_selected_row_foreach (ETree *e_tree,
g_return_if_fail(e_tree != NULL);
g_return_if_fail(E_IS_TREE(e_tree));
- e_selection_model_foreach(E_SELECTION_MODEL (e_tree->selection),
- callback,
- closure);
+ e_selection_model_foreach(e_tree->priv->selection,
+ callback,
+ closure);
+}
+
+void
+e_tree_selected_path_foreach (ETree *e_tree,
+ ETreeForeachFunc callback,
+ gpointer closure)
+{
+ g_return_if_fail(e_tree != NULL);
+ g_return_if_fail(E_IS_TREE(e_tree));
+
+ e_tree_selection_model_foreach(E_TREE_SELECTION_MODEL (e_tree->priv->selection),
+ callback,
+ closure);
}
gint
@@ -997,7 +1061,7 @@ e_tree_selected_count (ETree *e_tree)
g_return_val_if_fail(e_tree != NULL, -1);
g_return_val_if_fail(E_IS_TREE(e_tree), -1);
- return e_selection_model_selected_count(E_SELECTION_MODEL (e_tree->selection));
+ return e_selection_model_selected_count(E_SELECTION_MODEL (e_tree->priv->selection));
}
void
@@ -1006,7 +1070,7 @@ e_tree_select_all (ETree *tree)
g_return_if_fail (tree != NULL);
g_return_if_fail (E_IS_TREE (tree));
- e_selection_model_select_all (E_SELECTION_MODEL (tree->selection));
+ e_selection_model_select_all (E_SELECTION_MODEL (tree->priv->selection));
}
void
@@ -1015,7 +1079,7 @@ e_tree_invert_selection (ETree *tree)
g_return_if_fail (tree != NULL);
g_return_if_fail (E_IS_TREE (tree));
- e_selection_model_invert_selection (E_SELECTION_MODEL (tree->selection));
+ e_selection_model_invert_selection (E_SELECTION_MODEL (tree->priv->selection));
}
@@ -1025,7 +1089,7 @@ e_tree_get_printable (ETree *e_tree)
g_return_val_if_fail(e_tree != NULL, NULL);
g_return_val_if_fail(E_IS_TREE(e_tree), NULL);
- return e_table_item_get_printable(E_TABLE_ITEM(e_tree->item));
+ return e_table_item_get_printable(E_TABLE_ITEM(e_tree->priv->item));
}
static void
@@ -1049,9 +1113,9 @@ et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
switch (arg_id){
case ARG_LENGTH_THRESHOLD:
- etree->length_threshold = GTK_VALUE_INT (*arg);
- if (etree->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etree->item),
+ etree->priv->length_threshold = GTK_VALUE_INT (*arg);
+ if (etree->priv->item) {
+ gnome_canvas_item_set (GNOME_CANVAS_ITEM(etree->priv->item),
"length_threshold", GTK_VALUE_INT (*arg),
NULL);
}
@@ -1070,13 +1134,13 @@ set_scroll_adjustments (ETree *tree,
gtk_adjustment_changed(vadjustment);
}
- gtk_layout_set_hadjustment (GTK_LAYOUT(tree->table_canvas),
+ gtk_layout_set_hadjustment (GTK_LAYOUT(tree->priv->table_canvas),
hadjustment);
- gtk_layout_set_vadjustment (GTK_LAYOUT(tree->table_canvas),
+ gtk_layout_set_vadjustment (GTK_LAYOUT(tree->priv->table_canvas),
vadjustment);
- if (tree->header_canvas != NULL)
- gtk_layout_set_hadjustment (GTK_LAYOUT(tree->header_canvas),
+ if (tree->priv->header_canvas != NULL)
+ gtk_layout_set_hadjustment (GTK_LAYOUT(tree->priv->header_canvas),
hadjustment);
}
@@ -1087,16 +1151,16 @@ e_tree_get_next_row (ETree *e_tree,
g_return_val_if_fail(e_tree != NULL, -1);
g_return_val_if_fail(E_IS_TREE(e_tree), -1);
- if (e_tree->sorter) {
+ if (e_tree->priv->sorter) {
int i;
- i = e_sorter_model_to_sorted(E_SORTER (e_tree->sorter), model_row);
+ i = e_sorter_model_to_sorted(E_SORTER (e_tree->priv->sorter), model_row);
i++;
- if (i < e_table_model_row_count(E_TABLE_MODEL(e_tree->etta))) {
- return e_sorter_sorted_to_model(E_SORTER (e_tree->sorter), i);
+ if (i < e_table_model_row_count(E_TABLE_MODEL(e_tree->priv->etta))) {
+ return e_sorter_sorted_to_model(E_SORTER (e_tree->priv->sorter), i);
} else
return -1;
} else
- if (model_row < e_table_model_row_count(E_TABLE_MODEL(e_tree->etta)) - 1)
+ if (model_row < e_table_model_row_count(E_TABLE_MODEL(e_tree->priv->etta)) - 1)
return model_row + 1;
else
return -1;
@@ -1109,12 +1173,12 @@ e_tree_get_prev_row (ETree *e_tree,
g_return_val_if_fail(e_tree != NULL, -1);
g_return_val_if_fail(E_IS_TREE(e_tree), -1);
- if (e_tree->sorter) {
+ if (e_tree->priv->sorter) {
int i;
- i = e_sorter_model_to_sorted(E_SORTER (e_tree->sorter), model_row);
+ i = e_sorter_model_to_sorted(E_SORTER (e_tree->priv->sorter), model_row);
i--;
if (i >= 0)
- return e_sorter_sorted_to_model(E_SORTER (e_tree->sorter), i);
+ return e_sorter_sorted_to_model(E_SORTER (e_tree->priv->sorter), i);
else
return -1;
} else
@@ -1128,8 +1192,8 @@ e_tree_model_to_view_row (ETree *e_tree,
g_return_val_if_fail(e_tree != NULL, -1);
g_return_val_if_fail(E_IS_TREE(e_tree), -1);
- if (e_tree->sorter)
- return e_sorter_model_to_sorted(E_SORTER (e_tree->sorter), model_row);
+ if (e_tree->priv->sorter)
+ return e_sorter_model_to_sorted(E_SORTER (e_tree->priv->sorter), model_row);
else
return model_row;
}
@@ -1141,8 +1205,8 @@ e_tree_view_to_model_row (ETree *e_tree,
g_return_val_if_fail(e_tree != NULL, -1);
g_return_val_if_fail(E_IS_TREE(e_tree), -1);
- if (e_tree->sorter)
- return e_sorter_sorted_to_model (E_SORTER (e_tree->sorter), view_row);
+ if (e_tree->priv->sorter)
+ return e_sorter_sorted_to_model (E_SORTER (e_tree->priv->sorter), view_row);
else
return view_row;
}
@@ -1151,11 +1215,11 @@ e_tree_view_to_model_row (ETree *e_tree,
gboolean
e_tree_node_is_expanded (ETree *et, ETreePath path)
{
- path = e_tree_sorted_model_to_view_path(et->sorted, path);
+ path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
g_return_val_if_fail(path, FALSE);
- return e_tree_table_adapter_node_is_expanded (et->etta, path);
+ return e_tree_table_adapter_node_is_expanded (et->priv->etta, path);
}
void
@@ -1164,9 +1228,9 @@ e_tree_node_set_expanded (ETree *et, ETreePath path, gboolean expanded)
g_return_if_fail (et != NULL);
g_return_if_fail (E_IS_TREE(et));
- path = e_tree_sorted_model_to_view_path(et->sorted, path);
+ path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
- e_tree_table_adapter_node_set_expanded (et->etta, path, expanded);
+ e_tree_table_adapter_node_set_expanded (et->priv->etta, path, expanded);
}
void
@@ -1175,9 +1239,9 @@ e_tree_node_set_expanded_recurse (ETree *et, ETreePath path, gboolean expanded)
g_return_if_fail (et != NULL);
g_return_if_fail (E_IS_TREE(et));
- path = e_tree_sorted_model_to_view_path(et->sorted, path);
+ path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
- e_tree_table_adapter_node_set_expanded_recurse (et->etta, path, expanded);
+ e_tree_table_adapter_node_set_expanded_recurse (et->priv->etta, path, expanded);
}
void
@@ -1186,7 +1250,7 @@ e_tree_root_node_set_visible (ETree *et, gboolean visible)
g_return_if_fail (et != NULL);
g_return_if_fail (E_IS_TREE(et));
- e_tree_table_adapter_root_node_set_visible (et->etta, visible);
+ e_tree_table_adapter_root_node_set_visible (et->priv->etta, visible);
}
ETreePath
@@ -1194,8 +1258,8 @@ e_tree_node_at_row (ETree *et, int row)
{
ETreePath path;
- path = e_tree_table_adapter_node_at_row (et->etta, row);
- path = e_tree_sorted_view_to_model_path(et->sorted, path);
+ path = e_tree_table_adapter_node_at_row (et->priv->etta, row);
+ path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
return path;
}
@@ -1203,14 +1267,14 @@ e_tree_node_at_row (ETree *et, int row)
int
e_tree_row_of_node (ETree *et, ETreePath path)
{
- path = e_tree_sorted_model_to_view_path(et->sorted, path);
- return e_tree_table_adapter_row_of_node (et->etta, path);
+ path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
+ return e_tree_table_adapter_row_of_node (et->priv->etta, path);
}
gboolean
e_tree_root_node_is_visible(ETree *et)
{
- return e_tree_table_adapter_root_node_is_visible (et->etta);
+ return e_tree_table_adapter_root_node_is_visible (et->priv->etta);
}
void
@@ -1219,9 +1283,9 @@ e_tree_show_node (ETree *et, ETreePath path)
g_return_if_fail (et != NULL);
g_return_if_fail (E_IS_TREE(et));
- path = e_tree_sorted_model_to_view_path(et->sorted, path);
+ path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
- e_tree_table_adapter_show_node (et->etta, path);
+ e_tree_table_adapter_show_node (et->priv->etta, path);
}
void
@@ -1230,19 +1294,19 @@ e_tree_save_expanded_state (ETree *et, char *filename)
g_return_if_fail (et != NULL);
g_return_if_fail (E_IS_TREE(et));
- e_tree_table_adapter_save_expanded_state (et->etta, filename);
+ e_tree_table_adapter_save_expanded_state (et->priv->etta, filename);
}
void
e_tree_load_expanded_state (ETree *et, char *filename)
{
- e_tree_table_adapter_load_expanded_state (et->etta, filename);
+ e_tree_table_adapter_load_expanded_state (et->priv->etta, filename);
}
gint
e_tree_row_count (ETree *et)
{
- return e_table_model_row_count (E_TABLE_MODEL(et->etta));
+ return e_table_model_row_count (E_TABLE_MODEL(et->priv->etta));
}
struct _ETreeDragSourceSite
@@ -1326,8 +1390,8 @@ e_tree_drag_get_data (ETree *tree,
g_return_if_fail(tree != NULL);
g_return_if_fail(E_IS_TREE(tree));
- path = e_tree_table_adapter_node_at_row(tree->etta, row);
- path = e_tree_sorted_view_to_model_path(tree->sorted, path);
+ path = e_tree_table_adapter_node_at_row(tree->priv->etta, row);
+ path = e_tree_sorted_view_to_model_path(tree->priv->sorted, path);
gtk_drag_get_data(GTK_WIDGET(tree),
context,
@@ -1419,8 +1483,8 @@ e_tree_drag_source_set (ETree *tree,
g_return_if_fail(tree != NULL);
g_return_if_fail(E_IS_TREE(tree));
- canvas = GTK_WIDGET(tree->table_canvas);
- site = tree->site;
+ canvas = GTK_WIDGET(tree->priv->table_canvas);
+ site = tree->priv->site;
gtk_widget_add_events (canvas,
gtk_widget_get_events (canvas) |
@@ -1433,16 +1497,16 @@ e_tree_drag_source_set (ETree *tree,
} else {
site = g_new0 (ETreeDragSourceSite, 1);
- tree->drag_source_button_press_event_id =
+ tree->priv->drag_source_button_press_event_id =
gtk_signal_connect (GTK_OBJECT (canvas), "button_press_event",
GTK_SIGNAL_FUNC (e_tree_drag_source_event_cb),
tree);
- tree->drag_source_motion_notify_event_id =
+ tree->priv->drag_source_motion_notify_event_id =
gtk_signal_connect (GTK_OBJECT (canvas), "motion_notify_event",
GTK_SIGNAL_FUNC (e_tree_drag_source_event_cb),
tree);
- tree->site = site;
+ tree->priv->site = site;
}
site->start_button_mask = start_button_mask;
@@ -1463,17 +1527,17 @@ e_tree_drag_source_unset (ETree *tree)
g_return_if_fail (tree != NULL);
g_return_if_fail (E_IS_TREE(tree));
- site = tree->site;
+ site = tree->priv->site;
if (site) {
gtk_signal_disconnect (
- GTK_OBJECT (tree->table_canvas),
- tree->drag_source_button_press_event_id);
+ GTK_OBJECT (tree->priv->table_canvas),
+ tree->priv->drag_source_button_press_event_id);
gtk_signal_disconnect (
- GTK_OBJECT (tree->table_canvas),
- tree->drag_source_motion_notify_event_id);
+ GTK_OBJECT (tree->priv->table_canvas),
+ tree->priv->drag_source_motion_notify_event_id);
g_free (site);
- tree->site = NULL;
+ tree->priv->site = NULL;
}
}
@@ -1494,12 +1558,12 @@ e_tree_drag_begin (ETree *tree,
g_return_val_if_fail (tree != NULL, NULL);
g_return_val_if_fail (E_IS_TREE(tree), NULL);
- path = e_tree_table_adapter_node_at_row(tree->etta, row);
- path = e_tree_sorted_view_to_model_path(tree->sorted, path);
+ path = e_tree_table_adapter_node_at_row(tree->priv->etta, row);
+ path = e_tree_sorted_view_to_model_path(tree->priv->sorted, path);
- tree->drag_row = row;
- tree->drag_path = path;
- tree->drag_col = col;
+ tree->priv->drag_row = row;
+ tree->priv->drag_path = path;
+ tree->priv->drag_col = col;
return gtk_drag_begin(GTK_WIDGET(tree),
targets,
@@ -1532,9 +1596,9 @@ e_tree_get_cell_at (ETree *tree,
/* FIXME it would be nice if it could handle a NULL row_return or
* col_return gracefully. */
- x += GTK_LAYOUT(tree->table_canvas)->hadjustment->value;
- y += GTK_LAYOUT(tree->table_canvas)->vadjustment->value;
- e_table_item_compute_location(E_TABLE_ITEM(tree->item), &x, &y, row_return, col_return);
+ x += GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
+ y += GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
+ e_table_item_compute_location(E_TABLE_ITEM(tree->priv->item), &x, &y, row_return, col_return);
}
static void
@@ -1544,9 +1608,9 @@ et_drag_begin (GtkWidget *widget,
{
gtk_signal_emit (GTK_OBJECT (et),
et_signals [TREE_DRAG_BEGIN],
- et->drag_row,
- et->drag_path,
- et->drag_col,
+ et->priv->drag_row,
+ et->priv->drag_path,
+ et->priv->drag_col,
context);
}
@@ -1557,9 +1621,9 @@ et_drag_end (GtkWidget *widget,
{
gtk_signal_emit (GTK_OBJECT (et),
et_signals [TREE_DRAG_END],
- et->drag_row,
- et->drag_path,
- et->drag_col,
+ et->priv->drag_row,
+ et->priv->drag_path,
+ et->priv->drag_col,
context);
}
@@ -1573,9 +1637,9 @@ et_drag_data_get(GtkWidget *widget,
{
gtk_signal_emit (GTK_OBJECT (et),
et_signals [TREE_DRAG_DATA_GET],
- et->drag_row,
- et->drag_path,
- et->drag_col,
+ et->priv->drag_row,
+ et->priv->drag_path,
+ et->priv->drag_col,
context,
selection_data,
info,
@@ -1589,9 +1653,9 @@ et_drag_data_delete(GtkWidget *widget,
{
gtk_signal_emit (GTK_OBJECT (et),
et_signals [TREE_DRAG_DATA_DELETE],
- et->drag_row,
- et->drag_path,
- et->drag_col,
+ et->priv->drag_row,
+ et->priv->drag_path,
+ et->priv->drag_col,
context);
}
@@ -1603,13 +1667,13 @@ et_drag_leave(GtkWidget *widget,
{
gtk_signal_emit (GTK_OBJECT (et),
et_signals [TREE_DRAG_LEAVE],
- et->drop_row,
- et->drop_path,
- et->drop_col,
+ et->priv->drop_row,
+ et->priv->drop_path,
+ et->priv->drop_col,
context,
time);
- et->drop_row = -1;
- et->drop_col = -1;
+ et->priv->drop_row = -1;
+ et->priv->drop_col = -1;
}
static gboolean
@@ -1628,29 +1692,29 @@ et_drag_motion(GtkWidget *widget,
y,
&row,
&col);
- if (et->drop_row >= 0 && et->drop_col >= 0 &&
- row != et->drop_row && col != et->drop_row) {
+ if (et->priv->drop_row >= 0 && et->priv->drop_col >= 0 &&
+ row != et->priv->drop_row && col != et->priv->drop_row) {
gtk_signal_emit (GTK_OBJECT (et),
et_signals [TREE_DRAG_LEAVE],
- et->drop_row,
- et->drop_path,
- et->drop_col,
+ et->priv->drop_row,
+ et->priv->drop_path,
+ et->priv->drop_col,
context,
time);
}
- path = e_tree_table_adapter_node_at_row(et->etta, row);
- path = e_tree_sorted_view_to_model_path(et->sorted, path);
+ path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
+ path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- et->drop_row = row;
- et->drop_path = path;
- et->drop_col = col;
+ et->priv->drop_row = row;
+ et->priv->drop_path = path;
+ et->priv->drop_col = col;
if (row >= 0 && col >= 0)
gtk_signal_emit (GTK_OBJECT (et),
et_signals [TREE_DRAG_MOTION],
- et->drop_row,
- et->drop_path,
- et->drop_col,
+ et->priv->drop_row,
+ et->priv->drop_path,
+ et->priv->drop_col,
context,
x,
y,
@@ -1675,16 +1739,16 @@ et_drag_drop(GtkWidget *widget,
y,
&row,
&col);
- path = e_tree_table_adapter_node_at_row(et->etta, row);
- path = e_tree_sorted_view_to_model_path(et->sorted, path);
+ path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
+ path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- if (et->drop_row >= 0 && et->drop_col >= 0 &&
- row != et->drop_row && col != et->drop_row) {
+ if (et->priv->drop_row >= 0 && et->priv->drop_col >= 0 &&
+ row != et->priv->drop_row && col != et->priv->drop_row) {
gtk_signal_emit (GTK_OBJECT (et),
et_signals [TREE_DRAG_LEAVE],
- et->drop_row,
- et->drop_path,
- et->drop_col,
+ et->priv->drop_row,
+ et->priv->drop_path,
+ et->priv->drop_col,
context,
time);
if (row >= 0 && col >= 0)
@@ -1699,23 +1763,23 @@ et_drag_drop(GtkWidget *widget,
time,
&ret_val);
}
- et->drop_row = row;
- et->drop_path = path;
- et->drop_col = col;
+ et->priv->drop_row = row;
+ et->priv->drop_path = path;
+ et->priv->drop_col = col;
if (row >= 0 && col >= 0)
gtk_signal_emit (GTK_OBJECT (et),
et_signals [TREE_DRAG_DROP],
- et->drop_row,
- et->drop_path,
- et->drop_col,
+ et->priv->drop_row,
+ et->priv->drop_path,
+ et->priv->drop_col,
context,
x,
y,
time,
&ret_val);
- et->drop_row = -1;
- et->drop_path = NULL;
- et->drop_col = -1;
+ et->priv->drop_row = -1;
+ et->priv->drop_path = NULL;
+ et->priv->drop_col = -1;
return ret_val;
}
@@ -1736,8 +1800,8 @@ et_drag_data_received(GtkWidget *widget,
y,
&row,
&col);
- path = e_tree_table_adapter_node_at_row(et->etta, row);
- path = e_tree_sorted_view_to_model_path(et->sorted, path);
+ path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
+ path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
gtk_signal_emit (GTK_OBJECT (et),
et_signals [TREE_DRAG_DATA_RECEIVED],
row,
@@ -1757,7 +1821,7 @@ e_tree_drag_source_event_cb (GtkWidget *widget,
ETree *tree)
{
ETreeDragSourceSite *site;
- site = tree->site;
+ site = tree->priv->site;
switch (event->type) {
case GDK_BUTTON_PRESS:
diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h
index 2a22e4797e..5ab256f2b0 100644
--- a/widgets/table/e-tree.h
+++ b/widgets/table/e-tree.h
@@ -2,21 +2,16 @@
#ifndef _E_TREE_H_
#define _E_TREE_H_
-#include <libgnomeui/gnome-canvas.h>
#include <gtk/gtktable.h>
#include <gnome-xml/tree.h>
-#include <gal/e-table/e-table-header.h>
-#include <gal/e-table/e-table-group.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-item.h>
+
+#include <gal/widgets/e-printable.h>
+
#include <gal/e-table/e-table-extras.h>
#include <gal/e-table/e-table-specification.h>
-#include <gal/widgets/e-printable.h>
#include <gal/e-table/e-table-state.h>
-
#include <gal/e-table/e-tree-model.h>
-#include <gal/e-table/e-tree-table-adapter.h>
-#include <gal/e-table/e-tree-sorted.h>
+#include <gal/e-table/e-tree-selection-model.h>
BEGIN_GNOME_DECLS
@@ -27,56 +22,12 @@ BEGIN_GNOME_DECLS
#define E_IS_TREE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_TYPE))
typedef struct _ETreeDragSourceSite ETreeDragSourceSite;
+typedef struct ETreePriv ETreePriv;
typedef struct {
GtkTable parent;
- ETreeModel *model;
- ETreeSorted *sorted;
- ETreeTableAdapter *etta;
-
- ETableHeader *full_header, *header;
-
- ETableSortInfo *sort_info;
- ESorter *sorter;
-
- ESelectionModel *selection;
- ETableSpecification *spec;
-
- int reflow_idle_id;
-
- GnomeCanvas *header_canvas, *table_canvas;
-
- GnomeCanvasItem *header_item, *root;
-
- GnomeCanvasItem *white_item;
- GnomeCanvasItem *item;
-
- gint length_threshold;
-
- /*
- * Configuration settings
- */
- guint horizontal_draw_grid : 1;
- guint vertical_draw_grid : 1;
- guint draw_focus : 1;
- guint row_selection_active : 1;
-
- guint horizontal_scrolling : 1;
-
- ECursorMode cursor_mode;
-
- int drop_row;
- ETreePath drop_path;
- int drop_col;
-
- int drag_row;
- ETreePath drag_path;
- int drag_col;
- ETreeDragSourceSite *site;
-
- int drag_source_button_press_event_id;
- int drag_source_motion_notify_event_id;
+ ETreePriv *priv;
} ETree;
typedef struct {
@@ -197,8 +148,11 @@ void e_tree_set_cursor (ETree *e_tree,
/* NULL means we don't have the cursor. */
ETreePath e_tree_get_cursor (ETree *e_tree);
void e_tree_selected_row_foreach (ETree *e_tree,
- EForeachFunc callback,
- gpointer closure);
+ EForeachFunc callback,
+ gpointer closure);
+void e_tree_selected_path_foreach (ETree *e_tree,
+ ETreeForeachFunc callback,
+ gpointer closure);
gint e_tree_selected_count (ETree *e_tree);
EPrintable *e_tree_get_printable (ETree *e_tree);