GNOME Data Access 5 manual: GdauiTreeStore

## GdauiTreeStore GdauiTreeStore — Bridge between a GdaTree and a GtkTreeModel |

## Stability Level

Stable, unless otherwise indicated

## Functions

GtkTreeModel * | gdaui_tree_store_new ()
GtkTreeModel * | gdaui_tree_store_newv ()
GdaTreeNode * | gdaui_tree_store_get_node ()
gboolean | gdaui_tree_store_get_iter ()

## Properties

GdaTree * | tree | Read / Write / Construct Only

## Signals

gboolean | drag-can-drag | Run Last
gboolean | drag-can-drop | Run Last
gboolean | drag-delete | Run Last
gboolean | drag-drop | Run Last
gboolean | drag-get | Run Last

## Types and Values

struct | GdauiTreeStore

## Object Hierarchy

        GObject
        ╰── GdauiTreeStore

## Implemented Interfaces

GdauiTreeStore implements GtkTreeModel, GtkTreeDragSource and GtkTreeDragDest.

## Description

The GdauiTreeStore implements the GtkTreeModel interface required to display data from a GdaTree in a GtkTreeView widget.

To allow a tree to be populated only on request (ie. when the user expands a row), each GdaTreeNode can give the attribute named GDA_ATTRIBUTE_TREE_NODE_UNKNOWN_CHILDREN a boolean `TRUE` GValue to tell the GdauiTreeStore data model to artificially add a dummy child for the row corresponding to the GdaTreeNode. Then the programmer can connect to the GtkTreeView::test-expand-row signal and update the requested children.

## Functions

### gdaui_tree_store_new ()

    GtkTreeModel *
    gdaui_tree_store_new (GdaTree *tree,
                          guint n_columns,
                          ...);

Creates a GtkTreeModel interface with a GdaTree, mapping columns to attributes' values.

As an example, `gdaui_tree_store_new (tree, 2, G_TYPE_STRING, "name", G_TYPE_STRING, "schema");` creates a GtkTreeStore with two columns (of type G_TYPE_STRING), one with the values of the "name" attribute, and one with the values of the "schema" attribute.

Note that the GType has to correspond to the type of value associated with the attribute name (no type conversion is done), and a warning will be displayed in case of type mismatch.

#### Parameters

tree | a GdaTree object |
n_columns | number of columns in the tree store |
... | couples of (GType, attribute name) for each column, from first to last |

#### Returns

the new object, or `NULL` if an attribute's name was NULL or an empty string

Since 4.2

### gdaui_tree_store_newv ()

    GtkTreeModel *
    gdaui_tree_store_newv (GdaTree *tree,
                           guint n_columns,
                           GType *types,
                           const gchar **attribute_names);

Creates a GtkTreeModel interface with a GdaTree, mapping columns to attributes' values. For more information and limitations, see `gdaui_tree_store_new()`.

#### Parameters

tree | a GdaTree object |
n_columns | number of columns in the tree store |
types | an array of `n_columns` GType to specify the type of each column |
attribute_names | an array of `n_columns` strings to specify the attribute name to map each column on |

#### Returns

the new object, or `NULL` if an inconsistency exists in the parameters.

[transfer full]

Since 4.2

### gdaui_tree_store_get_node ()

    GdaTreeNode *
    gdaui_tree_store_get_node (GdauiTreeStore *store,
                               GtkTreeIter *iter);

Get the GdaTreeNode represented by `iter` .

#### Parameters

store | a GdauiTreeStore object |
iter | a valid GtkTreeIter |

#### Returns

the GdaTreeNode represented by `iter` , or `NULL` if an error occurred.

[transfer none]

Since 4.2.8

### gdaui_tree_store_get_iter ()

    gboolean
    gdaui_tree_store_get_iter (GdauiTreeStore *store,
                               GtkTreeIter *iter,
                               GdaTreeNode *node);

`gdaui_tree_store_get_iter` has been deprecated since version 5.2 and should not be used in newly-written code.

Sets `iter` to represent `node` in the tree.

#### Parameters

store | a GdauiTreeStore object |
iter | a pointer to a GtkTreeIter |
node | a GdaTreeNode in `store` |

#### Returns

`TRUE` if no error occurred and `iter` is valid

Since 4.2.8

## Types and Values

### struct GdauiTreeStore

    struct GdauiTreeStore;

## Property Details

### The `“tree”` property

      “tree”                     GdaTree *

Flags: Read / Write / Construct Only

## Signal Details

### The `“drag-can-drag”` signal

    gboolean
    user_function (GdauiTreeStore *gdauitreestore,
                   gchar          *arg1,
                   gpointer        user_data)

Flags: Run Last

### The `“drag-can-drop”` signal

    gboolean
    user_function (GdauiTreeStore *gdauitreestore,
                   gchar          *arg1,
                   gpointer        arg2,
                   gpointer        user_data)

Flags: Run Last

### The `“drag-delete”` signal

    gboolean
    user_function (GdauiTreeStore *gdauitreestore,
                   gchar          *arg1,
                   gpointer        user_data)

Flags: Run Last

### The `“drag-drop”` signal

    gboolean
    user_function (GdauiTreeStore *gdauitreestore,
                   gchar          *arg1,
                   gpointer        arg2,
                   gpointer        user_data)

Flags: Run Last

### The `“drag-get”` signal

    gboolean
    user_function (GdauiTreeStore *gdauitreestore,
                   gchar          *arg1,
                   gpointer        arg2,
                   gpointer        user_data)

Flags: Run Last

## See Also

GdaTree