aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/ChangeLog13
-rw-r--r--widgets/table/e-table-sorting-utils.c2
-rw-r--r--widgets/table/e-tree-memory-callbacks.c13
-rw-r--r--widgets/table/e-tree-memory-callbacks.h2
-rw-r--r--widgets/table/e-tree-model.c33
-rw-r--r--widgets/table/e-tree-model.h4
6 files changed, 66 insertions, 1 deletions
diff --git a/widgets/table/ChangeLog b/widgets/table/ChangeLog
index 206086aa1b..26a08a0676 100644
--- a/widgets/table/ChangeLog
+++ b/widgets/table/ChangeLog
@@ -1,3 +1,16 @@
+2007-05-17 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Add more support for GMail like sorting.
+
+ * e-table-sorting-utils.c: (e_table_sorting_utils_tree_sort):
+ * e-tree-memory-callbacks.c: (etmc_sort_value_at),
+ (e_tree_memory_callbacks_class_init),
+ (e_tree_memory_callbacks_new):
+ * e-tree-memory-callbacks.h:
+ * e-tree-model.c: (e_tree_model_class_init),
+ (e_tree_model_sort_value_at):
+ * e-tree-model.h:
+
2007-05-16 Srinivasa Ragavan <sragavan@novell.com>
* e-tree-table-adapter.c:
diff --git a/widgets/table/e-table-sorting-utils.c b/widgets/table/e-table-sorting-utils.c
index 7b3f078654..0a0c9b9acc 100644
--- a/widgets/table/e-table-sorting-utils.c
+++ b/widgets/table/e-table-sorting-utils.c
@@ -285,7 +285,7 @@ e_table_sorting_utils_tree_sort(ETreeModel *source, ETableSortInfo *sort_info, E
col = e_table_header_get_column (full_header, e_table_header_count (full_header) - 1);
for (i = 0; i < count; i++) {
- closure.vals[i * cols + j] = e_tree_model_value_at (source, map_table[i], col->compare_col);
+ closure.vals[i * cols + j] = e_tree_model_sort_value_at (source, map_table[i], col->compare_col);
}
closure.ascending[j] = column.ascending;
closure.compare[j] = col->compare;
diff --git a/widgets/table/e-tree-memory-callbacks.c b/widgets/table/e-tree-memory-callbacks.c
index 999d47cd78..8bd0c86e74 100644
--- a/widgets/table/e-tree-memory-callbacks.c
+++ b/widgets/table/e-tree-memory-callbacks.c
@@ -95,6 +95,16 @@ etmc_get_node_by_id (ETreeModel *etm, const char *save_id)
return NULL;
}
+static void *
+etmc_sort_value_at (ETreeModel *etm, ETreePath node, int col)
+{
+ ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
+
+ if (etmc->sort_value_at)
+ return etmc->sort_value_at (etm, node, col, etmc->model_data);
+ else
+ return etmc->value_at (etm, node, col, etmc->model_data);
+}
static void *
etmc_value_at (ETreeModel *etm, ETreePath node, int col)
@@ -190,6 +200,7 @@ e_tree_memory_callbacks_class_init (GtkObjectClass *object_class)
model_class->has_get_node_by_id = etmc_has_get_node_by_id;
model_class->get_node_by_id = etmc_get_node_by_id;
+ model_class->sort_value_at = etmc_sort_value_at;
model_class->value_at = etmc_value_at;
model_class->set_value_at = etmc_set_value_at;
model_class->is_editable = etmc_is_editable;
@@ -235,6 +246,7 @@ e_tree_memory_callbacks_new (ETreeMemoryCallbacksIconAtFn icon_at,
ETreeMemoryCallbacksHasGetNodeByIdFn has_get_node_by_id,
ETreeMemoryCallbacksGetNodeByIdFn get_node_by_id,
+ ETreeMemoryCallbacksValueAtFn sort_value_at,
ETreeMemoryCallbacksValueAtFn value_at,
ETreeMemoryCallbacksSetValueAtFn set_value_at,
ETreeMemoryCallbacksIsEditableFn is_editable,
@@ -261,6 +273,7 @@ e_tree_memory_callbacks_new (ETreeMemoryCallbacksIconAtFn icon_at,
etmc->has_get_node_by_id = has_get_node_by_id;
etmc->get_node_by_id = get_node_by_id;
+ etmc->sort_value_at = sort_value_at;
etmc->value_at = value_at;
etmc->set_value_at = set_value_at;
etmc->is_editable = is_editable;
diff --git a/widgets/table/e-tree-memory-callbacks.h b/widgets/table/e-tree-memory-callbacks.h
index 9fa70912e3..d4dd46a126 100644
--- a/widgets/table/e-tree-memory-callbacks.h
+++ b/widgets/table/e-tree-memory-callbacks.h
@@ -71,6 +71,7 @@ typedef struct {
ETreeMemoryCallbacksHasGetNodeByIdFn has_get_node_by_id;
ETreeMemoryCallbacksGetNodeByIdFn get_node_by_id;
+ ETreeMemoryCallbacksValueAtFn sort_value_at;
ETreeMemoryCallbacksValueAtFn value_at;
ETreeMemoryCallbacksSetValueAtFn set_value_at;
ETreeMemoryCallbacksIsEditableFn is_editable;
@@ -100,6 +101,7 @@ ETreeModel *e_tree_memory_callbacks_new (ETreeMemoryCallbacksIconAtFn icon_at,
ETreeMemoryCallbacksHasGetNodeByIdFn has_get_node_by_id,
ETreeMemoryCallbacksGetNodeByIdFn get_node_by_id,
+ ETreeMemoryCallbacksValueAtFn sort_value_at,
ETreeMemoryCallbacksValueAtFn value_at,
ETreeMemoryCallbacksSetValueAtFn set_value_at,
ETreeMemoryCallbacksIsEditableFn is_editable,
diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c
index 976d3f85b9..fca271c5f4 100644
--- a/widgets/table/e-tree-model.c
+++ b/widgets/table/e-tree-model.c
@@ -173,6 +173,7 @@ e_tree_model_class_init (GObjectClass *klass)
tree_class->has_change_pending = NULL;
+ tree_class->sort_value_at = NULL;
tree_class->value_at = NULL;
tree_class->set_value_at = NULL;
tree_class->is_editable = NULL;
@@ -755,6 +756,38 @@ e_tree_model_has_change_pending (ETreeModel *etree)
}
/**
+ * e_tree_model_sort_value_at:
+ * @etree: The ETreeModel.
+ * @node: The ETreePath to the node we're getting the data from.
+ * @col: the column to retrieve data from
+ *
+ * Return value: This function returns the value that is stored by the
+ * @etree in column @col and node @node. The data returned can be a
+ * pointer or any data value that can be stored inside a pointer.
+ *
+ * The data returned is typically used by an sort renderer if it wants
+ * to proxy the data of cell value_at at a better sorting order.
+ *
+ * The data returned must be valid until the model sends a signal that
+ * affect that piece of data. node_changed and node_deleted affect
+ * all data in tha t node and all nodes under that node.
+ * node_data_changed affects the data in that node. node_col_changed
+ * affects the data in that node for that column. node_inserted,
+ * node_removed, and no_change don't affect any data in this way.
+ **/
+void *
+e_tree_model_sort_value_at (ETreeModel *etree, ETreePath node, int col)
+{
+ g_return_val_if_fail (etree != NULL, NULL);
+ g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
+
+ if (ETM_CLASS(etree)->sort_value_at)
+ return ETM_CLASS(etree)->sort_value_at (etree, node, col);
+ else
+ return NULL;
+}
+
+/**
* e_tree_model_value_at:
* @etree: The ETreeModel.
* @node: The ETreePath to the node we're getting the data from.
diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h
index c9574388e1..10a8333f4a 100644
--- a/widgets/table/e-tree-model.h
+++ b/widgets/table/e-tree-model.h
@@ -84,6 +84,7 @@ struct ETreeModelClass {
/*
* ETable analogs
*/
+ void *(*sort_value_at) (ETreeModel *etm, ETreePath node, int col);
void *(*value_at) (ETreeModel *etm, ETreePath node, int col);
void (*set_value_at) (ETreeModel *etm, ETreePath node, int col, const void *val);
gboolean (*is_editable) (ETreeModel *etm, ETreePath node, int col);
@@ -156,6 +157,9 @@ gboolean e_tree_model_has_get_node_by_id (ETreeModel *model);
ETreePath e_tree_model_get_node_by_id (ETreeModel *model,
const char *save_id);
gboolean e_tree_model_has_change_pending (ETreeModel *model);
+void *e_tree_model_sort_value_at (ETreeModel *etree,
+ ETreePath node,
+ int col);
void *e_tree_model_value_at (ETreeModel *etree,
ETreePath node,
int col);