Пример #1
0
static void shift_rows (void * user, gint row, gint before)
{
    GArray * shift = g_array_new (FALSE, FALSE, sizeof (gint));
    gint list = aud_playlist_get_active ();
    gint count = aud_playlist_queue_count (list);

    for (gint i = 0; i < count; i ++)
    {
        gint entry = aud_playlist_queue_get_entry (list, i);

        if (aud_playlist_entry_get_selected (list, entry))
        {
            g_array_append_val (shift, entry);

            if (i < before)
                before --;
        }
    }

    aud_playlist_queue_delete_selected (list);

    for (gint i = 0; i < shift->len; i ++)
        aud_playlist_queue_insert (list, before + i, g_array_index (shift, gint, i));

    g_array_free (shift, TRUE);
}
Пример #2
0
void playlist_queue_toggle (void)
{
    gint list = aud_playlist_get_active ();
    gint focus = playlist_get_focus (list);

    if (focus < 0)
        return;

    gint at = aud_playlist_queue_find_entry (list, focus);

    if (at < 0)
        aud_playlist_queue_insert (list, -1, focus);
    else
        aud_playlist_queue_delete (list, at, 1);
}