ETreeModel: Evolution Utilities Reference Manual

## ETreeModel ETreeModel |

## Functions

gboolean | (*ETreePathFunc) ()
ETreePath | e_tree_model_get_root ()
ETreePath | e_tree_model_node_get_parent ()
ETreePath | e_tree_model_node_get_first_child ()
ETreePath | e_tree_model_node_get_next ()
gboolean | e_tree_model_node_is_root ()
gboolean | e_tree_model_node_is_expandable ()
guint | e_tree_model_node_get_n_nodes ()
guint | e_tree_model_node_get_n_children ()
guint | e_tree_model_node_depth ()
gboolean | e_tree_model_get_expanded_default ()
gint | e_tree_model_column_count ()
gchar * | e_tree_model_get_save_id ()
ETreePath | e_tree_model_get_node_by_id ()
gpointer | e_tree_model_sort_value_at ()
gpointer | e_tree_model_value_at ()
gpointer | e_tree_model_duplicate_value ()
void | e_tree_model_free_value ()
gpointer | e_tree_model_initialize_value ()
gboolean | e_tree_model_value_is_empty ()
gchar * | e_tree_model_value_to_string ()
void | e_tree_model_node_traverse ()
ETreePath | e_tree_model_node_find ()
void | e_tree_model_pre_change ()
void | e_tree_model_rebuilt ()
void | e_tree_model_node_changed ()
void | e_tree_model_node_data_changed ()
void | e_tree_model_node_inserted ()
void | e_tree_model_node_removed ()
void | e_tree_model_node_deleted ()

## Signals

void | node-changed | Run Last
void | node-data-changed | Run Last
void | node-deleted | Run Last
void | node-inserted | Run Last
void | node-removed | Run Last
void | pre-change | Run Last
void | rebuilt | Run Last

## Types and Values

typedef | ETreePath
struct | ETreeModelInterface

## Object Hierarchy

        GInterface
        ╰── ETreeModel

## Description

## Functions

### ETreePathFunc ()

    gboolean
    (*ETreePathFunc) (ETreeModel *tree_model,
                      ETreePath path,
                      gpointer data);

### e_tree_model_get_root ()

    ETreePath
    e_tree_model_get_root (ETreeModel *tree_model);

Accessor for the root node of `tree_model` .

return values: the ETreePath corresponding to the root node.

#### Parameters

tree_model | the ETreeModel of which we want the root node. |

### e_tree_model_node_get_parent ()

    ETreePath
    e_tree_model_node_get_parent (ETreeModel *tree_model,
                                  ETreePath path);

### e_tree_model_node_get_first_child ()

    ETreePath
    e_tree_model_node_get_first_child (ETreeModel *tree_model,
                                       ETreePath path);

### e_tree_model_node_get_next ()

    ETreePath
    e_tree_model_node_get_next (ETreeModel *tree_model,
                                ETreePath path);

### e_tree_model_node_is_root ()

    gboolean
    e_tree_model_node_is_root (ETreeModel *tree_model,
                               ETreePath path);

### e_tree_model_node_is_expandable ()

    gboolean
    e_tree_model_node_is_expandable (ETreeModel *tree_model,
                                     ETreePath path);

### e_tree_model_node_get_n_nodes ()

    guint
    e_tree_model_node_get_n_nodes (ETreeModel *tree_model);

### e_tree_model_node_get_n_children ()

    guint
    e_tree_model_node_get_n_children (ETreeModel *tree_model,
                                      ETreePath path);

### e_tree_model_node_depth ()

    guint
    e_tree_model_node_depth (ETreeModel *tree_model,
                             ETreePath path);

### e_tree_model_get_expanded_default ()

    gboolean
    e_tree_model_get_expanded_default (ETreeModel *tree_model);

XXX docs here.

return values: Whether nodes should be expanded by default.

#### Parameters

tree_model | The ETreeModel. |

### e_tree_model_column_count ()

    gint
    e_tree_model_column_count (ETreeModel *tree_model);

XXX docs here.

return values: The number of columns

#### Parameters

tree_model | The ETreeModel. |

