dee

Implement row annotations for DeeModel

Bug #651479 reported by Mikkel Kamstrup Erlandsen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Unity
Fix Released
Undecided
Unassigned
dee
Fix Released
High
Mikkel Kamstrup Erlandsen
dee (Ubuntu)
Fix Released
Undecided
Unassigned
unity (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

It's a common pattern that model consumers needs to map each individual row to some internal data structure or value (fx. a widget). Currently this can only be achieved by maintaining a map of row iters to the data members which must then be kept in sync with the model.

I propose we add a "Model Annotation API" ala:

-------------------------------

typedef guint DeeModelAnnotation;

/**
 * dee_model_register_annotation:
 * @destroy: Callback to free annotation set on the model with
 * dee_model_set_annotation(). Called when the row is
 * removed, the annotation is cleared, or the model is
 * finalized.
 *
 * Create a new annotation.
 *
 * Returns: A new annotation key that can be used to get and
 * set annotation values
 */
DeeModelAnnotation dee_model_register_annotation (GDestroyNotify destroy);

void dee_model_set_annotation (DeeModel *model,
                               DeeModelIter *row,
                               DeeModelAnnotation anno,
                               gpointer anno_value);

gpointer dee_model_get_annotation (DeeModel *model,
                                   DeeModelIter *row,
                                   DeeModelAnnotation anno);

void dee_model_clear_annotation (DeeModel *model,
                                 DeeModelIter *row,
                                 DeeModelAnnotation anno);

-------------------------------

Related branches

description: updated
description: updated
Revision history for this message
Mark Shuttleworth (sabdfl) wrote : Re: [Bug 651479] [NEW] Implement row annotations for DeeModel

Very neatly defined, Mikkel.

Changed in dee:
milestone: none → 0.5.1
Changed in dee:
milestone: 0.5.4 → 0.5.6
Changed in dee:
milestone: 0.5.6 → none
Changed in dee:
assignee: nobody → Mikkel Kamstrup Erlandsen (kamstrup)
importance: Undecided → High
milestone: none → 0.5.8
status: New → Triaged
Changed in unity:
status: New → Triaged
Changed in dee (Ubuntu):
status: New → Triaged
Changed in dee:
milestone: 0.5.8 → 0.5.12
Changed in unity:
status: Triaged → Fix Committed
Changed in dee:
status: Triaged → Fix Committed
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

The API is merged and looks like:

DeeModelTag* dee_model_register_annotation (DeeModel *model, GDestroyNotify destroy);

void dee_model_set_tag (DeeModel *model,
                               DeeModelIter *row,
                               DeeModelTag *tag,
                               gpointer value);

gpointer dee_model_get_tag (DeeModel *model,
                                   DeeModelIter *row,
                                   DeeModelTag *tag);

void dee_model_clear_tag (DeeModel *model,
                                 DeeModelIter *row,
                                 DeeModelTag *tag);

Changed in dee (Ubuntu):
status: Triaged → Fix Committed
Changed in unity:
status: Fix Committed → Fix Released
Changed in dee:
status: Fix Committed → Fix Released
Changed in dee (Ubuntu):
status: Fix Committed → Fix Released
Changed in unity (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.