RBSourceGroup

## RBSourceGroup RBSourceGroup — Source list grouping |

## Synopsis

    enum                RBSourceGroupCategory;
                        RBSourceGroup;
    #define             RB_SOURCE_GROUP_LIBRARY
    #define             RB_SOURCE_GROUP_PLAYLISTS
    #define             RB_SOURCE_GROUP_DEVICES
    #define             RB_SOURCE_GROUP_SHARED
    void                rb_source_group_init                (void);
    RBSourceGroup *     rb_source_group_get_by_name         (const char *name);
    RBSourceGroup *     rb_source_group_register            (const char *name,
                                                             const char *display_name,
                                                             RBSourceGroupCategory category);
    RBSourceGroup *     rb_source_group_library_get_type    (void);
    RBSourceGroup *     rb_source_group_playlists_get_type  (void);
    RBSourceGroup *     rb_source_group_devices_get_type    (void);
    RBSourceGroup *     rb_source_group_shared_get_type     (void);

## Description

Source groups define sections of the source list. A source group consists of an internal name, a display name, and a category. The internal name can be used to locate a registered source group. The category is used to sort the source groups.

## Details

### enum RBSourceGroupCategory

    typedef enum {
    	RB_SOURCE_GROUP_CATEGORY_FIXED = 0, /* library, iradio, podcast, queue */
    	RB_SOURCE_GROUP_CATEGORY_REMOVABLE, /* ipod, generic audio player, audio CD */
    	RB_SOURCE_GROUP_CATEGORY_PERSISTENT, /* playlists */
    	RB_SOURCE_GROUP_CATEGORY_TRANSIENT, /* DAAP shares */
    	RB_SOURCE_GROUP_CATEGORY_LAST
    } RBSourceGroupCategory;

### RBSourceGroup

    typedef struct {
    	char                 *name;
    	char                 *display_name;
    	RBSourceGroupCategory category;
    } RBSourceGroup;

### RB_SOURCE_GROUP_LIBRARY

    #define RB_SOURCE_GROUP_LIBRARY           (rb_source_group_library_get_type ())

### RB_SOURCE_GROUP_PLAYLISTS

    #define RB_SOURCE_GROUP_PLAYLISTS         (rb_source_group_playlists_get_type ())

### RB_SOURCE_GROUP_DEVICES

    #define RB_SOURCE_GROUP_DEVICES           (rb_source_group_devices_get_type ())

### RB_SOURCE_GROUP_SHARED

    #define RB_SOURCE_GROUP_SHARED            (rb_source_group_shared_get_type ())

### rb_source_group_init ()

    void                rb_source_group_init                (void);

Initializes source groups.

### rb_source_group_get_by_name ()

    RBSourceGroup *     rb_source_group_get_by_name         (const char *name);

Locates a source group by name. If the source group has not been registered yet, returns NULL instead.

`name` : | name of source group to find
Returns : | existing source group, or NULL.

### rb_source_group_register ()

    RBSourceGroup *     rb_source_group_register            (const char *name,
                                                             const char *display_name,
                                                             RBSourceGroupCategory category);

Registers and returns a new source group. Registering a source group that already exists will probably do bad things.

`name` : | name of the source group (untranslated, used in code)
`display_name` : | display name of the source group (translated)
`category` : | category for the source group
Returns : | new source group

### rb_source_group_library_get_type ()

    RBSourceGroup *     rb_source_group_library_get_type    (void);

Returns the predefined library source group

Returns : | library source group

### rb_source_group_playlists_get_type ()

    RBSourceGroup *     rb_source_group_playlists_get_type  (void);

Returns the predefined playlists source group

Returns : | playlists source group

### rb_source_group_devices_get_type ()

    RBSourceGroup *     rb_source_group_devices_get_type    (void);

Returns the predefined devices source group

Returns : | devices source group

### rb_source_group_shared_get_type ()

    RBSourceGroup *     rb_source_group_shared_get_type     (void);

Returns the predefined shared source group

Returns : | shared source group