DeeModel

DeeModel — A generic table model interface

Synopsis

#include <dee.h>

                    DeeModelIface;
                    DeeModel;
                    DeeModelIter;
void                dee_model_set_schema                (DeeModel *self,
                                                         ...);
void                dee_model_set_schema_valist         (DeeModel *self,
                                                         va_list *args);
void                dee_model_set_schema_full           (DeeModel *self,
                                                         const gchar * const *column_schemas,
                                                         guint num_columns);
const gchar* const* dee_model_get_schema                (DeeModel *self,
                                                         guint *num_columns);
const gchar*        dee_model_get_column_schema         (DeeModel *self,
                                                         guint column);
guint               dee_model_get_n_columns             (DeeModel *self);
guint               dee_model_get_n_rows                (DeeModel *self);
DeeModelIter*       dee_model_append                    (DeeModel *self,
                                                         ...);
DeeModelIter*       dee_model_append_valist             (DeeModel *self,
                                                         va_list *args);
DeeModelIter*       dee_model_append_row                (DeeModel *self,
                                                         GVariant **row_members);
DeeModelIter*       dee_model_prepend                   (DeeModel *self,
                                                         ...);
DeeModelIter*       dee_model_prepend_valist            (DeeModel *self,
                                                         va_list *args);
DeeModelIter*       dee_model_prepend_row               (DeeModel *self,
                                                         GVariant **row_members);
DeeModelIter*       dee_model_insert                    (DeeModel *self,
                                                         guint pos,
                                                         ...);
DeeModelIter*       dee_model_insert_valist             (DeeModel *self,
                                                         guint pos,
                                                         va_list *args);
DeeModelIter*       dee_model_insert_row                (DeeModel *self,
                                                         guint pos,
                                                         GVariant **row_members);
DeeModelIter*       dee_model_insert_before             (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         ...);
DeeModelIter*       dee_model_insert_before_valist      (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         va_list *args);
DeeModelIter*       dee_model_insert_row_before         (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         GVariant **row_members);
void                dee_model_remove                    (DeeModel *self,
                                                         DeeModelIter *iter);
void                dee_model_clear                     (DeeModel *self);
void                dee_model_set                       (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         ...);
void                dee_model_set_valist                (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         va_list *args);
void                dee_model_set_value                 (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column,
                                                         GVariant *value);
void                dee_model_set_row                   (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         GVariant **row_members);
void                dee_model_get                       (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         ...);
void                dee_model_get_valist                (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         va_list args);
GVariant**          dee_model_get_row                   (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         GVariant **out_row_members);
GVariant*           dee_model_get_value                 (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);
DeeModelIter*       dee_model_get_first_iter            (DeeModel *self);
DeeModelIter*       dee_model_get_last_iter             (DeeModel *self);
DeeModelIter*       dee_model_get_iter_at_row           (DeeModel *self,
                                                         guint row);
gboolean            dee_model_get_bool                  (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);
guchar              dee_model_get_uchar                 (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);
gint32              dee_model_get_int32                 (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);
guint32             dee_model_get_uint32                (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);
gint64              dee_model_get_int64                 (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);
guint64             dee_model_get_uint64                (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);
gdouble             dee_model_get_double                (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);
const gchar *       dee_model_get_string                (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);
DeeModelIter *      dee_model_next                      (DeeModel *self,
                                                         DeeModelIter *iter);
DeeModelIter *      dee_model_prev                      (DeeModel *self,
                                                         DeeModelIter *iter);
gboolean            dee_model_is_first                  (DeeModel *self,
                                                         DeeModelIter *iter);
gboolean            dee_model_is_last                   (DeeModel *self,
                                                         DeeModelIter *iter);
guint               dee_model_get_position              (DeeModel *self,
                                                         DeeModelIter *iter);
void                dee_model_freeze_signals            (DeeModel *self);
void                dee_model_thaw_signals              (DeeModel *self);
GVariant**          dee_model_build_row                 (DeeModel *self,
                                                         GVariant **out_row_members,
                                                         ...);
GVariant**          dee_model_build_row_valist          (DeeModel *self,
                                                         GVariant **out_row_members,
                                                         va_list *args);

