## GnomeDbDataStore GnomeDbDataStore — Implements the GtkTreeModel interface |

## Synopsis

                        GnomeDbDataStore;
                        GnomeDbDataStoreClass;
                        GnomeDbDataStorePriv;
    GtkTreeModel *      gnome_db_data_store_new             (GdaDataModel *model);
    gboolean            gnome_db_data_store_set_value       (GnomeDbDataStore *store,
                                                             GtkTreeIter *iter,
                                                             gint col,
                                                             const GValue *value);
    void                gnome_db_data_store_delete          (GnomeDbDataStore *store,
                                                             GtkTreeIter *iter);
    void                gnome_db_data_store_undelete        (GnomeDbDataStore *store,
                                                             GtkTreeIter *iter);
    gboolean            gnome_db_data_store_append          (GnomeDbDataStore *store,
                                                             GtkTreeIter *iter);
    GdaDataProxy *      gnome_db_data_store_get_proxy       (GnomeDbDataStore *store);
    gint                gnome_db_data_store_get_row_from_iter
                                                            (GnomeDbDataStore *store,
                                                             GtkTreeIter *iter);
    gboolean            gnome_db_data_store_get_iter_from_values
                                                            (GnomeDbDataStore *store,
                                                             GtkTreeIter *iter,
                                                             GSList *values,
                                                             gint *cols_index);

## Object Hierarchy

      GObject
       +----GnomeDbDataStore

## Implemented Interfaces

GnomeDbDataStore implements GtkTreeModel.

## Properties

      "model"                    gpointer              : Read / Write / Construct Only
      "prepend-null-entry"       gboolean              : Read / Write
      "proxy"                    gpointer              : Read

## Description

This object implements the GtkTreeModel interface, to make it easy to display a GdaDataModel in a GtkTreeView widget. Internally a GdaDataProxy is used so it is possible to adjust the range of displayed data using that object.

Specifically, for a GdaDataModel object containing `nb_cols` columns,the GnomeDbDataStore object provides the following columns, for a given row:

- negative column number DATA_STORE_COL_MODEL_N_COLUMNS: always contains `nb_cols`

- negative column number DATA_STORE_COL_MODEL_POINTER: always contains a pointer to the GdaDataModel

- negative column number DATA_STORE_COL_MODEL_ROW: contains the GdaDataModel's row number (-1 if the row has been added and is not yet present in the data model)

- negative column number DATA_STORE_COL_MODIFIED: contains TRUE if the row has been modified in the proxy

- negative column number DATA_STORE_COL_TO_DELETE: contains TRUE if the row has been marked to be removed in the proxy

- column such as 0 <= `column` < `nb_cols`: contains the current value in the proxy

- column such as `nb_cols` <= `column` < 2*`nb_cols`: contains the value in the GdaDataModel at column `column`-`nb_cols` (which may be different than the one in the proxy)

## Details

### GnomeDbDataStore

    typedef struct _GnomeDbDataStore GnomeDbDataStore;

### GnomeDbDataStoreClass

    typedef struct {
    	GObjectClass           parent_class;
    } GnomeDbDataStoreClass;

### GnomeDbDataStorePriv

    typedef struct _GnomeDbDataStorePriv GnomeDbDataStorePriv;

### gnome_db_data_store_new ()

    GtkTreeModel *      gnome_db_data_store_new             (GdaDataModel *model);

Creates a GtkTreeModel interface with a GdaDataModel

`model` : | a GdaDataModel object
Returns : | the new object

### gnome_db_data_store_set_value ()

    gboolean            gnome_db_data_store_set_value       (GnomeDbDataStore *store,
                                                             GtkTreeIter *iter,
                                                             gint col,
                                                             const GValue *value);

Stores a value in the `store` data model.

`store` : | a GnomeDbDataStore object
`iter` : | the considered row
`col` : |
`value` : | the value to store (gets copied)
Returns : | TRUE on succes

### gnome_db_data_store_delete ()

    void                gnome_db_data_store_delete          (GnomeDbDataStore *store,
                                                             GtkTreeIter *iter);

Marks the row pointed by `iter` to be deleted

`store` : | a GnomeDbDataStore object
`iter` : | the considered row

### gnome_db_data_store_undelete ()

    void                gnome_db_data_store_undelete        (GnomeDbDataStore *store,
                                                             GtkTreeIter *iter);

Remove the "to be deleted" mark the row pointed by `iter`, if it existed.

`store` : | a GnomeDbDataStore object
`iter` : | the considered row

### gnome_db_data_store_append ()

    gboolean            gnome_db_data_store_append          (GnomeDbDataStore *store,
                                                             GtkTreeIter *iter);

Appends a new row.

`store` : | a GnomeDbDataStore object
`iter` : | an unset GtkTreeIter to set to the appended row
Returns : | TRUE if no error occurred

### gnome_db_data_store_get_proxy ()

    GdaDataProxy *      gnome_db_data_store_get_proxy       (GnomeDbDataStore *store);

`store` : | a GnomeDbDataStore object
Returns : | the internal GdaDataProxy being used by `store`

### gnome_db_data_store_get_row_from_iter ()

    gint                gnome_db_data_store_get_row_from_iter
                                                            (GnomeDbDataStore *store,
                                                             GtkTreeIter *iter);

Get the number of the row represented by `iter`

`store` : | a GnomeDbDataStore object
`iter` : | a valid GtkTreeIter
Returns : | the row number, or -1 if an error occurred

### gnome_db_data_store_get_iter_from_values ()

    gboolean            gnome_db_data_store_get_iter_from_values
                                                            (GnomeDbDataStore *store,
                                                             GtkTreeIter *iter,
                                                             GSList *values,
                                                             gint *cols_index);

Sets `iter` to the first row where all the values in `values` at the columns identified at `cols_index` match. If the row can't be identified, then the contents of `iter` is not modified.

NOTE: the `cols_index` array MUST contain a column index for each value in `values`

`store` : | a GnomeDbDataStore object
`iter` : | an unset GtkTreeIter to set to the requested row
`values` : | a list of GValue values
`cols_index` : | an array of gint containing the column number to match each value of `values`
Returns : | TRUE if the row has been identified `iter` was set

## Property Details

### The `"model"` property

      "model"                    gpointer              : Read / Write / Construct Only

### The `"prepend-null-entry"` property

      "prepend-null-entry"       gboolean              : Read / Write

Default value: FALSE

### The `"proxy"` property

      "proxy"                    gpointer              : Read