## RBLibraryBrowser

RBLibraryBrowser — album/artist/genre browser widget

## Synopsis

    #include <rb-library-browser.h>

    struct              RBLibraryBrowser;
    struct              RBLibraryBrowserClass;
    RBLibraryBrowser *  rb_library_browser_new              (RhythmDB *db,
                                                             RhythmDBEntryType *entry_type);
    void                rb_library_browser_set_model        (RBLibraryBrowser *widget,
                                                             RhythmDBQueryModel *model,
                                                             gboolean query_pending);
    gboolean            rb_library_browser_reset            (RBLibraryBrowser *widget);
    RhythmDBQuery *     rb_library_browser_construct_query  (RBLibraryBrowser *widget);
    GList *             rb_library_browser_get_property_views
                                                            (RBLibraryBrowser *widget);
    RBPropertyView *    rb_library_browser_get_property_view
                                                            (RBLibraryBrowser *widget,
                                                             RhythmDBPropType type);
    gboolean            rb_library_browser_has_selection    (RBLibraryBrowser *widget);
    void                rb_library_browser_set_selection    (RBLibraryBrowser *widget,
                                                             RhythmDBPropType type,
                                                             GList *selection);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkWidget
                   +----GtkContainer
                         +----GtkBox
                               +----GtkHBox
                                     +----RBLibraryBrowser

## Implemented Interfaces

RBLibraryBrowser implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Properties

      "browser-views"            gchar*                : Read / Write / Construct
      "db"                       RhythmDB*             : Read / Write / Construct Only
      "entry-type"               RhythmDBEntryType*    : Read / Write / Construct Only
      "input-model"              RhythmDBQueryModel*   : Read
      "output-model"             RhythmDBQueryModel*   : Read

## Description

This widget contains a set of RBPropertyViews backed by RhythmDBPropertyModels and constructs a chain of RhythmDBQueryModels to perform filtering of the entries in a source.

It operates on an input query model, containing the full set of entries that may be displayed in the source, and produces an output query model containing those entries that match the current selection.

When the selection in any of the property views changes, or when rb_library_browser_reset or rb_library_browser_set_selection are called to manipulate the selection, the query chain is rebuilt asynchronously to update the property views.

## Details

### struct RBLibraryBrowser

    struct RBLibraryBrowser;

### struct RBLibraryBrowserClass

    struct RBLibraryBrowserClass {
    	GtkHBoxClass parent;
    };

### rb_library_browser_new ()

    RBLibraryBrowser *  rb_library_browser_new              (RhythmDB *db,
                                                             RhythmDBEntryType *entry_type);

Creates a new library browser.

`db` : | the RhythmDB instance
`entry_type` : | the entry type to use in the browser
Returns : | a new RBLibraryBrowser

### rb_library_browser_set_model ()

    void                rb_library_browser_set_model        (RBLibraryBrowser *widget,
                                                             RhythmDBQueryModel *model,
                                                             gboolean query_pending);

Specifies a new input query model for the browser. This should be the query model constructed from the current search text, or the basic query model for the source if there is no search text.

`widget` : | a RBLibraryBrowser
`model` : | the new input RhythmDBQueryModel. [transfer none]
`query_pending` : | if TRUE, the caller promises to run a query to populate the input query model.

### rb_library_browser_reset ()

    gboolean            rb_library_browser_reset            (RBLibraryBrowser *widget);

Clears all selections in the browser.

`widget` : | a RBLibraryBrowser
Returns : | TRUE if anything was changed

### rb_library_browser_construct_query ()

    RhythmDBQuery *     rb_library_browser_construct_query  (RBLibraryBrowser *widget);

Constructs a RhythmDBQuery from the current selections in the browser.

`widget` : | a RBLibraryBrowser
Returns : | a RhythmDBQuery constructed from the current selection. [transfer full]

### rb_library_browser_get_property_views ()

    GList *             rb_library_browser_get_property_views
                                                            (RBLibraryBrowser *widget);

Retrieves the property view widgets from the browser.

`widget` : | a RBLibraryBrowser
Returns : | a GList containing the RBPropertyView widgets in the browser. [element-type RBPropertyView][transfer container]

### rb_library_browser_get_property_view ()

    RBPropertyView *    rb_library_browser_get_property_view
                                                            (RBLibraryBrowser *widget,
                                                             RhythmDBPropType type);

Retrieves the property view widget for the specified property, if there is one.

`widget` : | a RBLibraryBrowser
`type` : | the property
Returns : | RBPropertyView widget, or NULL. [transfer none]

### rb_library_browser_has_selection ()

    gboolean            rb_library_browser_has_selection    (RBLibraryBrowser *widget);

Determines whether the browser has an active selection.

`widget` : | a RBLibraryBrowser
Returns : | TRUE if any items in the browser are selected.

### rb_library_browser_set_selection ()

    void                rb_library_browser_set_selection    (RBLibraryBrowser *widget,
                                                             RhythmDBPropType type,
                                                             GList *selection);

Replaces any current selection for the specified property.

`widget` : | a RBLibraryBrowser
`type` : | the property for which to set the selection
`selection` : | a list of strings to select. [element-type utf8][transfer none]

## Property Details

### The `"browser-views"` property

      "browser-views"            gchar*                : Read / Write / Construct

The set of browsers to display.

Default value: "artists-albums"

### The `"db"` property

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

RhythmDB instance

### The `"entry-type"` property

      "entry-type"               RhythmDBEntryType*    : Read / Write / Construct Only

The type of entries to use in the browser.

### The `"input-model"` property

      "input-model"              RhythmDBQueryModel*   : Read

This RhythmDBQueryModel defines the set of entries that the browser filters. This property is not writeable. To set a new input query model, use rb_library_browser_set_model.

### The `"output-model"` property

      "output-model"             RhythmDBQueryModel*   : Read

This RhythmDBQueryModel contains the filtered set of entries. It is a subset of the entries contained in the input model. This should be used as the model backing the source's entry view.

Sources using this widget should connect to the notify signal for this property, updating their entry view when it changes.