GdaTreeManager

GdaTreeManager — Base class for all the tree managers

Synopsis

                    GdaTreeManager;
GSList*             gda_tree_manager_update_children    (GdaTreeManager *manager,
                                                         GdaTreeNode *node,
                                                         const GSList *children_nodes,
                                                         gboolean *out_error,
                                                         GError **error);
void                gda_tree_manager_add_manager        (GdaTreeManager *manager,
                                                         GdaTreeManager *sub);
GdaTreeNode*        (*GdaTreeManagerNodeFunc)           (GdaTreeManager *manager,
                                                         GdaTreeNode *parent);
void                gda_tree_manager_set_node_create_func
                                                        (GdaTreeManager *mgr,
                                                         GdaTreeManagerNodeFunc func);
GdaTreeManagerNodeFunc gda_tree_manager_get_node_create_func
                                                        (GdaTreeManager *mgr);

Object Hierarchy

  GObject
   +----GdaTreeManager
         +----GdaTreeMgrColumns
         +----GdaTreeMgrLabel
         +----GdaTreeMgrSchemas
         +----GdaTreeMgrSelect
         +----GdaTreeMgrTables

Properties

  "recursive"                gboolean              : Read / Write / Construct

Description

A GdaTreeManager object is responsible for creating nodes in the tree(s) for which it operates.

When creating nodes, a GdaTreeManager object can (depending on its implementation), get some named attributes from the node below which it has to create nodes, using the gda_tree_node_fetch_attribute() or gda_tree_node_get_node_attribute(). For example the GdaTreeMgrColumns manager (which creates a node for each column of a table) needs the table name and the schema in which the table is; both can be specified using an object's property, or, if not specified that way, are fetched as attributes.

The GdaTreeManager itself is an abstract type (which can't be instanciated). Use an existing sub class or subclass it yourself.

Details

GdaTreeManager

typedef struct _GdaTreeManager GdaTreeManager;


gda_tree_manager_update_children ()

GSList*             gda_tree_manager_update_children    (GdaTreeManager *manager,
                                                         GdaTreeNode *node,
                                                         const GSList *children_nodes,
                                                         gboolean *out_error,
                                                         GError **error);

Creates (or updates) the list of GdaTreeNode objects which are placed as children of node. The returned list will completely replace the existing list of nodes managed ny manager (as children of node).

If a node is already present in children_nodes and needs to be kept in the new list, then it should be added to the returned list and its reference count should be increased by one.

manager :

a GdaTreeManager object

node :

a GdaTreeNode object, or NULL

children_nodes :

a list of GdaTreeNode nodes which have previously been created by a similar call and need to be updated ore moved

out_error :

a boolean to store if there was an error (can be NULL)

error :

a place to store errors, or NULL

Returns :

a new list of GdaTreeNode objects.

Since 4.2


gda_tree_manager_add_manager ()

void                gda_tree_manager_add_manager        (GdaTreeManager *manager,
                                                         GdaTreeManager *sub);

Adds a sub manager to manager. Use this method to create the skeleton structure of a GdaTree. Note that a single GdaTreeManager can be used by several GdaTree objects or several times in the same GdaTree's structure.

manager :

a GdaTreeManager object

sub :

a GdaTreeManager object to add

Since 4.2


GdaTreeManagerNodeFunc ()

GdaTreeNode*        (*GdaTreeManagerNodeFunc)           (GdaTreeManager *manager,
                                                         GdaTreeNode *parent);

Function which creates a GdaTreeNode below parent, using manager.

manager :

the GdaTreeManager which requests a node to be created

parent :

the GdaTreeNode below which the new node will be placed

Returns :

a new GdaTreeNode object (or a subclassed object)

gda_tree_manager_set_node_create_func ()

void                gda_tree_manager_set_node_create_func
                                                        (GdaTreeManager *mgr,
                                                         GdaTreeManagerNodeFunc func);

Sets the function to be called when a new node is being created by mgr. If func is NULL then each created node will be a GdaTreeNode object.

Specifying a custom GdaTreeManagerNodeFunc function for example allows one to use specialized sub-classed GdaTreeNode objects.

mgr :

a GdaTreeManager tree manager object

func :

a GdaTreeManagerNodeFunc function pointer, or NULL

Since 4.2


gda_tree_manager_get_node_create_func ()

GdaTreeManagerNodeFunc gda_tree_manager_get_node_create_func
                                                        (GdaTreeManager *mgr);

Get the function used by mgr when creating new GdaTreeNode nodes

mgr :

a GdaTreeManager tree manager object

Returns :

the GdaTreeManagerNodeFunc function, or NULL if the default function is used

Since 4.2

Property Details

The "recursive" property

  "recursive"                gboolean              : Read / Write / Construct

This property specifies if, when initially creating nodes or updating the list of nodes, the tree manager shoud also request that each node it has created or updated also initially create or update their children.

This property can typically set to FALSE if the process of creating children nodes is lenghty and needs to be postponed while an event occurs.

Default value: TRUE