ea149d57df
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
76 lines
2.1 KiB
C
76 lines
2.1 KiB
C
/*
|
|
* Copyright 2016 (c) Anna Schumaker.
|
|
*/
|
|
#ifndef OCARINA_GUI_MODEL_H
|
|
#define OCARINA_GUI_MODEL_H
|
|
#include <core/containers/queue.h>
|
|
#include <gtk/gtk.h>
|
|
|
|
#define GUI_QUEUE_MODEL_TYPE (gui_queue_model_get_type())
|
|
#define GUI_QUEUE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
|
|
GUI_QUEUE_MODEL_TYPE, GuiQueueModel))
|
|
|
|
enum queue_model_columns {
|
|
Q_MODEL_TRACK_NR,
|
|
Q_MODEL_TITLE,
|
|
Q_MODEL_LENGTH,
|
|
Q_MODEL_ARTIST,
|
|
Q_MODEL_ALBUM,
|
|
Q_MODEL_YEAR,
|
|
Q_MODEL_GENRE,
|
|
Q_MODEL_COUNT,
|
|
Q_MODEL_LAST_PLAY,
|
|
Q_MODEL_FILE_PATH,
|
|
Q_MODEL_N_COLUMNS,
|
|
};
|
|
|
|
|
|
typedef struct _gui_queue_model GuiQueueModel;
|
|
typedef struct _gui_queue_model_class GuiQueueModelClass;
|
|
|
|
struct _gui_queue_model {
|
|
GObject gqm_parent; /* This MUST be the first member. */
|
|
gint gqm_stamp; /* This is used to check iter validity. */
|
|
|
|
struct queue *gqm_queue; /* The model's associated queue. */
|
|
struct _q_iter gqm_iter; /* The current _q_iter. */
|
|
};
|
|
|
|
struct _gui_queue_model_class {
|
|
GObjectClass parent_class;
|
|
};
|
|
|
|
|
|
/* Called to allocate a new GuiQueueModel */
|
|
GuiQueueModel *gui_queue_model_new(struct queue *);
|
|
|
|
/* Called to find the GType of the GuiQueueModel */
|
|
GType gui_queue_model_get_type();
|
|
|
|
/* Called to add a row to the model */
|
|
void gui_queue_model_add(GuiQueueModel *, unsigned int);
|
|
|
|
/* Called to remove a row from the model */
|
|
void gui_queue_model_remove(GuiQueueModel *, unsigned int);
|
|
|
|
/* Called to remove all rows from the model */
|
|
void gui_queue_model_clear(GuiQueueModel *, unsigned int);
|
|
|
|
/* Called to update a row in the model */
|
|
void gui_queue_model_update(GuiQueueModel *, unsigned int);
|
|
|
|
/* Called to convert a GtkTreeIter into a struct track */
|
|
static inline
|
|
struct track *gui_queue_model_iter_get_track(GuiQueueModel *model,
|
|
GtkTreeIter *iter)
|
|
{
|
|
g_return_val_if_fail(iter != NULL, NULL);
|
|
g_return_val_if_fail(iter->user_data2 != NULL, NULL);
|
|
return (struct track *)iter->user_data2;
|
|
}
|
|
|
|
/* Called to convert a GtkTreePath into a struct track */
|
|
struct track *gui_queue_model_path_get_track(GuiQueueModel *, GtkTreePath *);
|
|
|
|
#endif /* OCARINA_GUI_MODEL_H */
|