Object Hierarchy

  GInterface
   +----DeeModel

Prerequisites

DeeModel requires GObject.

Known Implementations

DeeModel is implemented by DeeFilterModel, DeeProxyModel, DeeSequenceModel, DeeSharedModel and DeeVersionedModel.

Signals

  "row-added"                                      : Run Last
  "row-changed"                                    : Run Last
  "row-removed"                                    : Run Last

Description

DeeModel is a generic table model that can hold most GLib Types as column types.

Almost all DeeModel implementations require you to set the schema with one the methods in the same family as dee_model_set_schema().

Details

DeeModelIface

typedef struct {
  GTypeInterface g_iface;

  /* Signals */
  void           (*row_added)       (DeeModel     *self,
                                     DeeModelIter *iter);

  void           (*row_removed)     (DeeModel     *self,
                                     DeeModelIter *iter);

  void           (*row_changed)     (DeeModel     *self,
                                     DeeModelIter *iter);

  void            (*set_schema_full)    (DeeModel          *self,
                                         const char* const *column_schemas,
                                         guint              num_columns);

  const gchar* const* (*get_schema)     (DeeModel     *self,
                                         guint        *num_columns);

  const gchar*   (*get_column_schema)   (DeeModel     *self,
                                         guint         column);
  
  guint          (*get_n_columns)   (DeeModel *self);

  guint          (*get_n_rows)      (DeeModel *self);

  DeeModelIter*  (*append_row)    (DeeModel  *self,
                                   GVariant **row_members);

  DeeModelIter*  (*prepend_row)   (DeeModel  *self,
                                   GVariant **row_members);

  DeeModelIter*  (*insert_row)    (DeeModel  *self,
                                   guint      pos,
                                   GVariant **row_members);

  DeeModelIter*  (*insert_row_before) (DeeModel      *self,
                                       DeeModelIter  *iter,
                                       GVariant     **row_members);

  void           (*remove)          (DeeModel     *self,
                                     DeeModelIter *iter);

  void           (*clear)           (DeeModel *self);

  void           (*set_value)       (DeeModel       *self,
                                     DeeModelIter   *iter,
                                     guint           column,
                                     GVariant       *value);
  
  void           (*set_row)         (DeeModel       *self,
                                     DeeModelIter   *iter,
                                     GVariant      **row_members);

  GVariant*      (*get_value)       (DeeModel     *self,
                                     DeeModelIter *iter,
                                     guint         column);
  
  DeeModelIter* (*get_first_iter)  (DeeModel     *self);

  DeeModelIter* (*get_last_iter)   (DeeModel     *self);

  DeeModelIter* (*get_iter_at_row) (DeeModel     *self,
                                    guint          row);

  gboolean       (*get_bool)        (DeeModel     *self,
                                     DeeModelIter *iter,
                                     guint         column);

  guchar         (*get_uchar)       (DeeModel     *self,
                                     DeeModelIter *iter,
                                     guint         column);

  gint32         (*get_int32)       (DeeModel     *self,
                                     DeeModelIter *iter,
                                     guint         column);

  guint32        (*get_uint32)      (DeeModel     *self,
                                     DeeModelIter *iter,
                                     guint         column);

  gint64         (*get_int64)       (DeeModel     *self,
                                     DeeModelIter *iter,
                                     guint         column);

  guint64        (*get_uint64)      (DeeModel     *self,
                                     DeeModelIter *iter,
                                     guint         column);

  gdouble        (*get_double)      (DeeModel     *self,
                                     DeeModelIter *iter,
                                     guint         column);

  const gchar*   (*get_string)      (DeeModel     *self,
                                     DeeModelIter *iter,
                                     guint         column);

  DeeModelIter*  (*next)            (DeeModel     *self,
                                     DeeModelIter *iter);

  DeeModelIter*  (*prev)            (DeeModel     *self,
                                     DeeModelIter *iter);

  gboolean       (*is_first)        (DeeModel     *self,
                                     DeeModelIter *iter);

  gboolean       (*is_last)         (DeeModel     *self,
                                     DeeModelIter *iter);

  guint          (*get_position)    (DeeModel     *self,
                                     DeeModelIter *iter);

  void           (*freeze_signals)  (DeeModel     *self);
  
  void           (*thaw_signals)    (DeeModel     *self);
} DeeModelIface;


