RBDisplayPageModel

RBDisplayPageModel — models backing the display page tree

Synopsis

enum                RBDisplayPageModelColumn;
struct              RBDisplayPageModel;
struct              RBDisplayPageModelClass;
RBDisplayPageModel * rb_display_page_model_new          (void);
void                rb_display_page_model_set_playing_source
                                                        (RBDisplayPageModel *page_model,
                                                         RBDisplayPage *source);
void                rb_display_page_model_add_page      (RBDisplayPageModel *page_model,
                                                         RBDisplayPage *page,
                                                         RBDisplayPage *parent);
void                rb_display_page_model_remove_page   (RBDisplayPageModel *page_model,
                                                         RBDisplayPage *page);
gboolean            rb_display_page_model_find_page     (RBDisplayPageModel *page_model,
                                                         RBDisplayPage *page,
                                                         GtkTreeIter *iter);
void                rb_display_page_model_set_dnd_targets
                                                        (RBDisplayPageModel *page_model,
                                                         GtkTreeView *treeview);

Object Hierarchy

  GObject
   +----GtkTreeModelFilter
         +----RBDisplayPageModel

Implemented Interfaces

RBDisplayPageModel implements GtkTreeModel, GtkTreeDragSource, RbTreeDragSource and RbTreeDragDest.

Signals

  "drop-received"                                  : Run Last
  "page-inserted"                                  : Run Last

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.

Details

enum RBDisplayPageModelColumn

typedef enum {
	RB_DISPLAY_PAGE_MODEL_COLUMN_PLAYING = 0,
	RB_DISPLAY_PAGE_MODEL_COLUMN_PAGE,
	RB_DISPLAY_PAGE_MODEL_N_COLUMNS
} RBDisplayPageModelColumn;

Columns present in the display page model.

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);
};


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.

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)

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.

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.

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.

page_model :

the RBDisplayPageModel

treeview :

the sourcel ist GtkTreeView

Signal Details

The "drop-received" signal

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

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

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.

The "page-inserted" signal

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

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.

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.