Rhythmbox Development Reference Manual: RhythmDBPropertyModel

## RhythmDBPropertyModel RhythmDBPropertyModel — tree model grouping entries from a query model by property values |

## Functions

RhythmDBPropertyModel * | rhythmdb_property_model_new ()
gboolean | rhythmdb_property_model_iter_from_string ()
void | rhythmdb_property_model_enable_drag ()

## Properties

RhythmDB * | db | Read / Write / Construct Only
gint | prop | Read / Write / Construct Only
RhythmDBQueryModel * | query-model | Read / Write

## Signals

void | pre-row-deletion | Run Last

## Types and Values

struct | RhythmDBPropertyModel
struct | RhythmDBPropertyModelClass
enum | RhythmDBPropertyModelColumn

## Object Hierarchy

        GEnum
        ╰── RhythmDBPropertyModelColumn
        GObject
        ╰── RhythmDBPropertyModel

## Implemented Interfaces

RhythmDBPropertyModel implements GtkTreeModel and RbTreeDragSource.

## Description

A RhythmDBPropertyModel groups the entries in a RhythmDBQueryModel by the value of a property. For example, a RhythmDBPropertyModel using the RHYTHMDB_PROP_ARTIST property can be used as the model for a GtkTreeView that will list the artists present in the query model.

The album/artist/genre browsers displayed in the library and other sources are populated using a RhythmDBPropertyModel for each property.

## Functions

### rhythmdb_property_model_new ()

    RhythmDBPropertyModel *
    rhythmdb_property_model_new (RhythmDB *db,
                                 RhythmDBPropType propid);

Creates a new property model for the specified property ID.

#### Parameters

db | the RhythmDB object |
propid | the property to index |

#### Returns

the new RhythmDBPropertyModel

### rhythmdb_property_model_iter_from_string ()

    gboolean
    rhythmdb_property_model_iter_from_string
                                   (RhythmDBPropertyModel *model,
                                    const char *name,
                                    GtkTreeIter *iter);

Locates the row in the model for a property value.

#### Parameters

model | the RhythmDBPropertyModel |
name | the property value to find |
iter | a GtkTreeIter to point to the row |

#### Returns

TRUE if the value was found.

### rhythmdb_property_model_enable_drag ()

    void
    rhythmdb_property_model_enable_drag (RhythmDBPropertyModel *model,
                                         GtkTreeView *view);

Enables drag and drop from a specified GtkTreeView that is backed by the RhythmDBPropertyModel. Drag targets are determined by the indexed property.

#### Parameters

model | the RhythmDBPropertyModel. |
view | the GtkTreeView from which to enable drag and drop |

## Types and Values

### struct RhythmDBPropertyModel

    struct RhythmDBPropertyModel;

### struct RhythmDBPropertyModelClass

    struct RhythmDBPropertyModelClass {
    	GObjectClass parent;

    	void (*pre_row_deletion) (RhythmDBPropertyModel *model);
    };

### enum RhythmDBPropertyModelColumn

#### Members

RHYTHMDB_PROPERTY_MODEL_COLUMN_TITLE |  |
RHYTHMDB_PROPERTY_MODEL_COLUMN_PRIORITY |  |
RHYTHMDB_PROPERTY_MODEL_COLUMN_NUMBER |  |
RHYTHMDB_PROPERTY_MODEL_COLUMN_LAST |  |

## Property Details

### The `“db”` property

      “db”                       RhythmDB *

The RhythmDB object the model is associated with.

Flags: Read / Write / Construct Only

### The `“prop”` property

      “prop”                     gint

The property that this property model indexes.

Flags: Read / Write / Construct Only

Allowed values: [0,75]

Default value: 0

### The `“query-model”` property

      “query-model”              RhythmDBQueryModel *

The query model that this property model indexes.

Flags: Read / Write

## Signal Details

### The `“pre-row-deletion”` signal

    void
    user_function (RhythmDBPropertyModel *model,
                   gpointer               user_data)

Emitted just before a row is deleted from the model.

#### Parameters

model | the RhythmDBPropertyModel |
user_data | user data set when the signal handler was connected. |

Flags: Run Last