DeeModel

typedef struct _DeeModel DeeModel;


DeeModelIter

typedef struct _DeeModelIter DeeModelIter;

The DeeModelIter structure is private and should only be used with the provided DeeModel API. It is owned by DeeModel and should not be freed.


dee_model_set_schema ()

void                dee_model_set_schema                (DeeModel *self,
                                                         ...);

Set the GVariant types and the number of columns used by self. This method must be called exactly once before using self. Note that some constructors will do this for you.

To create a model with three columns; a 32 bit integer, a string, and lastly an array of strings, you would do:

 DeeModel *model;
 model = dee_sequence_model_new ();
 dee_model_set_schema (model, "i", "s", "as", NULL);

self :

The DeeModel to set the column layout for

... :

A list of GVariant type strings terminated by a NULL

dee_model_set_schema_valist ()

void                dee_model_set_schema_valist         (DeeModel *self,
                                                         va_list *args);

Like dee_model_set_schema() but for language bindings.

self :

The DeeModel to change

args :


dee_model_set_schema_full ()

void                dee_model_set_schema_full           (DeeModel *self,
                                                         const gchar * const *column_schemas,
                                                         guint num_columns);

Set the GVariant types and the number of columns used by self. This method must be called exactly once before using self. Note that some constructors will do this for you.

self :

The DeeModel to set the column layout for

column_schemas :

A list of GVariant type strings terminated by a NULL. [array length=num_columns zero-terminated=1][element-type utf8][transfer none utf8]

num_columns :

an integer specifying the array length for VarArgs

dee_model_get_schema ()

const gchar* const* dee_model_get_schema                (DeeModel *self,
                                                         guint *num_columns);

Get a NULL-terminated array of GVariant type strings that defines the required formats for the columns of self.

self :

The DeeModel to get the the schema for

num_columns :

Address of an integer in which to store the number of columns in self. Or NULL to ignore the array length. [out][allow-none]

Returns :

A NULL-terminated array of GVariant type strings. The length of the returned array is written to num_columns. The returned array should not be freed or modified. It is owned by the model. [array][element-type utf8][transfer none utf8]

dee_model_get_column_schema ()

const gchar*        dee_model_get_column_schema         (DeeModel *self,
                                                         guint column);

Get the GVariant signature of a column

self :

a DeeModel

column :

the column to get retrieve the GVariant type string of

Returns :

the GVariant signature of the column at index column

dee_model_get_n_columns ()

guint               dee_model_get_n_columns             (DeeModel *self);

Gets the number of columns in self

self :

a DeeModel

Returns :

the number of columns per row in self

dee_model_get_n_rows ()

guint               dee_model_get_n_rows                (DeeModel *self);

Gets the number of rows in self

self :

a DeeModel

Returns :

the number of rows in self

dee_model_append ()

DeeModelIter*       dee_model_append                    (DeeModel *self,
                                                         ...);

Creates and appends a new row to the end of a DeeModel, setting the row values upon creation.

For and example see dee_model_insert_before().

self :

a DeeModel

... :

A list of values matching the column schemas of self. Any basic variant type is passed as the standard C type while any other type must be boxed in a GVariant. Any floating references will be consumed. A NULL value for a string type column will be converted to the empty string.

Returns :

A DeeModelIter pointing to the new row. [transfer none]

dee_model_append_valist ()

DeeModelIter*       dee_model_append_valist             (DeeModel *self,
                                                         va_list *args);

self :

args :

Returns :


dee_model_append_row ()

DeeModelIter*       dee_model_append_row                (DeeModel *self,
                                                         GVariant **row_members);

Like dee_model_append() but intended for language bindings or situations where you work with models on a meta level and may not have a prior knowledge of the column schemas of the models. See also dee_model_build_row().

self :

The model to prepend a row to

row_members :

An array of GVariants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed. [array zero-terminated=1]

Returns :

A DeeModelIter pointing to the new row. [transfer none]

