## rb-sourcelist-model

rb-sourcelist-model — models backing the source list widget

## Synopsis

                        RBSourceListModel;
                        RBSourceListModelClass;
    enum                RBSourceListModelColumn;
    GtkTreeModel*       rb_sourcelist_model_new             (void);
    void                rb_sourcelist_model_set_dnd_targets (RBSourceListModel *sourcelist,
                                                             GtkTreeView *treeview);

## Object Hierarchy

      GObject
       +----GtkTreeModelFilter
             +----RBSourceListModel

## Implemented Interfaces

RBSourceListModel implements GtkTreeModel, GtkTreeDragSource, RbTreeDragSource and RbTreeDragDest.

## Signals

      "drop-received"                                  : Run Last

## Description

The RBSourceList widget is backed by a GtkTreeStore containing the sources and a set of attributes used to structure and display them, and a GtkTreeModelFilter that hides sources with the visibility property set to FALSE. This class implements the filter model and also creates the actual model.

The source list model supports drag and drop in a variety of formats. The simplest of these are text/uri-list and application/x-rhythmbox-entry, which convey URIs and IDs of existing database entries. When dragged to an existing source, these just add the URIs or entries to the target source. When dragged to an empty space in the source list, this results in the creation of a static playlist.

text/x-rhythmbox-artist, text/x-rhythmbox-album, and text/x-rhythmbox-genre are used when dragging items from the library browser. When dragged to the source list, these result in the creation of a new auto playlist with the dragged items as criteria.

## Details

### RBSourceListModel

    typedef struct _RBSourceListModel RBSourceListModel;

### RBSourceListModelClass

    typedef struct {
    	GtkTreeModelFilterClass parent_class;

    	void (*drop_received) (RBSourceListModel *model, RBSource *target, GtkTreeViewDropPosition pos, GtkSelectionData *data);
    } RBSourceListModelClass;

### enum RBSourceListModelColumn

    typedef enum {
    	RB_SOURCELIST_MODEL_COLUMN_PLAYING = 0,
    	RB_SOURCELIST_MODEL_COLUMN_PIXBUF,
    	RB_SOURCELIST_MODEL_COLUMN_NAME,
    	RB_SOURCELIST_MODEL_COLUMN_SOURCE,
    	RB_SOURCELIST_MODEL_COLUMN_ATTRIBUTES,
    	RB_SOURCELIST_MODEL_COLUMN_VISIBILITY,
    	RB_SOURCELIST_MODEL_COLUMN_IS_GROUP,
    	RB_SOURCELIST_MODEL_COLUMN_GROUP_CATEGORY,
    	RB_SOURCELIST_MODEL_N_COLUMNS
    } RBSourceListModelColumn;

Columns present in the source list model.

`RB_SOURCELIST_MODEL_COLUMN_PLAYING` | TRUE if the source is playing
`RB_SOURCELIST_MODEL_COLUMN_PIXBUF` | the source's icon as a pixbuf
`RB_SOURCELIST_MODEL_COLUMN_NAME` | the source name
`RB_SOURCELIST_MODEL_COLUMN_SOURCE` | the RBSource object
`RB_SOURCELIST_MODEL_COLUMN_ATTRIBUTES` | Pango attributes used to render the source name
`RB_SOURCELIST_MODEL_COLUMN_VISIBILITY` | the source's visibility
`RB_SOURCELIST_MODEL_COLUMN_IS_GROUP` | whether the row identifies a group or a source
`RB_SOURCELIST_MODEL_COLUMN_GROUP_CATEGORY` | if the row is a group, the category for the group
`RB_SOURCELIST_MODEL_N_COLUMNS` |

### rb_sourcelist_model_new ()

    GtkTreeModel*       rb_sourcelist_model_new             (void);

This constructs both the GtkTreeStore holding the source data and the filter model that hides invisible sources.

Returns : | the RBSourceListModel

### rb_sourcelist_model_set_dnd_targets ()

    void                rb_sourcelist_model_set_dnd_targets (RBSourceListModel *sourcelist,
                                                             GtkTreeView *treeview);

Sets up the drag and drop targets for the source list.

`sourcelist` : | the RBSourceListModel
`treeview` : | the sourcel ist GtkTreeView

## Signal Details

### The `"drop-received"` signal

    void                user_function                      (RBSourceListModel *model,
                                                            RBSource          *target,
                                                            gint               pos,
                                                            gpointer           data,
                                                            gpointer           user_data)      : Run Last

Emitted when a drag and drop operation to the source list completes.

`model` : | the RBSourceListModel
`target` : | the RBSource receiving the drop
`pos` : | the drop position
`data` : | the drop data
`user_data` : | user data set when the signal handler was connected.