## RhythmDBPropertyModel

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

## Synopsis

                        RhythmDBPropertyModel;
                        RhythmDBPropertyModelClass;
    enum                RhythmDBPropertyModelColumn;
    RhythmDBPropertyModel * rhythmdb_property_model_new     (RhythmDB *db,
                                                             RhythmDBPropType propid);
    gboolean            rhythmdb_property_model_iter_from_string
                                                            (RhythmDBPropertyModel *model,
                                                             const char *name,
                                                             GtkTreeIter *iter);
    void                rhythmdb_property_model_enable_drag (RhythmDBPropertyModel *model,
                                                             GtkTreeView *view);

## Object Hierarchy

      GObject
       +----RhythmDBPropertyModel

## Implemented Interfaces

RhythmDBPropertyModel implements GtkTreeModel and RbTreeDragSource.

## Properties

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

## Signals

      "pre-row-deletion"                               : Run Last

## 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.

## Details

### RhythmDBPropertyModel

    typedef struct _RhythmDBPropertyModel RhythmDBPropertyModel;

### RhythmDBPropertyModelClass

    typedef struct {
    	GObjectClass parent;

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

### enum RhythmDBPropertyModelColumn

    typedef enum
    {
    	RHYTHMDB_PROPERTY_MODEL_COLUMN_TITLE,
    	RHYTHMDB_PROPERTY_MODEL_COLUMN_PRIORITY,
    	RHYTHMDB_PROPERTY_MODEL_COLUMN_NUMBER,
    	RHYTHMDB_PROPERTY_MODEL_COLUMN_LAST,
    } RhythmDBPropertyModelColumn;

### rhythmdb_property_model_new ()

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

Creates a new property model for the specified property ID.

`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.

`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.

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

## Property Details

### The `"db"` property

      "db"                       RhythmDB*             : Read / Write / Construct Only

The RhythmDB object the model is associated with.

### The `"prop"` property

      "prop"                     gint                  : Read / Write / Construct Only

The property that this property model indexes.

Allowed values: [0,59]

Default value: 0

### The `"query-model"` property

      "query-model"              RhythmDBQueryModel*   : Read / Write

The query model that this property model indexes.

## Signal Details

### The `"pre-row-deletion"` signal

    void                user_function                      (RhythmDBPropertyModel *model,
                                                            gpointer               user_data)      : Run Last

Emitted just before a row is deleted from the model.

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