dee_model_prepend ()

DeeModelIter*       dee_model_prepend                   (DeeModel *self,
                                                         ...);

Creates and prepends a new row to the beginning of a DeeModel, setting the row values upon creation.

self :

a DeeModel

... :

A list of values matching the column schemas of self. Any basic variant type is passed as the standard C type while any other type must be boxed in a GVariant. Any floating references will be consumed. A NULL value for a string type column will be converted to the empty string.

Returns :

A DeeModelIter pointing to the new row Example:
 DeeModel *model;
 model = ...
 dee_model_set_schema (model, "i", "s", NULL);
 dee_model_prepend (model, 10, "Rooney");
. [transfer none]

dee_model_prepend_valist ()

DeeModelIter*       dee_model_prepend_valist            (DeeModel *self,
                                                         va_list *args);

self :

args :

Returns :


dee_model_prepend_row ()

DeeModelIter*       dee_model_prepend_row               (DeeModel *self,
                                                         GVariant **row_members);

Like dee_model_prepend() but intended for language bindings or situations where you work with models on a meta level and may not have a priori knowledge of the column schemas of the models. See also dee_model_build_row().

self :

The model to prepend a row to

row_members :

An array of GVariants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed. [array zero-terminated=1]

Returns :

A DeeModelIter pointing to the new row. [transfer none]

dee_model_insert ()

DeeModelIter*       dee_model_insert                    (DeeModel *self,
                                                         guint pos,
                                                         ...);

Creates and inserts a new row into a DeeModel, pushing the existing rows down.

For and example see dee_model_insert_before().

self :

a DeeModel

pos :

The index to insert the row on. The existing row will be pushed down

... :

A list of values matching the column schemas of self. Any basic variant type is passed as the standard C type while any other type must be boxed in a GVariant. Any floating references will be consumed. A NULL value for a string type column will be converted to the empty string.

Returns :

A DeeModelIter pointing to the new row. [transfer none]

dee_model_insert_valist ()

DeeModelIter*       dee_model_insert_valist             (DeeModel *self,
                                                         guint pos,
                                                         va_list *args);

self :

pos :

args :

Returns :


dee_model_insert_row ()

DeeModelIter*       dee_model_insert_row                (DeeModel *self,
                                                         guint pos,
                                                         GVariant **row_members);

As dee_model_insert(), but intended for language bindings or situations where you work with models on a meta level and may not have a priori knowledge of the column schemas of the models. See also dee_model_build_row().

self :

a DeeModel

pos :

The index to insert the row on. The existing row will be pushed down.

row_members :

An array of GVariants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed. [array zero-terminated]

Returns :

A DeeModelIter pointing to the new row. [transfer none]

dee_model_insert_before ()

DeeModelIter*       dee_model_insert_before             (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         ...);

Creates and inserts a new row into a DeeModel just before the row pointed to by iter.

For example, to insert a new row in a model with schema ("u", "s", "as") you would do:

 DeeModelIter    *iter;
 GVariantBuilder  b;

 g_variant_builder_init (&b, "as");
 g_variant_builder_add (&b, "s", "Hello");
 g_variant_builder_add (&b, "s", "World");

 iter = find_my_special_row (model);
 dee_model_insert_before (model, iter,
                          27,
                          "Howdy",
                          g_variant_builder_end (&b));

self :

a DeeModel

iter :

An iter pointing to the row before which to insert the new one

... :

A list of values matching the column schemas of self. Any basic variant type is passed as the standard C type while any other type must be boxed in a GVariant. Any floating references will be consumed. A NULL value for a string type column will be converted to the empty string.

Returns :

A DeeModelIter pointing to the new row. [transfer none]

dee_model_insert_before_valist ()

DeeModelIter*       dee_model_insert_before_valist      (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         va_list *args);

self :

iter :

args :

Returns :


dee_model_insert_row_before ()

DeeModelIter*       dee_model_insert_row_before         (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         GVariant **row_members);

As dee_model_insert_before(), but intended for language bindings or situations where you work with models on a meta level and may not have a priori knowledge of the column schemas of the models. See also dee_model_build_row().

