## RBQueryCreator RBQueryCreator — database query creator widget |

## Synopsis

    struct              RBQueryCreator;
    struct              RBQueryCreatorClass;
    GtkWidget *         rb_query_creator_new                (RhythmDB *db);
    GtkWidget *         rb_query_creator_new_from_query     (RhythmDB *db,
                                                             GPtrArray *query,
                                                             RhythmDBQueryModelLimitType limit_type,
                                                             GVariant *limit_value,
                                                             const char *sort_column,
                                                             gint sort_direction);
    GPtrArray *         rb_query_creator_get_query          (RBQueryCreator *creator);
    void                rb_query_creator_get_limit          (RBQueryCreator *creator,
                                                             RhythmDBQueryModelLimitType *type,
                                                             GVariant **limit);
    void                rb_query_creator_get_sort_order     (RBQueryCreator *creator,
                                                             const char **sort_key,
                                                             gint *sort_direction);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkWidget
                   +----GtkContainer
                         +----GtkBin
                               +----GtkWindow
                                     +----GtkDialog
                                           +----RBQueryCreator

## Implemented Interfaces

RBQueryCreator implements AtkImplementorIface and GtkBuildable.

## Properties

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

## Description

The query creator is used to create and edit automatic playlists. It is only capable of constructing queries that consist of a flat list of criteria. It cannot nested criteria or represent full boolean logic expressions.

In addition to query criteria, the query creator also allows the user to specify limits on the size of the result set, in terms of the number of entries, the total duration, or the total file size; and also the order in which the results are to be sorted.

The structure of the query creator is defined in the builder file create-playlist.ui.

## Details

### struct RBQueryCreator

    struct RBQueryCreator;

### struct RBQueryCreatorClass

    struct RBQueryCreatorClass {
    	GtkDialogClass parent_class;
    };

### rb_query_creator_new ()

    GtkWidget *         rb_query_creator_new                (RhythmDB *db);

Creates a new query creator widget.

`db` : | the RhythmDB instance
Returns : | new query creator widget

### rb_query_creator_new_from_query ()

    GtkWidget *         rb_query_creator_new_from_query     (RhythmDB *db,
                                                             GPtrArray *query,
                                                             RhythmDBQueryModelLimitType limit_type,
                                                             GVariant *limit_value,
                                                             const char *sort_column,
                                                             gint sort_direction);

Constructs a new query creator with an existing query and limit and sort settings.

`db` : | the RhythmDB instance
`query` : | an existing query to start from
`limit_type` : | the type of result set limit
`limit_value` : | the result set limit value
`sort_column` : | the column on which to sort query results
`sort_direction` : | the direction in which to sort query results
Returns : | new query creator widget

### rb_query_creator_get_query ()

    GPtrArray *         rb_query_creator_get_query          (RBQueryCreator *creator);

Constructs a database query that represents the criteria in the query creator.

`creator` : | RBQueryCreator instance
Returns : | database query array. [transfer full]

### rb_query_creator_get_limit ()

    void                rb_query_creator_get_limit          (RBQueryCreator *creator,
                                                             RhythmDBQueryModelLimitType *type,
                                                             GVariant **limit);

Retrieves the limit type and value from the query creator.

`creator` : | RBQueryCreator instance
`type` : | used to return the limit type. [out]
`limit` : | used to return the limit value. [out]

### rb_query_creator_get_sort_order ()

    void                rb_query_creator_get_sort_order     (RBQueryCreator *creator,
                                                             const char **sort_key,
                                                             gint *sort_direction);

Retrieves the sort settings from the query creator. The sort direction is returned as a GtkSortType value.

`creator` : | RBQueryCreator instance
`sort_key` : | returns the sort key name. [out][allow-none]
`sort_direction` : | returns the sort direction. [out][allow-none]

## Property Details

### The `"creating"` property

      "creating"                 gboolean              : Read / Write / Construct Only

TRUE if a new playlist is being created.

Default value: TRUE

### The `"db"` property

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

The RhythmDB instance