## RBSourceList

RBSourceList — source list widget

## Synopsis

                        RBSourceList;
                        RBSourceListClass;
    GtkWidget *         rb_sourcelist_new                   (RBShell *shell);
    void                rb_sourcelist_append                (RBSourceList *sourcelist,
                                                             RBSource *source,
                                                             RBSource *parent);
    void                rb_sourcelist_set_playing_source    (RBSourceList *sourcelist,
                                                             RBSource *source);
    void                rb_sourcelist_edit_source_name      (RBSourceList *sourcelist,
                                                             RBSource *source);
    void                rb_sourcelist_remove                (RBSourceList *sourcelist,
                                                             RBSource *source);
    void                rb_sourcelist_select                (RBSourceList *sourcelist,
                                                             RBSource *source);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkBin
                                     +----GtkScrolledWindow
                                           +----RBSourceList

## Implemented Interfaces

RBSourceList implements AtkImplementorIface and GtkBuildable.

## Properties

      "model"                    GtkTreeModel*         : Read
      "shell"                    RBShell*              : Read / Write / Construct Only

## Signals

      "drop-received"                                  : Run Last
      "selected"                                       : Run Last
      "show-popup"                                     : Run Last
      "source-activated"                               : Run Last

## Description

The source list widget is a GtkTreeView backed by a GtkListStore containing the sources and some extra data used to structure the tree view.

The source list widget displays the available sources. Sources are divided into groups - library, stores, playlists, devices, network shares. Groups are displayed as headers, with expanders for hiding and showing the sources in the group. Sources themselves may also have child sources, such as playlists on portable audio players.

Sources are displayed with an icon and a name. If the source is currently playing, the name is displayed in bold.

## Details

### RBSourceList

    typedef struct _RBSourceList RBSourceList;

### RBSourceListClass

    typedef struct {
    	GtkScrolledWindowClass parent_class;

    	/* signals */
    	void (*selected) (RBSourceList *list, RBSource *source);

    	void (*drop_received) (RBSourceList *list, RBSource *target, GtkSelectionData *data);

    	void (*source_activated) (RBSourceList *list, RBSource *target);

    	gboolean (*show_popup) (RBSourceList *list, RBSource *target);
    } RBSourceListClass;

### rb_sourcelist_new ()

    GtkWidget *         rb_sourcelist_new                   (RBShell *shell);

`shell` : | the RBShell instance
Returns : | the source list widget.

### rb_sourcelist_append ()

    void                rb_sourcelist_append                (RBSourceList *sourcelist,
                                                             RBSource *source,
                                                             RBSource *parent);

Adds a new source to the source list. If `parent` is not NULL, the new source is added beneath it. Otherwise, it is added to the end of the source group specified by the source's source-group property.

`sourcelist` : | the RBSourceList
`source` : | the RBSource to add
`parent` : | the RBSource below which to add the new source, or NULL

### rb_sourcelist_set_playing_source ()

    void                rb_sourcelist_set_playing_source    (RBSourceList *sourcelist,
                                                             RBSource *source);

Updates the source list with the new playing source. The source list tracks which source is playing in order to display the name of the playing source in bold type.

`sourcelist` : | the RBSourceList
`source` : | the new playing RBSource

### rb_sourcelist_edit_source_name ()

    void                rb_sourcelist_edit_source_name      (RBSourceList *sourcelist,
                                                             RBSource *source);

Initiates editing of the name of the specified source. The row for the source is selected and given input focus, allowing the user to edit the name. source_name_edited_cb is called when the user finishes editing.

`sourcelist` : | the RBSourceList
`source` : | the RBSource to edit

### rb_sourcelist_remove ()

    void                rb_sourcelist_remove                (RBSourceList *sourcelist,
                                                             RBSource *source);

Removes a source from the source list. Disconnects signal handlers, removes the source from the underlying model, and updates the visibility of the group containing the source.

`sourcelist` : | the RBSourceList
`source` : | the RBSource being removed

### rb_sourcelist_select ()

    void                rb_sourcelist_select                (RBSourceList *sourcelist,
                                                             RBSource *source);

Selects the specified source in the source list. This will result in the 'selected' signal being emitted.

`sourcelist` : | the RBSourceList
`source` : | the RBSource to select

## Property Details

### The `"model"` property

      "model"                    GtkTreeModel*         : Read

The GtkTreeModel for the source list

### The `"shell"` property

      "shell"                    RBShell*              : Read / Write / Construct Only

The RBShell instance

## Signal Details

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

    void                user_function                      (RBSourceList *list,
                                                            gpointer      target,
                                                            gpointer      data,
                                                            gpointer      user_data)      : Run Last

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

`list` : | the RBSourceList
`target` : | the RBSource receiving the drop
`data` : | the drop data
`user_data` : | user data set when the signal handler was connected.

### The `"selected"` signal

    void                user_function                      (RBSourceList *list,
                                                            GObject      *source,
                                                            gpointer      user_data)      : Run Last

Emitted when a source is selected from the source list

`list` : | the RBSourceList
`source` : | the newly selected RBSource
`user_data` : | user data set when the signal handler was connected.

### The `"show-popup"` signal

    gboolean            user_function                      (RBSourceList *list,
                                                            RBSource     *target,
                                                            gpointer      user_data)      : Run Last

Emitted when a source should display a popup menu in response to some user action, such as right clicking or pressing shift-f10.

`list` : | the RBSourceList
`target` : | the RBSource for which a popup menu should be shown
`user_data` : | user data set when the signal handler was connected.

### The `"source-activated"` signal

    void                user_function                      (RBSourceList *list,
                                                            GObject      *target,
                                                            gpointer      user_data)      : Run Last

Emitted when a source is activated (by double clicking or hitting the enter key)

`list` : | the RBSourceList
`target` : | the activated RBSource
`user_data` : | user data set when the signal handler was connected.