self :

a DeeModel

iter :

An iter pointing to the row before which to insert the new one

row_members :

An array of GVariants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed. [array zero-terminated]

Returns :

A DeeModelIter pointing to the new row. [transfer none]

dee_model_remove ()

void                dee_model_remove                    (DeeModel *self,
                                                         DeeModelIter *iter);

Removes the row at the given position from the model.

self :

a DeeModel

iter :

a DeeModelIter pointing to the row to remove

dee_model_clear ()

void                dee_model_clear                     (DeeModel *self);

Removes all rows in the model. Signals are emitted for each row in the model

self :

a DeeModel object to clear

dee_model_set ()

void                dee_model_set                       (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         ...);

Sets all values across the entire row referenced by iter. The variable argument list should contain values that match the column schemas for the model. All basic variant type (see g_variant_type_is_basic()) are passed in as their raw C type while all other types are passed in boxed in a GVariant. Any floating references on variants passed to this method are consumed.

For example, to set the values for a row on model with the schema ("u", "s", "as"):

  GVariantBuilder b;

  g_variant_builder_init (&b, "as");
  g_variant_builder_add (&b, "Hello");
  g_variant_builder_add (&b, "World");

  dee_model_set (model, iter, 27, "foo", g_variant_builder_end (&b));

self :

a DeeModel

iter :

a DeeModelIter

... :

A list of values to set matching the column schemas. Any basic variant type is passed as the standard C type while any other type must be boxed in a GVariant. Any floating references will be consumed. A NULL value for a string type column will be converted to the empty string.

dee_model_set_valist ()

void                dee_model_set_valist                (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         va_list *args);

self :

iter :

args :


dee_model_set_value ()

void                dee_model_set_value                 (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column,
                                                         GVariant *value);

Sets the data in column for the row iter points to, to value. The type of value must be convertible to the type of the column.

When this method call completes the model will emit ::row-changed. You can edit the model in place without triggering the change signals by calling dee_model_set_value_silently().

self :

a DeeModel

iter :

a DeeModelIter

column :

column number to set the value

value :

New value for cell. If value is a floating reference the model will assume ownership of the variant

dee_model_set_row ()

void                dee_model_set_row                   (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         GVariant **row_members);

Sets all columns in the row iter points to, to those found in row_members. The variants in row_members must match the types defined in the model's schema.

self :

a DeeModel

iter :

a DeeModelIter

row_members :

And array of GVariants with type signature matching those from the model schema. If any of the variants have floating references these will be consumed. [array]

dee_model_get ()

void                dee_model_get                       (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         ...);

Gets all the values across the entire row referenced by iter. The variable argument list should contain pointers to variables that match the column schemas of this model.

For all basic variant types (see g_variant_type_is_basic()) this method expects pointers to their native C types while for all other types it expects a pointer to a pointer to a GVariant.

For string values you are passed a constant reference which is owned by the model, but any returned variants must be freed with g_variant_unref().

For example, to get all values a model with signature ("u", "s", "as") you would do:

 guint32      u;
 const gchar *s;
 GVariant    *v;

 dee_model_get (model, iter, &u, &s, &v);

 // do stuff

 g_variant_unref (v);

self :

a DeeModel

iter :

a DeeModelIter

... :

a list of return locations matching the types defined in the column schemas. To ignore the data in a specific column pass a NULL on that position

dee_model_get_valist ()

void                dee_model_get_valist                (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         va_list args);

self :

iter :

args :


dee_model_get_row ()

GVariant**          dee_model_get_row                   (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         GVariant **out_row_members);

self :

A DeeModel to get a row from

iter :

A DeeModelIter pointing to the row to get

out_row_members :

An array of variants with a length bigger than or equal to the number of columns in self, or NULL. If you pass NULL here a new array will be allocated for you. The returned variants will have a non-floating reference. [array][out]

Returns :

out_row_members if it was not NULL or a newly allocated array otherwise which you must free with g_free(). The variants in the array will have a strong reference and needs to be freed with g_variant_unref().

dee_model_get_value ()

GVariant*           dee_model_get_value                 (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);

self :

The DeeModel to inspect

