diff options
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/table/e-tree-selection-model.c | 6 | ||||
-rw-r--r-- | widgets/table/e-tree-selection-model.h | 1 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 36 | ||||
-rw-r--r-- | widgets/table/e-tree.h | 6 |
4 files changed, 49 insertions, 0 deletions
diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c index 04e74c0f96..49835f847a 100644 --- a/widgets/table/e-tree-selection-model.c +++ b/widgets/table/e-tree-selection-model.c @@ -1294,6 +1294,12 @@ e_tree_selection_model_change_cursor (ETreeSelectionModel *etsm, ETreePath path) e_selection_model_cursor_activated(E_SELECTION_MODEL(etsm), row, etsm->priv->cursor_col); } +ETreePath +e_tree_selection_model_get_cursor (ETreeSelectionModel *etsm) +{ + return etsm->priv->cursor_path; +} + static void e_tree_selection_model_init (ETreeSelectionModel *etsm) diff --git a/widgets/table/e-tree-selection-model.h b/widgets/table/e-tree-selection-model.h index f71c0afc35..ef396c237c 100644 --- a/widgets/table/e-tree-selection-model.h +++ b/widgets/table/e-tree-selection-model.h @@ -67,6 +67,7 @@ void e_tree_selection_model_add_to_selection (ETreeSelectionModel ETreePath path); void e_tree_selection_model_change_cursor (ETreeSelectionModel *etsm, ETreePath path); +ETreePath e_tree_selection_model_get_cursor (ETreeSelectionModel *etsm); #ifdef __cplusplus } diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 4e1154f44f..d50eef2b3b 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -1408,6 +1408,9 @@ e_tree_set_cursor (ETree *e_tree, ETreePath path) ETreePath e_tree_get_cursor (ETree *e_tree) { +#ifdef E_TREE_USE_TREE_SELECTION + return e_tree_selection_model_get_cursor (E_TREE_SELECTION_MODEL(e_tree->priv->selection)); +#else int row; ETreePath path; g_return_val_if_fail(e_tree != NULL, NULL); @@ -1421,6 +1424,7 @@ e_tree_get_cursor (ETree *e_tree) 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; +#endif } void @@ -1733,6 +1737,38 @@ e_tree_get_tooltip (ETree *et) return E_CANVAS(et->priv->table_canvas)->tooltip_window; } +gboolean +e_tree_find_next (ETree *et, gboolean forward_direction, gboolean wrap, ETreePathFunc func, gpointer data) +{ + ETreePath cursor; + ETreePath found; + + cursor = e_tree_get_cursor (et); + cursor = e_tree_sorted_model_to_view_path (et->priv->sorted, cursor); + + found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), cursor, NULL, forward_direction, func, data); + + if (found) { + e_tree_table_adapter_show_node (et->priv->etta, found); + cursor = e_tree_sorted_view_to_model_path (et->priv->sorted, found); + e_tree_set_cursor (et, cursor); + return TRUE; + } + + if (wrap) { + found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), NULL, cursor, forward_direction, func, data); + + if (found && found != cursor) { + e_tree_table_adapter_show_node (et->priv->etta, found); + cursor = e_tree_sorted_view_to_model_path (et->priv->sorted, found); + e_tree_set_cursor (et, cursor); + return TRUE; + } + } + + return FALSE; +} + void e_tree_right_click_up (ETree *et) { diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h index ccd899ece4..f42e22eb87 100644 --- a/widgets/table/e-tree.h +++ b/widgets/table/e-tree.h @@ -281,10 +281,16 @@ void e_tree_load_expanded_state (ETree *et, char *filename); int e_tree_row_count (ETree *et); GtkWidget *e_tree_get_tooltip (ETree *et); +gboolean e_tree_find_next (ETree *et, + gboolean forward_direction, + gboolean wrap, + ETreePathFunc func, + gpointer data); /* This function is only needed in single_selection_mode. */ void e_tree_right_click_up (ETree *et); + END_GNOME_DECLS #endif /* _E_TREE_H_ */ |