### e_tree_model_get_save_id ()

    gchar *
    e_tree_model_get_save_id (ETreeModel *tree_model,
                              ETreePath path);

XXX docs here.

return values: The save id for this path.

#### Parameters

tree_model | The ETreeModel. |
path | The ETreePath. |

### e_tree_model_get_node_by_id ()

    ETreePath
    e_tree_model_get_node_by_id (ETreeModel *tree_model,
                                 const gchar *save_id);

get_node_by_id(get_save_id(node)) should be the original node. Likewise if get_node_by_id is not NULL, then get_save_id(get_node_by_id(string)) should be a copy of the original string.

return values: The path for this save id.

#### Parameters

tree_model | The ETreeModel. |

### e_tree_model_sort_value_at ()

    gpointer
    e_tree_model_sort_value_at (ETreeModel *tree_model,
                                ETreePath path,
                                gint col);

#### Parameters

tree_model | The ETreeModel. |
path | The ETreePath to the node we're getting the data from. |
col | the column to retrieve data from |

#### Returns

This function returns the value that is stored by the `tree_model` in column `col` and node `path` . 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.

### e_tree_model_value_at ()

    gpointer
    e_tree_model_value_at (ETreeModel *tree_model,
                           ETreePath path,
                           gint col);

#### Parameters

tree_model | The ETreeModel. |
path | The ETreePath to the node we're getting the data from. |
col | the column to retrieve data from |

#### Returns

This function returns the value that is stored by the `tree_model` in column `col` and node `path` . 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 ECell renderer.

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.

### e_tree_model_duplicate_value ()

    gpointer
    e_tree_model_duplicate_value (ETreeModel *tree_model,
                                  gint col,
                                  gconstpointer value);

### e_tree_model_free_value ()

    void
    e_tree_model_free_value (ETreeModel *tree_model,
                             gint col,
                             gpointer value);

### e_tree_model_initialize_value ()

    gpointer
    e_tree_model_initialize_value (ETreeModel *tree_model,
                                   gint col);

### e_tree_model_value_is_empty ()

    gboolean
    e_tree_model_value_is_empty (ETreeModel *tree_model,
                                 gint col,
                                 gconstpointer value);

### e_tree_model_value_to_string ()

    gchar *
    e_tree_model_value_to_string (ETreeModel *tree_model,
                                  gint col,
                                  gconstpointer value);

### e_tree_model_node_traverse ()

    void
    e_tree_model_node_traverse (ETreeModel *tree_model,
                                ETreePath path,
                                ETreePathFunc func,
                                gpointer data);

### e_tree_model_node_find ()

    ETreePath
    e_tree_model_node_find (ETreeModel *tree_model,
                            ETreePath path,
                            ETreePath end_path,
                            ETreePathFunc func,
                            gpointer data);

### e_tree_model_pre_change ()

    void
    e_tree_model_pre_change (ETreeModel *tree_model);

### e_tree_model_rebuilt ()

    void
    e_tree_model_rebuilt (ETreeModel *tree_model);

### e_tree_model_node_changed ()

    void
    e_tree_model_node_changed (ETreeModel *tree_model,
                               ETreePath path);

### e_tree_model_node_data_changed ()

    void
    e_tree_model_node_data_changed (ETreeModel *tree_model,
                                    ETreePath path);

### e_tree_model_node_inserted ()

    void
    e_tree_model_node_inserted (ETreeModel *tree_model,
                                ETreePath parent_path,
                                ETreePath inserted_path);

### e_tree_model_node_removed ()

    void
    e_tree_model_node_removed (ETreeModel *tree_model,
                               ETreePath parent_path,
                               ETreePath removed_path,
                               gint old_position);

### e_tree_model_node_deleted ()

    void
    e_tree_model_node_deleted (ETreeModel *tree_model,
                               ETreePath deleted_path);

## Types and Values

### ETreePath

    typedef gpointer ETreePath;

