DeeSharedModel

DeeSharedModel — A DeeModel that can synchronize with other DeeSharedModel objects across D-Bus.

Synopsis

#include <dee.h>

                    DeeSharedModel;
                    DeeSharedModelClass;
                    DeeSharedModelPrivate;
#define             DEE_SHARED_MODEL_DBUS_IFACE
enum                DeeSharedModelError;
DeeModel*           dee_shared_model_new                (const gchar *name,
                                                         guint n_columns,
                                                         ...);
DeeModel*           dee_shared_model_new_with_name      (const gchar *name);
DeeModel*           dee_shared_model_new_with_back_end  (const gchar *name,
                                                         DeeModel *back_end);
void                dee_shared_model_connect            (DeeSharedModel *self);
const gchar*        dee_shared_model_get_swarm_name     (DeeSharedModel *self);
DeePeer*            dee_shared_model_get_peer           (DeeSharedModel *self);

Object Hierarchy

  GObject
   +----DeeVersionedModel
         +----DeeProxyModel
               +----DeeSharedModel

Implemented Interfaces

DeeSharedModel implements DeeModel.

Properties

  "columns"                  gchar*                : Read
  "peer"                     DeePeer*              : Read / Write / Construct Only
  "seqnum"                   guint64               : Read
  "size"                     guint                 : Read

Signals

  "ready"                                          : Run Last / Has Details
  "rows-added"                                     : Run Last / Has Details
  "rows-changed"                                   : Run Last / Has Details
  "rows-removed"                                   : Run Last / Has Details

Description

DeeSharedModel is created with a name (usually namespaced and unique to your program(s)) which is used to locate other DeeSharedModels created with the same name through D-Bus, and will keep synchronized with them.

This allows to you build MVC programs with a sane model API, but have the controller (or multiple views) in a seperate process.

Details

DeeSharedModel

typedef struct _DeeSharedModel DeeSharedModel;

All fields in the DeeSharedModel structure are private and should never be accessed directly


DeeSharedModelClass

typedef struct {
} DeeSharedModelClass;


DeeSharedModelPrivate

typedef struct _DeeSharedModelPrivate DeeSharedModelPrivate;

Ignore this structure.


DEE_SHARED_MODEL_DBUS_IFACE

#define DEE_SHARED_MODEL_DBUS_IFACE "com.canonical.Dee.Model"


enum DeeSharedModelError

typedef enum
{
  DEE_SHARED_MODEL_ERROR_LEADER_INVALIDATED
} DeeSharedModelError;


dee_shared_model_new ()

DeeModel*           dee_shared_model_new                (const gchar *name,
                                                         guint n_columns,
                                                         ...);

Creates a new DeeSharedModel with the specified name, and with n_columns columns of the types passed in.

A shared model created with this constructor will store row data in a suitably picked memory backed model.

In order to start synchronizing the new model with peer models you must call dee_shared_model_connect() on it.

name :

A well known name to publish this model under. Models sharing this name will synchronize with each other

n_columns :

number of columns in the model

... :

n_columns number of GTypes

Returns :

a new DeeSharedModel

dee_shared_model_new_with_name ()

DeeModel*           dee_shared_model_new_with_name      (const gchar *name);

Create a new empty shared model without any column schema associated. The column schema will be set in one of two ways: Firstly you may set it manually with dee_model_set_n_columns() and dee_model_set_column_type(), or secondly it will be set once the first rows are exchanged with a peer model. In the second case the column schema will constructed exlicitly from the Clone metadata or implicitly from the row value types which ever arrives first.

A shared model created with this constructor will store row data in a suitably picked memory backed model.

In order to start synchronizing the new model with peer models you must call dee_shared_model_connect() on it.

name :

A well known name to publish this model under. Models sharing this name will synchronize with each other

Returns :

a new DeeSharedModel

dee_shared_model_new_with_back_end ()

DeeModel*           dee_shared_model_new_with_back_end  (const gchar *name,
                                                         DeeModel *back_end);

Create a new shared model storing all data in back_end.

In order to start synchronizing the new model with peer models you must call dee_shared_model_connect() on it.

name :

A well known name to publish this model under. Models sharing this name will synchronize with each other. [transfer none]

back_end :

The DeeModel that will actually store the model data. Ownership of the ref to back_end is transfered to the shared model. [transfer full]

Returns :


dee_shared_model_connect ()

void                dee_shared_model_connect            (DeeSharedModel *self);

Connect to the swarm of peer models and start listening for updates on peer models. Updates to this model will not be broadcast to the swarm until after this method has been called.

self :

The model to export on the bus

dee_shared_model_get_swarm_name ()

const gchar*        dee_shared_model_get_swarm_name     (DeeSharedModel *self);

Convenience function for accessing the "swarm-name" property of the DeePeer defined in the "peer" property.

self :

The model to get the name for

Returns :

The name of the swarm this model synchrnonizes with

dee_shared_model_get_peer ()

DeePeer*            dee_shared_model_get_peer           (DeeSharedModel *self);

Convenience function for accessing the "peer" property

self :

The model to get the DeePeer for

Returns :

The DeePeer used to interact with the peer models. [transfer-none]

Property Details

The "columns" property

  "columns"                  gchar*                : Read

Expert: The last known sequence number

Default value: ""


The "peer" property

  "peer"                     DeePeer*              : Read / Write / Construct Only

The peer object that monitors the swarm.


The "seqnum" property

  "seqnum"                   guint64               : Read

Expert: The last known sequence number

Default value: 0


The "size" property

  "size"                     guint                 : Read

The number of rows in the model

Default value: 0

Signal Details

The "ready" signal

void                user_function                      (DeeSharedModel *deesharedmodel,
                                                        gpointer        user_data)           : Run Last / Has Details

deesharedmodel :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "rows-added" signal

void                user_function                      (DeeSharedModel               *arg0,
                                                        GPtrArray_GPtrArray_GValue__ *arg1,
                                                        GArray_guint_                *arg2,
                                                        GArray_guint64_              *arg3,
                                                        gpointer                      user_data)      : Run Last / Has Details

Private signal leaked because of how dbus-glib work with signals

user_data :

user data set when the signal handler was connected.

The "rows-changed" signal

void                user_function                      (DeeSharedModel               *arg0,
                                                        GPtrArray_GPtrArray_GValue__ *arg1,
                                                        GArray_guint_                *arg2,
                                                        GArray_guint64_              *arg3,
                                                        gpointer                      user_data)      : Run Last / Has Details

Private signal leaked because of how dbus-glib work with signals

user_data :

user data set when the signal handler was connected.

The "rows-removed" signal

void                user_function                      (DeeSharedModel  *arg0,
                                                        GArray_guint_   *arg1,
                                                        GArray_guint64_ *arg2,
                                                        gpointer         user_data)      : Run Last / Has Details

Private signal leaked because of how dbus-glib work with signals

user_data :

user data set when the signal handler was connected.