![]() |
![]() |
![]() |
GNOME Data Access 4 manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
GdaTreeNodeGdaTreeNode — a node in a GdaTree |
GdaTreeNode; GdaTreeNode* gda_tree_node_new (const gchar *name); GdaTreeNode * gda_tree_node_get_parent (GdaTreeNode *node); GSList * gda_tree_node_get_children (GdaTreeNode *node); GdaTreeNode * gda_tree_node_get_child_index (GdaTreeNode *node, gint index); GdaTreeNode * gda_tree_node_get_child_name (GdaTreeNode *node, const gchar *name); void gda_tree_node_set_node_attribute (GdaTreeNode *node, const gchar *attribute, const GValue *value, GDestroyNotify destroy); const GValue * gda_tree_node_get_node_attribute (GdaTreeNode *node, const gchar *attribute); const GValue * gda_tree_node_fetch_attribute (GdaTreeNode *node, const gchar *attribute);
"node-changed" : Run Last "node-deleted" : Run Last "node-has-child-toggled" : Run Last "node-inserted" : Run Last
Every node in a GdaTree tree is represented by a single GdaTreeNode object. There is no distinction between nodes which have children and those which don't (leaf nodes).
The GdaTreeNode is very basic as it only has a "name" attribute: users are encouraged to subclass it to
add more features if needed (and make use of them by defining a GdaTreeManagerNodeFunc function and
calling gda_tree_manager_set_node_create_func()
).
GdaTreeNode* gda_tree_node_new (const gchar *name);
Creates a new GdaTreeNode object
|
a name, or NULL
|
Returns : |
a new GdaTreeNode |
Since 4.2
GdaTreeNode * gda_tree_node_get_parent (GdaTreeNode *node);
Get the GdaTreeNode parent of node
in the GdaTree node belongs to. If node
is at the top level,
then this method return NULL
.
|
a GdaTreeNode object |
Returns : |
the parent GdaTreeNode |
Since 4.2
GSList * gda_tree_node_get_children (GdaTreeNode *node);
Get a list of all node
's children, free it with g_slist_free()
after usage
|
a GdaTreeNode object |
Returns : |
a new GSList of GdaTreeNode objects, or NULL if node does not have any child
|
Since 4.2
GdaTreeNode * gda_tree_node_get_child_index (GdaTreeNode *node, gint index);
Get the GdaTreeNode child of node
at position index
(starting at 0).
|
a GdaTreeNode object |
|
a index |
Returns : |
the GdaTreeNode, or NULL if not found
|
Since 4.2
GdaTreeNode * gda_tree_node_get_child_name (GdaTreeNode *node, const gchar *name);
Get the GdaTreeNode child of node
which has the GDA_ATTRIBUTE_NAME set to name
|
a GdaTreeNode object |
|
requested node's name |
Returns : |
the GdaTreeNode, or NULL if not found
|
Since 4.2
void gda_tree_node_set_node_attribute (GdaTreeNode *node, const gchar *attribute, const GValue *value, GDestroyNotify destroy);
Set the value associated to a named attribute. The attribute
string is 'stolen' by this method, and
the memory it uses will be freed using the destroy
function when no longer needed (if destroy
is NULL
,
then the string will not be freed at all).
Attributes can have any name, but Libgda proposes some default names, see this section.
For example one would use it as:
gda_tree_node_set_node_attribute (node, g_strdup (my_attribute), g_free, my_value);
gda_tree_node_set_node_attribute (node, GDA_ATTRIBUTE_NAME, NULL, my_value);
If there is already an attribute named attribute
set, then its value is replaced with the new value (value
is
copied), except if value
is NULL
, in which case the attribute is removed.
|
a GdaTreeNode |
|
attribute name |
|
a GValue, or NULL
|
|
a function to be called when attribute is not needed anymore, or NULL
|
Since 4.2
const GValue * gda_tree_node_get_node_attribute (GdaTreeNode *node, const gchar *attribute);
Get the value associated to the attribute named attribute
for node
. The difference with gda_tree_node_fetch_attribute()
is that gda_tree_node_fetch_attribute()
will also query node
's parents (recursively up to the top level node) if
the attribute is not set for node
.
Attributes can have any name, but Libgda proposes some default names, see this section.
|
a GdaTreeNode |
|
attribute name as a string |
Returns : |
a read-only GValue, or NULL if not attribute named attribute has been set for node
|
Since 4.2
const GValue * gda_tree_node_fetch_attribute (GdaTreeNode *node, const gchar *attribute);
Get the value associated to the attribute named attribute
for node
. If the attribute is not set,
then node
's parents is queries (recursively up to the top level node).
Attributes can have any name, but Libgda proposes some default names, see this section.
|
a GdaTreeNode |
|
attribute name as a string |
Returns : |
a read-only GValue, or NULL if not attribute named attribute has been set for node
|
Since 4.2
"node-changed"
signalvoid user_function (GdaTreeNode *reporting, GdaTreeNode *node, gpointer user_data) : Run Last
Gets emitted when a node
has changed
|
the GdaTreeNode which emits the signal (may be a parent of node , or node itself)
|
|
the GdaTreeNode which has changed |
|
user data set when the signal handler was connected. |
Since 4.2
"node-deleted"
signalvoid user_function (GdaTreeNode *reporting, gchar *relative_path, gpointer user_data) : Run Last
Gets emitted when a node
has been removed
|
the GdaTreeNode which emits the signal (a parent of the removed node) |
|
the path the node held, relative to reporting
|
|
user data set when the signal handler was connected. |
Since 4.2
"node-has-child-toggled"
signalvoid user_function (GdaTreeNode *reporting, GdaTreeNode *node, gpointer user_data) : Run Last
Gets emitted when a node
has has a child when it did not have any or when it
does not have a ny children anymore when it had some
|
the GdaTreeNode which emits the signal (may be a parent of node , or node itself)
|
|
the GdaTreeNode which changed from having children to being a leaf or the other way around |
|
user data set when the signal handler was connected. |
Since 4.2
"node-inserted"
signalvoid user_function (GdaTreeNode *reporting, GdaTreeNode *node, gpointer user_data) : Run Last
Gets emitted when a node
has been inserted
|
the GdaTreeNode which emits the signal (may be a parent of node , or node itself)
|
|
the GdaTreeNode which has been inserted |
|
user data set when the signal handler was connected. |
Since 4.2