### struct ETreeModelInterface

    struct ETreeModelInterface {
    	GTypeInterface parent_interface;

    	ETreePath (*get_root)		(ETreeModel *tree_model);

    	ETreePath (*get_parent)		(ETreeModel *tree_model,
    						 ETreePath path);
    	ETreePath (*get_first_child) (ETreeModel *tree_model,
    						 ETreePath path);
    	ETreePath (*get_next)		(ETreeModel *tree_model,
    						 ETreePath path);

    	gboolean (*is_root)		(ETreeModel *tree_model,
    						 ETreePath path);
    	gboolean (*is_expandable) (ETreeModel *tree_model,
    						 ETreePath path);
    	guint		(*get_n_nodes)		(ETreeModel *tree_model);
    	guint		(*get_n_children) (ETreeModel *tree_model,
    						 ETreePath path);
    	guint		(*depth)		(ETreeModel *tree_model,
    						 ETreePath path);

    	gboolean (*get_expanded_default) (ETreeModel *tree_model);
    	gint		(*column_count)		(ETreeModel *tree_model);

    	gchar *		(*get_save_id)		(ETreeModel *tree_model,
    						 ETreePath path);

    	ETreePath (*get_node_by_id) (ETreeModel *tree_model,
    						 const gchar *save_id);

    	/*
    	 * ETable analogs
    	 */
    	gpointer (*sort_value_at) (ETreeModel *tree_model,
    						 ETreePath path,
    						 gint col);
    	gpointer (*value_at)		(ETreeModel *tree_model,
    						 ETreePath path,
    						 gint col);

    	gpointer (*duplicate_value) (ETreeModel *tree_model,
    						 gint col,
    						 gconstpointer value);
    	void		(*free_value)		(ETreeModel *tree_model,
    						 gint col,
    						 gpointer value);
    	gpointer (*initialize_value) (ETreeModel *tree_model,
    						 gint col);
    	gboolean (*value_is_empty) (ETreeModel *tree_model,
    						 gint col,
    						 gconstpointer value);
    	gchar *		(*value_to_string) (ETreeModel *tree_model,
    						 gint col,
    						 gconstpointer value);

    	/*
    	 * Signals
    	 */

    	/* During node_remove, the ETreePath of the child is removed
    	 * from the tree but is still a valid ETreePath.  At
    	 * node_deleted, the ETreePath is no longer valid.
    	 */

    	void		(*pre_change)		(ETreeModel *tree_model);
    	void		(*node_changed)		(ETreeModel *tree_model,
    						 ETreePath path);
    	void		(*node_data_changed) (ETreeModel *tree_model,
    						 ETreePath path);
    	void		(*node_inserted) (ETreeModel *tree_model,
    						 ETreePath parent,
    						 ETreePath inserted_path);
    	void		(*node_removed)		(ETreeModel *tree_model,
    						 ETreePath parent,
    						 ETreePath removed_path,
    						 gint old_position);
    	void		(*node_deleted)		(ETreeModel *tree_model,
    						 ETreePath deleted_path);
    	void		(*rebuilt)		(ETreeModel *tree_model);
    };

## Signal Details

### The `“node-changed”` signal

    void
    user_function (ETreeModel *etreemodel,
                   gpointer    arg1,
                   gpointer    user_data)

Flags: Run Last

### The `“node-data-changed”` signal

    void
    user_function (ETreeModel *etreemodel,
                   gpointer    arg1,
                   gpointer    user_data)

Flags: Run Last

### The `“node-deleted”` signal

    void
    user_function (ETreeModel *etreemodel,
                   gpointer    arg1,
                   gpointer    user_data)

Flags: Run Last

### The `“node-inserted”` signal

    void
    user_function (ETreeModel *etreemodel,
                   gpointer    arg1,
                   gpointer    arg2,
                   gpointer    user_data)

Flags: Run Last

### The `“node-removed”` signal

    void
    user_function (ETreeModel *etreemodel,
                   gpointer    arg1,
                   gpointer    arg2,
                   gint        arg3,
                   gpointer    user_data)

Flags: Run Last

### The `“pre-change”` signal

    void
    user_function (ETreeModel *etreemodel,
                   gpointer    user_data)

Flags: Run Last

### The `“rebuilt”` signal

    void
    user_function (ETreeModel *etreemodel,
                   gpointer    user_data)

Flags: Run Last