iter :

a DeeModelIter pointing to the row to inspect

column :

column number to retrieve the value from

Returns :

A, guaranteed non-floating, reference to a GVariant containing the row data. Free with g_variant_unref(). [transfer full]

dee_model_get_first_iter ()

DeeModelIter*       dee_model_get_first_iter            (DeeModel *self);

Retrieves a DeeModelIter representing the first row in self.

self :

a DeeModel

Returns :

A DeeModelIter (owned by self, do not free it). [transfer none]

dee_model_get_last_iter ()

DeeModelIter*       dee_model_get_last_iter             (DeeModel *self);

Retrieves a DeeModelIter representing the last row in self.

self :

a DeeModel

Returns :

A DeeModelIter (owned by self, do not free it). [transfer none]

dee_model_get_iter_at_row ()

DeeModelIter*       dee_model_get_iter_at_row           (DeeModel *self,
                                                         guint row);

Retrieves a DeeModelIter representing the row at the given index.

self :

a DeeModel

row :

position of the row to retrieve

Returns :

A new DeeModelIter, or NULL if row was out of bounds. The returned iter is owned by self, so do not free it. [transfer none]

dee_model_get_bool ()

gboolean            dee_model_get_bool                  (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);

self :

a DeeModel

iter :

a DeeModelIter

column :

the column to retrieve a boolean from

Returns :

if iter and column are valid, the boolean stored at column. Otherwise FALSE

dee_model_get_uchar ()

guchar              dee_model_get_uchar                 (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);

self :

a DeeModel

iter :

a DeeModelIter

column :

the column to retrieve a uchar from

Returns :

if iter and column are valid, the uchar stored at column. Otherwise 0.

dee_model_get_int32 ()

gint32              dee_model_get_int32                 (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);

self :

a DeeModel

iter :

a DeeModelIter

column :

the column to retrieve a int from

Returns :

if iter and column are valid, the int stored at column. Otherwise 0.

dee_model_get_uint32 ()

guint32             dee_model_get_uint32                (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);

self :

a DeeModel

iter :

a DeeModelIter

column :

the column to retrieve a uint from

Returns :

if iter and column are valid, the uint stored at column. Otherwise 0.

dee_model_get_int64 ()

gint64              dee_model_get_int64                 (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);

self :

a DeeModel

iter :

a DeeModelIter

column :

the column to retrieve a int64 from

Returns :

if iter and column are valid, the int64 stored at column. Otherwise 0.

dee_model_get_uint64 ()

guint64             dee_model_get_uint64                (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);

self :

a DeeModel

iter :

a DeeModelIter

column :

the column to retrieve a uint64 from

Returns :

if iter and column are valid, the uint64 stored at column. Otherwise 0.

dee_model_get_double ()

gdouble             dee_model_get_double                (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);

self :

a DeeModel

iter :

a DeeModelIter

column :

the column to retrieve a double from

Returns :

if iter and column are valid, the double stored at column. Otherwise 0.

dee_model_get_string ()

const gchar *       dee_model_get_string                (DeeModel *self,
                                                         DeeModelIter *iter,
                                                         guint column);

self :

a DeeModel

iter :

a DeeModelIter

column :

the column to retrieve a string from

Returns :

if iter and column are valid, the string stored at column. Otherwise NULL.

dee_model_next ()

DeeModelIter *      dee_model_next                      (DeeModel *self,
                                                         DeeModelIter *iter);

Returns a DeeModelIter that points to the next position in the model.

self :

a DeeModel

iter :

a DeeModelIter

Returns :

A DeeModelIter, pointing to the next row in the model. The iter is owned by self, do not free it. [transfer none]

dee_model_prev ()

DeeModelIter *      dee_model_prev                      (DeeModel *self,
                                                         DeeModelIter *iter);

Returns a DeeModelIter that points to the previous position in the model.

self :

a DeeModel

iter :

a DeeModelIter

Returns :

A DeeModelIter, pointing to the previous row in the model. The iter is owned by self, do not free it. [transfer none]

dee_model_is_first ()

gboolean            dee_model_is_first                  (DeeModel *self,
                                                         DeeModelIter *iter);

