Remove gui/queue.c
This code is obsolete now that the sidebar handles setting the random button when playlists are changed. Implements #76: Remove struct gui_queue Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
df2236db9f
commit
b4e2770223
|
@ -10,7 +10,6 @@
|
||||||
#include <gui/idle.h>
|
#include <gui/idle.h>
|
||||||
#include <gui/model.h>
|
#include <gui/model.h>
|
||||||
#include <gui/playlist.h>
|
#include <gui/playlist.h>
|
||||||
#include <gui/queue.h>
|
|
||||||
#include <gui/sidebar.h>
|
#include <gui/sidebar.h>
|
||||||
#include <gui/treeview.h>
|
#include <gui/treeview.h>
|
||||||
#include <gui/view.h>
|
#include <gui/view.h>
|
||||||
|
@ -109,7 +108,6 @@ static void __ocarina_startup(GApplication *application, gpointer data)
|
||||||
gui_treeview_init();
|
gui_treeview_init();
|
||||||
gui_sidebar_init();
|
gui_sidebar_init();
|
||||||
gui_view_init();
|
gui_view_init();
|
||||||
gui_queue_init();
|
|
||||||
gui_collection_init();
|
gui_collection_init();
|
||||||
gui_playlist_init();
|
gui_playlist_init();
|
||||||
gui_audio_init();
|
gui_audio_init();
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#include <core/string.h>
|
#include <core/string.h>
|
||||||
#include <gui/builder.h>
|
#include <gui/builder.h>
|
||||||
#include <gui/filter.h>
|
#include <gui/filter.h>
|
||||||
|
#include <gui/model.h>
|
||||||
#include <gui/playlist.h>
|
#include <gui/playlist.h>
|
||||||
#include <gui/queue.h>
|
|
||||||
#include <gui/sidebar.h>
|
#include <gui/sidebar.h>
|
||||||
|
|
||||||
static bool p_filter_enable = true;
|
static bool p_filter_enable = true;
|
||||||
|
@ -24,12 +24,12 @@ void __playlist_row_activated(GtkTreeView *treeview, GtkTreePath *path,
|
||||||
|
|
||||||
static bool __playlist_queue_set_size(struct queue *queue, GtkTreeIter *iter)
|
static bool __playlist_queue_set_size(struct queue *queue, GtkTreeIter *iter)
|
||||||
{
|
{
|
||||||
struct gui_queue *gq = gui_queue(queue);
|
struct playlist *playlist = queue->q_private;
|
||||||
bool match = (gui_sidebar_iter_type(iter) == gq->gq_playlist->pl_type);
|
bool match = (gui_sidebar_iter_type(iter) == playlist->pl_type);
|
||||||
gchar *name = gui_sidebar_iter_name(iter);
|
gchar *name = gui_sidebar_iter_name(iter);
|
||||||
|
|
||||||
if (match)
|
if (match)
|
||||||
match = string_match(name, gq->gq_text);
|
match = string_match(name, playlist->pl_name);
|
||||||
if (match)
|
if (match)
|
||||||
gui_sidebar_iter_update(iter);
|
gui_sidebar_iter_update(iter);
|
||||||
g_free(name);
|
g_free(name);
|
||||||
|
@ -64,10 +64,7 @@ out:
|
||||||
static void *__playlist_init(struct queue *queue, void *data)
|
static void *__playlist_init(struct queue *queue, void *data)
|
||||||
{
|
{
|
||||||
struct playlist *playlist = (struct playlist *)data;
|
struct playlist *playlist = (struct playlist *)data;
|
||||||
unsigned int flags = 0;
|
|
||||||
|
|
||||||
if (!string_match(playlist->pl_name, "History"))
|
|
||||||
flags = GQ_CAN_RANDOM;
|
|
||||||
if (p_init_done && playlist->pl_type == PL_ARTIST) {
|
if (p_init_done && playlist->pl_type == PL_ARTIST) {
|
||||||
p_filter_enable = false;
|
p_filter_enable = false;
|
||||||
gui_playlist_add_artist(playlist);
|
gui_playlist_add_artist(playlist);
|
||||||
|
@ -75,42 +72,42 @@ static void *__playlist_init(struct queue *queue, void *data)
|
||||||
}
|
}
|
||||||
if (p_init_done && playlist->pl_type == PL_USER)
|
if (p_init_done && playlist->pl_type == PL_USER)
|
||||||
gui_playlist_add_user(playlist);
|
gui_playlist_add_user(playlist);
|
||||||
return gui_queue_alloc(playlist, queue, playlist->pl_name, flags);
|
return playlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __playlist_deinit(struct queue *queue)
|
static void __playlist_deinit(struct queue *queue)
|
||||||
{
|
{
|
||||||
gui_filter_clear_search(gui_queue(queue)->gq_playlist);
|
gui_filter_clear_search(queue->q_private);
|
||||||
gui_queue_free(queue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __playlist_added(struct queue *queue, unsigned int row)
|
static void __playlist_added(struct queue *queue, unsigned int row)
|
||||||
{
|
{
|
||||||
gui_model_add(gui_queue(queue)->gq_playlist, row);
|
gui_model_add(queue->q_private, row);
|
||||||
__playlist_update_sizes(queue);
|
__playlist_update_sizes(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __playlist_removed(struct queue *queue, unsigned int row)
|
static void __playlist_removed(struct queue *queue, unsigned int row)
|
||||||
{
|
{
|
||||||
gui_model_remove(gui_queue(queue)->gq_playlist, row);
|
gui_model_remove(queue->q_private, row);
|
||||||
__playlist_update_sizes(queue);
|
__playlist_update_sizes(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __playlist_cleared(struct queue *queue, unsigned int n)
|
static void __playlist_cleared(struct queue *queue, unsigned int n)
|
||||||
{
|
{
|
||||||
gui_model_clear(gui_queue(queue)->gq_playlist, n);
|
gui_model_clear(queue->q_private, n);
|
||||||
__playlist_update_sizes(queue);
|
__playlist_update_sizes(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __playlist_updated(struct queue *queue, unsigned int n)
|
static void __playlist_updated(struct queue *queue, unsigned int n)
|
||||||
{
|
{
|
||||||
gui_model_update(gui_queue(queue)->gq_playlist, n);
|
gui_model_update(queue->q_private, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool __playlist_erase(struct queue *queue, struct track *track)
|
static bool __playlist_erase(struct queue *queue, struct track *track)
|
||||||
{
|
{
|
||||||
enum playlist_type_t type = gui_queue(queue)->gq_playlist->pl_type;
|
struct playlist *playlist = queue->q_private;
|
||||||
const gchar *name = gui_queue(queue)->gq_playlist->pl_name;
|
enum playlist_type_t type = playlist->pl_type;
|
||||||
|
const gchar *name = playlist->pl_name;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PL_SYSTEM:
|
case PL_SYSTEM:
|
||||||
|
|
83
gui/queue.c
83
gui/queue.c
|
@ -1,83 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2016 (c) Anna Schumaker.
|
|
||||||
*/
|
|
||||||
#include <core/playlist.h>
|
|
||||||
#include <core/string.h>
|
|
||||||
#include <gui/builder.h>
|
|
||||||
#include <gui/filter.h>
|
|
||||||
#include <gui/model.h>
|
|
||||||
#include <gui/queue.h>
|
|
||||||
#include <gui/view.h>
|
|
||||||
|
|
||||||
static struct gui_queue *gq_queue = NULL;
|
|
||||||
|
|
||||||
static void __queue_toggle_flag(bool active, GtkWidget *widget,
|
|
||||||
enum queue_flags flag)
|
|
||||||
{
|
|
||||||
if (gq_queue == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (active)
|
|
||||||
queue_set_flag(gq_queue->gq_queue, flag);
|
|
||||||
else
|
|
||||||
queue_unset_flag(gq_queue->gq_queue, flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
void __queue_random(GtkToggleButton *button, gpointer data)
|
|
||||||
{
|
|
||||||
__queue_toggle_flag(gtk_toggle_button_get_active(button),
|
|
||||||
gtk_button_get_image(GTK_BUTTON(button)),
|
|
||||||
Q_RANDOM);
|
|
||||||
if (gq_queue && gq_queue->gq_playlist) {
|
|
||||||
playlist_set_random(gq_queue->gq_playlist->pl_type,
|
|
||||||
gq_queue->gq_playlist->pl_name,
|
|
||||||
gtk_toggle_button_get_active(button));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void gui_queue_init(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
struct gui_queue *gui_queue_alloc(struct playlist *playlist, struct queue *queue,
|
|
||||||
const gchar *text, unsigned int flags)
|
|
||||||
{
|
|
||||||
struct gui_queue *gq = g_malloc(sizeof(struct gui_queue));
|
|
||||||
|
|
||||||
gq->gq_flags = flags;
|
|
||||||
gq->gq_text = g_strdup(text);
|
|
||||||
gq->gq_playlist = playlist;
|
|
||||||
gq->gq_queue = queue;
|
|
||||||
|
|
||||||
return gq;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gui_queue_free(struct queue *queue)
|
|
||||||
{
|
|
||||||
struct gui_queue *gq = gui_queue(queue);
|
|
||||||
|
|
||||||
queue->q_private = NULL;
|
|
||||||
|
|
||||||
if (gq_queue == gq)
|
|
||||||
gui_view_set_playlist(NULL);
|
|
||||||
g_free(gq->gq_text);
|
|
||||||
g_free(gq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gui_queue_show(struct gui_queue *queue)
|
|
||||||
{
|
|
||||||
GtkButton *random = GTK_BUTTON(gui_builder_widget("random_button"));
|
|
||||||
bool has_random = false;
|
|
||||||
|
|
||||||
gq_queue = queue;
|
|
||||||
|
|
||||||
gtk_widget_set_sensitive(GTK_WIDGET(random), gui_queue_can_random(queue));
|
|
||||||
|
|
||||||
if (queue) {
|
|
||||||
has_random = queue_has_flag(queue->gq_queue, Q_RANDOM);
|
|
||||||
gui_view_set_playlist(queue->gq_playlist);
|
|
||||||
} else
|
|
||||||
gui_view_set_playlist(NULL);
|
|
||||||
|
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(random), has_random);
|
|
||||||
}
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <core/settings.h>
|
#include <core/settings.h>
|
||||||
#include <gui/builder.h>
|
#include <gui/builder.h>
|
||||||
#include <gui/filter.h>
|
#include <gui/filter.h>
|
||||||
#include <gui/queue.h>
|
#include <gui/model.h>
|
||||||
#include <gui/treeview.h>
|
#include <gui/treeview.h>
|
||||||
#include <gui/view.h>
|
#include <gui/view.h>
|
||||||
#include <gui/window.h>
|
#include <gui/window.h>
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* 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. */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct gui_queue {
|
|
||||||
unsigned int gq_flags;
|
|
||||||
gchar *gq_text;
|
|
||||||
|
|
||||||
struct playlist *gq_playlist;
|
|
||||||
struct queue *gq_queue;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Called to initialize the gui_queue code. */
|
|
||||||
void gui_queue_init(void);
|
|
||||||
|
|
||||||
/* Called to allocate a new struct gui_queue. */
|
|
||||||
struct gui_queue *gui_queue_alloc(struct playlist *, 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 set the correct state of the random and repeat buttons. */
|
|
||||||
void gui_queue_show(struct gui_queue *);
|
|
||||||
|
|
||||||
#endif /* OCARINA_GUI_QUEUE_H */
|
|
|
@ -1,37 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2015 (c) Anna Schumaker.
|
|
||||||
*/
|
|
||||||
#ifndef OCARINA_GUI_QUEUE_LABEL_H
|
|
||||||
#define OCARINA_GUI_QUEUE_LABEL_H
|
|
||||||
|
|
||||||
#include <core/queue.h>
|
|
||||||
#include <gtkmm.h>
|
|
||||||
|
|
||||||
|
|
||||||
class QueueLabel : public Gtk::HBox {
|
|
||||||
protected:
|
|
||||||
Glib::RefPtr<Gtk::Builder> _builder;
|
|
||||||
queue *_queue;
|
|
||||||
|
|
||||||
public:
|
|
||||||
QueueLabel(BaseObjectType *, const Glib::RefPtr<Gtk::Builder>);
|
|
||||||
~QueueLabel();
|
|
||||||
virtual void init(queue *);
|
|
||||||
virtual void set_sensitive(bool) {};
|
|
||||||
virtual void set_size() {};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TempLabel : public QueueLabel {
|
|
||||||
public:
|
|
||||||
Gtk::Label *temp_number;
|
|
||||||
Gtk::Label *temp_size;
|
|
||||||
Gtk::Button *temp_close;
|
|
||||||
|
|
||||||
TempLabel(BaseObjectType *, const Glib::RefPtr<Gtk::Builder>);
|
|
||||||
void set_sensitive(bool);
|
|
||||||
void set_size();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* OCARINA_GUI_QUEUE_LABEL_H */
|
|
|
@ -1,26 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2015 (c) Anna Schumaker.
|
|
||||||
*/
|
|
||||||
#ifndef OCARINA_GUI_QUEUE_WINDOW_H
|
|
||||||
#define OCARINA_GUI_QUEUE_WINDOW_H
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include <core/containers/set.h>
|
|
||||||
#include <gui/queue.h>
|
|
||||||
}
|
|
||||||
#include <gtkmm.h>
|
|
||||||
|
|
||||||
class QueueWindow : public Gtk::ScrolledWindow {
|
|
||||||
public:
|
|
||||||
Glib::RefPtr<Gtk::Builder> _builder;
|
|
||||||
|
|
||||||
Gtk::TreeView *q_treeview;
|
|
||||||
|
|
||||||
QueueWindow(BaseObjectType *, const Glib::RefPtr<Gtk::Builder>);
|
|
||||||
~QueueWindow();
|
|
||||||
void init(queue *);
|
|
||||||
|
|
||||||
bool on_key_press(GdkEventKey *);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* OCARINA_GUI_QUEUE_WINDOW_H */
|
|
|
@ -4,7 +4,6 @@
|
||||||
#ifndef OCARINA_GUI_VIEW_H
|
#ifndef OCARINA_GUI_VIEW_H
|
||||||
#define OCARINA_GUI_VIEW_H
|
#define OCARINA_GUI_VIEW_H
|
||||||
#include <gui/builder.h>
|
#include <gui/builder.h>
|
||||||
#include <core/queue.h>
|
|
||||||
|
|
||||||
/* Called to initialize structures needed by the treeview. */
|
/* Called to initialize structures needed by the treeview. */
|
||||||
void gui_view_init();
|
void gui_view_init();
|
||||||
|
|
|
@ -6,6 +6,5 @@ filter
|
||||||
treeview
|
treeview
|
||||||
sidebar
|
sidebar
|
||||||
view
|
view
|
||||||
queue
|
|
||||||
playlist
|
playlist
|
||||||
audio
|
audio
|
||||||
|
|
|
@ -12,6 +12,5 @@ gui_unit_test(Filter)
|
||||||
gui_unit_test(Treeview)
|
gui_unit_test(Treeview)
|
||||||
gui_unit_test(Sidebar)
|
gui_unit_test(Sidebar)
|
||||||
gui_unit_test(View)
|
gui_unit_test(View)
|
||||||
gui_unit_test(Queue)
|
|
||||||
gui_unit_test(Playlist)
|
gui_unit_test(Playlist)
|
||||||
gui_unit_test(Audio)
|
gui_unit_test(Audio)
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <gui/filter.h>
|
#include <gui/filter.h>
|
||||||
#include <gui/model.h>
|
#include <gui/model.h>
|
||||||
#include <gui/playlist.h>
|
#include <gui/playlist.h>
|
||||||
#include <gui/treeview.h>
|
|
||||||
#include <gui/sidebar.h>
|
#include <gui/sidebar.h>
|
||||||
#include <gui/treeview.h>
|
#include <gui/treeview.h>
|
||||||
#include <gui/view.h>
|
#include <gui/view.h>
|
||||||
|
|
|
@ -1,144 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2016 (c) Anna Schumaker.
|
|
||||||
*/
|
|
||||||
#include <core/core.h>
|
|
||||||
#include <core/idle.h>
|
|
||||||
#include <core/playlist.h>
|
|
||||||
#include <gui/builder.h>
|
|
||||||
#include <gui/filter.h>
|
|
||||||
#include <gui/queue.h>
|
|
||||||
#include <gui/view.h>
|
|
||||||
#include <tests/test.h>
|
|
||||||
|
|
||||||
static void *test_queue_init(struct queue *queue, void *data)
|
|
||||||
{
|
|
||||||
return gui_queue_alloc(data, queue, "Test Queue", GQ_CAN_RANDOM);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_queue_add(struct queue *queue, unsigned int n)
|
|
||||||
{ gui_model_add(gui_queue(queue)->gq_playlist, n); }
|
|
||||||
void test_queue_remove(struct queue *queue, unsigned int n)
|
|
||||||
{ gui_model_remove(gui_queue(queue)->gq_playlist, n); }
|
|
||||||
void test_queue_clear(struct queue *queue, unsigned int n)
|
|
||||||
{ gui_model_clear(gui_queue(queue)->gq_playlist, n); }
|
|
||||||
static void test_queue_save(struct queue *queue, unsigned int row) {}
|
|
||||||
void test_queue_update(struct queue *queue, unsigned int n)
|
|
||||||
{ gui_model_update(gui_queue(queue)->gq_playlist, n); }
|
|
||||||
|
|
||||||
static struct queue_ops test_ops = {
|
|
||||||
.qop_init = test_queue_init,
|
|
||||||
.qop_deinit = gui_queue_free,
|
|
||||||
.qop_cleared = test_queue_clear,
|
|
||||||
.qop_added = test_queue_add,
|
|
||||||
.qop_removed = test_queue_remove,
|
|
||||||
.qop_save = test_queue_save,
|
|
||||||
.qop_updated = test_queue_update,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct core_init_data init_data = {
|
|
||||||
.playlist_ops = &test_ops,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void test_queue()
|
|
||||||
{
|
|
||||||
GtkToggleButton *random;
|
|
||||||
struct gui_queue *gq;
|
|
||||||
GtkEntry *search;
|
|
||||||
struct queue q;
|
|
||||||
|
|
||||||
search = GTK_ENTRY(gui_filter_search());
|
|
||||||
random = GTK_TOGGLE_BUTTON(gui_builder_widget("random_button"));
|
|
||||||
|
|
||||||
/* Test initialization */
|
|
||||||
queue_init(&q, Q_ENABLED, &test_ops, NULL);
|
|
||||||
gq = gui_queue(&q);
|
|
||||||
|
|
||||||
g_assert_true(gui_queue_can_random(gq));
|
|
||||||
gq->gq_flags = 0;
|
|
||||||
g_assert_false(gui_queue_can_random(gq));
|
|
||||||
|
|
||||||
gtk_entry_set_text(search, "Test text");
|
|
||||||
|
|
||||||
/* Show a queue where random and repeat are disabled */
|
|
||||||
gui_queue_show(gq);
|
|
||||||
g_assert_false(gtk_widget_get_sensitive(GTK_WIDGET(random)));
|
|
||||||
g_assert_false(gtk_toggle_button_get_active(random));
|
|
||||||
g_assert_cmpstr(gtk_entry_get_text(search), ==, "");
|
|
||||||
|
|
||||||
/* Show a queue where random and repeat are enabled */
|
|
||||||
gq->gq_flags = GQ_CAN_RANDOM;
|
|
||||||
q.q_flags = Q_RANDOM | Q_REPEAT | Q_ENABLED;
|
|
||||||
gui_queue_show(gq);
|
|
||||||
g_assert_true(gtk_widget_get_sensitive(GTK_WIDGET(random)));
|
|
||||||
g_assert_true(gtk_toggle_button_get_active(random));
|
|
||||||
|
|
||||||
/* Attempt to show a NULL pointer */
|
|
||||||
gui_queue_show(NULL);
|
|
||||||
g_assert_false(gtk_widget_get_sensitive(GTK_WIDGET(random)));
|
|
||||||
g_assert_false(gtk_toggle_button_get_active(random));
|
|
||||||
|
|
||||||
queue_deinit(&q);
|
|
||||||
g_assert_null(gui_queue(&q));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_tracks()
|
|
||||||
{
|
|
||||||
struct db_entry *dbe, *next;
|
|
||||||
GtkTreeModel *filter;
|
|
||||||
struct gui_queue *gq;
|
|
||||||
GtkEntry *search;
|
|
||||||
|
|
||||||
search = GTK_ENTRY(gui_filter_search());
|
|
||||||
|
|
||||||
gq = gui_queue(playlist_get_queue(PL_SYSTEM, "Collection"));
|
|
||||||
|
|
||||||
gui_queue_show(gq);
|
|
||||||
playlist_new(PL_LIBRARY, "tests/Music/Hyrule Symphony");
|
|
||||||
while (idle_run_task() == true) {}
|
|
||||||
|
|
||||||
filter = GTK_TREE_MODEL(gui_filter_get());
|
|
||||||
g_assert_nonnull(gq);
|
|
||||||
g_assert_nonnull(filter);
|
|
||||||
g_assert_cmpuint(gtk_tree_model_iter_n_children(filter, NULL), ==, 13);
|
|
||||||
|
|
||||||
gtk_entry_set_text(search, "zelda");
|
|
||||||
g_signal_emit_by_name(search, "search-changed");
|
|
||||||
g_assert_cmpuint(gtk_tree_model_iter_n_children(filter, NULL), ==, 2);
|
|
||||||
|
|
||||||
gtk_entry_set_text(search, "");
|
|
||||||
g_signal_emit_by_name(search, "search-changed");
|
|
||||||
g_assert_cmpuint(gtk_tree_model_iter_n_children(filter, NULL), ==, 13);
|
|
||||||
|
|
||||||
db_for_each(dbe, next, track_db_get()) {
|
|
||||||
if (TRACK(dbe)->tr_track == 4) {
|
|
||||||
playlist_remove(PL_SYSTEM, "Collection", TRACK(dbe));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_assert_cmpuint(gtk_tree_model_iter_n_children(filter, NULL), ==, 12);
|
|
||||||
gui_queue_show(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
gtk_init(&argc, NULL);
|
|
||||||
gui_builder_init("share/ocarina/ocarina.ui");
|
|
||||||
core_init(&argc, NULL, &init_data);
|
|
||||||
gui_model_init();
|
|
||||||
gui_filter_init();
|
|
||||||
gui_view_init();
|
|
||||||
gui_queue_init();
|
|
||||||
while (idle_run_task()) {};
|
|
||||||
|
|
||||||
g_test_init(&argc, &argv, NULL);
|
|
||||||
g_test_add_func("/Gui/Queue", test_queue);
|
|
||||||
g_test_add_func("/Gui/Queue/Tracks", test_tracks);
|
|
||||||
ret = g_test_run();
|
|
||||||
|
|
||||||
core_deinit();
|
|
||||||
gui_builder_deinit();
|
|
||||||
return ret;
|
|
||||||
}
|
|
Loading…
Reference in New Issue