| Data Model API (libmodel) | ||||
|---|---|---|---|---|
| Top | Description | ||||
ModelReferenceModelReference — a mutable reference to a ModelObject |
ModelReference;
ModelReferenceClass;
ModelObject * model_reference_get_value (ModelReference *reference);
void model_reference_changed (ModelReference *reference);
A ModelReference is essentially a variable containing a reference to
a ModelObject, or NULL.
The ModelObject that a ModelReference refers to (ie: the value of the reference) can change with time.
The most useful attribute of a ModelReference is that change notification is supported. Whenever the value of the ModelReference changes, the "changed" signal is emitted. The signal is always emitted from the mainloop; never during the execution of method calls on the model.
typedef struct {
GObject parent_instance;
} ModelReference;
This is an opaque structure; it may not be accessed directly.
typedef struct {
GObjectClass parent_class;
ModelObject * (*get_value) (ModelReference *reference);
} ModelReferenceClass;
The class structure for ModelReference. All virtual functions must be implemented by each subclass.
GObjectClass |
|
|
virtual function pointer for model_reference_get_value()
|
ModelObject * model_reference_get_value (ModelReference *reference);
Reads the current value of the reference. This is essentially the dereference operation.
It is appropriate for the caller to call g_object_unref() on the
return value.
|
a ModelReference |
|
the current value of the reference, owned by the caller |
void model_reference_changed (ModelReference *reference);
Emits the "changed" signal on reference. This should be done
whenever the reference takes on a new value (ie:
model_reference_get_value() will return something different than last
time).
This function should only be called by model implementations.
|
a ModelReference |