79 lines
2.1 KiB
C
79 lines
2.1 KiB
C
/*
|
|
* Copyright 2016 (c) Anna Schumaker.
|
|
*/
|
|
#ifndef OCARINA_GUI_QUEUE_H
|
|
#define OCARINA_GUI_QUEUE_H
|
|
|
|
#include <core/queue.h>
|
|
#include <gui/model.h>
|
|
|
|
enum gui_queue_flags {
|
|
GQ_CAN_RANDOM = (1 << 0), /* Random button can be clicked. */
|
|
GQ_CAN_REPEAT = (1 << 1), /* Repeat button can be clicked. */
|
|
GQ_CAN_DISABLE = (1 << 2), /* Disable switch can be clicked. */
|
|
};
|
|
|
|
struct gui_queue {
|
|
unsigned int gq_flags;
|
|
gchar *gq_text;
|
|
|
|
GuiQueueModel *gq_model;
|
|
GtkTreeModel *gq_filter;
|
|
struct queue *gq_queue;
|
|
GHashTable *gq_visible;
|
|
};
|
|
|
|
|
|
/* Called to allocate a new struct gui_queue. */
|
|
struct gui_queue *gui_queue_alloc(struct queue *, const gchar *, unsigned int);
|
|
|
|
/* Called to free a struct gui_queue. */
|
|
void gui_queue_free(struct queue *);
|
|
|
|
/* Called to access a the struct gui_queue attached to a queue. */
|
|
static inline struct gui_queue *gui_queue(struct queue *queue)
|
|
{
|
|
return queue ? (struct gui_queue *)queue->q_private : NULL;
|
|
}
|
|
|
|
/* Called to ask the struct gui_queue if it can change random flag. */
|
|
static inline bool gui_queue_can_random(struct gui_queue *gq)
|
|
{
|
|
if (gq)
|
|
return (gq->gq_flags & GQ_CAN_RANDOM) == GQ_CAN_RANDOM;
|
|
return false;
|
|
}
|
|
|
|
/* Called to ask the struct gui_queue if it can change repeat flag. */
|
|
static inline bool gui_queue_can_repeat(struct gui_queue *gq)
|
|
{
|
|
if (gq)
|
|
return (gq->gq_flags & GQ_CAN_REPEAT) == GQ_CAN_REPEAT;
|
|
return false;
|
|
}
|
|
|
|
/* Called to ask the struct gui_queue if it can change enabled flag. */
|
|
static inline bool gui_queue_can_disable(struct gui_queue *gq)
|
|
{
|
|
if (gq)
|
|
return (gq->gq_flags & GQ_CAN_DISABLE) == GQ_CAN_DISABLE;
|
|
return false;
|
|
}
|
|
|
|
/* Called to set the correct state of the random and repeat buttons. */
|
|
void gui_queue_show(struct gui_queue *);
|
|
|
|
/* Called when a track is added to the queue. */
|
|
void gui_queue_added(struct queue *, unsigned int);
|
|
|
|
/* Called when a track is removed from the queue. */
|
|
void gui_queue_removed(struct queue *, unsigned int);
|
|
|
|
/* Called when a queue is cleared. */
|
|
void gui_queue_cleared(struct queue *, unsigned int);
|
|
|
|
/* Called when a track is updated. */
|
|
void gui_queue_updated(struct queue *, unsigned int);
|
|
|
|
#endif /* OCARINA_GUI_QUEUE_H */
|