## RBDisplayPageModel RBDisplayPageModel — models backing the display page tree |

## Functions

RBDisplayPageModel * | rb_display_page_model_new ()
void | rb_display_page_model_set_playing_source ()
void | rb_display_page_model_add_page ()
void | rb_display_page_model_remove_page ()
gboolean | rb_display_page_model_find_page ()
void | rb_display_page_model_set_dnd_targets ()

## Signals

void | drop-received | Run Last
void | page-inserted | Run Last

## Types and Values

enum | RBDisplayPageModelColumn
struct | RBDisplayPageModel
struct | RBDisplayPageModelClass

## Object Hierarchy

        GObject
        ╰── GtkTreeModelFilter
            ╰── RBDisplayPageModel

## Implemented Interfaces

RBDisplayPageModel implements GtkTreeModel, GtkTreeDragSource, RbTreeDragSource and RbTreeDragDest.

## Description

The RBDisplayPageTree 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 display page 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 tree widget, 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 display page tree, these result in the creation of a new auto playlist with the dragged items as criteria.

## Functions

### rb_display_page_model_new ()

    RBDisplayPageModel *
    rb_display_page_model_new (void);

This constructs both the GtkTreeStore holding the display page data and the filter model that hides invisible pages.

#### Returns

the RBDisplayPageModel

### rb_display_page_model_set_playing_source ()

    void
    rb_display_page_model_set_playing_source
                                   (RBDisplayPageModel *page_model,
                                    RBDisplayPage *source);

Updates the model with the new playing source.

#### Parameters

page_model | the RBDisplayPageModel |
source | the new playing RBSource (as a RBDisplayPage) |

### rb_display_page_model_add_page ()

    void
    rb_display_page_model_add_page (RBDisplayPageModel *page_model,
                                    RBDisplayPage *page,
                                    RBDisplayPage *parent);

Adds a page to the model, either below a specified page (if it's a source or something else) or at the top level (if it's a group)

#### Parameters

page_model | the RBDisplayPageModel |
page | the RBDisplayPage to add |
parent | the parent under which to add `page` |

### rb_display_page_model_remove_page ()

    void
    rb_display_page_model_remove_page (RBDisplayPageModel *page_model,
                                       RBDisplayPage *page);

Removes a page from the model.

#### Parameters

page_model | the RBDisplayPageModel |
page | the RBDisplayPage to remove |

### rb_display_page_model_find_page ()

    gboolean
    rb_display_page_model_find_page (RBDisplayPageModel *page_model,
                                     RBDisplayPage *page,
                                     GtkTreeIter *iter);

Finds a GtkTreeIter for a specified page in the model. This will only find pages that are currently visible. The returned GtkTreeIter can be used with the RBDisplayPageModel.

#### Parameters

page_model | the RBDisplayPageModel |
page | the RBDisplayPage to find |
iter | returns a GtkTreeIter for the page |

#### Returns

`TRUE` if the page was found

### rb_display_page_model_set_dnd_targets ()

    void
    rb_display_page_model_set_dnd_targets (RBDisplayPageModel *page_model,
                                           GtkTreeView *treeview);

Sets up the drag and drop targets for the display page tree.

#### Parameters

page_model | the RBDisplayPageModel |
treeview | the sourcel ist GtkTreeView |

## Types and Values

### enum RBDisplayPageModelColumn

Columns present in the display page model.

#### Members

RB_DISPLAY_PAGE_MODEL_COLUMN_PLAYING | TRUE if the page is the playing source |
RB_DISPLAY_PAGE_MODEL_COLUMN_PAGE | the RBDisplayPage object |
RB_DISPLAY_PAGE_MODEL_N_COLUMNS | the number of columns |

### struct RBDisplayPageModel

    struct RBDisplayPageModel;

### struct RBDisplayPageModelClass

    struct RBDisplayPageModelClass {
    	GtkTreeModelFilterClass parent_class;

    	void (*drop_received) (RBDisplayPageModel *model,
    			       RBDisplayPage *target,
    			       GtkTreeViewDropPosition pos,
    			       GtkSelectionData *data);
    	void (*page_inserted) (RBDisplayPageModel *model,
    			       RBDisplayPage *page,
    			       GtkTreeIter *iter);
    };

## Signal Details

### The `“drop-received”` signal

    void
    user_function (RBDisplayPageModel *model,
                   RBDisplayPage      *target,
                   gint                pos,
                   gpointer            data,
                   gpointer            user_data)

Emitted when a drag and drop operation to the display page tree completes.

#### Parameters

model | the RBDisplayPageModel |
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. |

Flags: Run Last

### The `“page-inserted”` signal

    void
    user_function (RBDisplayPageModel *model,
                   RBDisplayPage      *page,
                   GtkTreeIter        *iter,
                   gpointer            user_data)

Emitted when a new page is inserted into the model. Use this instead of GtkTreeModel::row-inserted as this doesn't get complicated by visibility filtering.

#### Parameters

model | the RBDisplayPageModel |
page | the RBDisplayPage that was inserted |
iter | a GtkTreeIter indicating the page position |
user_data | user data set when the signal handler was connected. |

Flags: Run Last