## RBAutoPlaylistSource RBAutoPlaylistSource — automatic playlist source, based on a database query |

## Synopsis

                        RBAutoPlaylistSource;
                        RBAutoPlaylistSourceClass;
    RBSource *          rb_auto_playlist_source_new         (RBShell *shell,
                                                             const char *name,
                                                             gboolean local);
    RBSource *          rb_auto_playlist_source_new_from_xml
                                                            (RBShell *shell,
                                                             xmlNodePtr node);
    void                rb_auto_playlist_source_set_query   (RBAutoPlaylistSource *source,
                                                             GPtrArray *query,
                                                             RhythmDBQueryModelLimitType limit_type,
                                                             GValueArray *limit_value,
                                                             const char *sort_key,
                                                             gint sort_order);
    void                rb_auto_playlist_source_get_query   (RBAutoPlaylistSource *source,
                                                             GPtrArray **query,
                                                             RhythmDBQueryModelLimitType *limit_type,
                                                             GValueArray **limit_value,
                                                             char **sort_key,
                                                             gint *sort_order);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkBox
                                     +----GtkHBox
                                           +----RBSource
                                                 +----RBPlaylistSource
                                                       +----RBAutoPlaylistSource

## Implemented Interfaces

RBAutoPlaylistSource implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Description

A playlist populated with the results of a database query.

The query, limit, and sort settings are saved to the playlists file, so they are persistent.

Searching is implemented by appending the query criteria generated from the search text to the query. Browsing is implemented by using the base query model (or a query model using the query generated from the search text, there is some) as the input to a RBLibraryBrowser.

If the user has not set a sort order as part of the playlist definition, the entry view columns are made clickable to allow the user to sort the results.

## Details

### RBAutoPlaylistSource

    typedef struct _RBAutoPlaylistSource RBAutoPlaylistSource;

### RBAutoPlaylistSourceClass

    typedef struct {
    	RBPlaylistSourceClass parent;
    } RBAutoPlaylistSourceClass;

### rb_auto_playlist_source_new ()

    RBSource *          rb_auto_playlist_source_new         (RBShell *shell,
                                                             const char *name,
                                                             gboolean local);

Creates a new automatic playlist source, initially with an empty query.

`shell` : | the RBShell instance
`name` : | the name of the new playlist
`local` : | if TRUE, the playlist will be considered local
Returns : | the new source

### rb_auto_playlist_source_new_from_xml ()

    RBSource *          rb_auto_playlist_source_new_from_xml
                                                            (RBShell *shell,
                                                             xmlNodePtr node);

Creates a new auto playlist source by parsing an XML-encoded query.

`shell` : | the RBShell instance
`node` : | libxml node containing the playlist
Returns : | the new source

### rb_auto_playlist_source_set_query ()

    void                rb_auto_playlist_source_set_query   (RBAutoPlaylistSource *source,
                                                             GPtrArray *query,
                                                             RhythmDBQueryModelLimitType limit_type,
                                                             GValueArray *limit_value,
                                                             const char *sort_key,
                                                             gint sort_order);

Sets the database query used to populate the playlist, and also the limit on playlist size, and the sorting type used.

`source` : | the RBAutoPlaylistSource
`query` : | the new database query
`limit_type` : | the playlist limit type
`limit_value` : | the playlist limit value
`sort_key` : | the sorting key
`sort_order` : |

### rb_auto_playlist_source_get_query ()

    void                rb_auto_playlist_source_get_query   (RBAutoPlaylistSource *source,
                                                             GPtrArray **query,
                                                             RhythmDBQueryModelLimitType *limit_type,
                                                             GValueArray **limit_value,
                                                             char **sort_key,
                                                             gint *sort_order);

Extracts the current query, playlist limit, and sorting settings for the playlist.

`source` : | the RBAutoPlaylistSource
`query` : | returns the database query for the playlist
`limit_type` : | returns the playlist limit type
`limit_value` : | returns the playlist limit value
`sort_key` : | returns the playlist sorting key
`sort_order` : |