Where iter is at the start of self.

self :

a DeeModel

iter :

a DeeModelIter

Returns :

TRUE if iter is the first iter in the model

dee_model_is_last ()

gboolean            dee_model_is_last                   (DeeModel *self,
                                                         DeeModelIter *iter);

Whether iter is at the end of self.

self :

a DeeModel

iter :

a DeeModelIter

Returns :

TRUE if iter is the last iter in the model

dee_model_get_position ()

guint               dee_model_get_position              (DeeModel *self,
                                                         DeeModelIter *iter);

Returns :

The integer offset of iter in self

dee_model_freeze_signals ()

void                dee_model_freeze_signals            (DeeModel *self);

Increase the freeze count of self by one. When the freeze count of a model is greater than 0 it will not emit any of the signals ::row-added or ::row-changed, but simply queue them up. Once the freeze count hits zero (by calling dee_model_thaw_signals()) all signals will be played back in the order they where originally triggered.

Note that the ::row-removed signal will be emitted disregarding the freeze count. It has to be this way because otherwise the row iter would be invalid once the signal was emitted.

self :

The model for which to freeze the change notification signals

dee_model_thaw_signals ()

void                dee_model_thaw_signals              (DeeModel *self);

Decrease the freeze count of self by one. When the freeze count of a model is greater than 0 it will not emit any of the signals ::row-added or ::row-changed, but simply queue them up. Once the freeze count hits zero (by calling this method) all signals will be played back in the order they where originally triggered.

Note that the ::row-removed signal will be emitted disregarding the freeze count. It has to be this way because otherwise the row iter would be invalid once the signal was emitted.

self :

The model for which to freeze the

dee_model_build_row ()

GVariant**          dee_model_build_row                 (DeeModel *self,
                                                         GVariant **out_row_members,
                                                         ...);

Build an array of GVariants with values from the variadic argument list according to the model schema for self. The caller must call g_variant_ref_sink() and g_variant_unref() on all the returned variants and g_free() the array itself if NULL was passed as out_row_members.

This is utility function and will not touch or modify self in any way.

self :

The model to create a row for

out_row_members :

An array to write the values to or NULL to allocate a new array. If non-NULL it must have a length that is longer or equal to the number of columns in self

... :

A list with values matching the column schemas of self. Basic variant types are passed directly while any other types must be boxed in a GVariant. It's important to note that any floating references on variants passed to this method will be not be consumed. A NULL value for a string type column will be converted to the empty string.

Returns :

If out_row_members is NULL a newly allocated array of variants will be returned and the array must be freed with g_free(). If out_row_members is nonNULL it will be reused, and variants in the array may or may not have floating references, which means the caller must make sure that g_variant_ref_sink() and g_variant_unref() are called on them.

dee_model_build_row_valist ()

GVariant**          dee_model_build_row_valist          (DeeModel *self,
                                                         GVariant **out_row_members,
                                                         va_list *args);

self :

out_row_members :

args :

Returns :

Signal Details

The "row-added" signal

void                user_function                      (DeeModel *self,
                                                        gpointer  iter,
                                                        gpointer  user_data)      : Run Last

Connect to this signal to be notified when a row is added to self.

self :

the DeeModel on which the signal is emitted

iter :

a DeeModelIter pointing to the newly added row. [transfer none]

user_data :

user data set when the signal handler was connected.

The "row-changed" signal

void                user_function                      (DeeModel *self,
                                                        gpointer  iter,
                                                        gpointer  user_data)      : Run Last

Connect to this signal to be notified when a row is changed.

self :

the DeeModel on which the signal is emitted

iter :

a DeeModelIter pointing to the changed row. [transfer none]

user_data :

user data set when the signal handler was connected.

The "row-removed" signal

void                user_function                      (DeeModel *self,
                                                        gpointer  iter,
                                                        gpointer  user_data)      : Run Last

Connect to this signal to be notified when a row is removed from self. The row is still valid while the signal is being emitted.

self :

the DeeModel on which the signal is emitted

iter :

a DeeModelIter pointing to the removed row. [transfer none]

user_data :

user data set when the signal handler was connected.