gui/collection: Remove unused gui queue code
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
15ed068e13
commit
64fc5a9a0d
|
@ -82,10 +82,10 @@ void __audio_favorite(GtkToggleButton *toggle, gpointer data)
|
|||
void __audio_hide(GtkToggleButton *toggle, gpointer data)
|
||||
{
|
||||
if (gtk_toggle_button_get_active(toggle)) {
|
||||
if (collection_ban(audio_cur_track()))
|
||||
if (playlist_add("Hidden", audio_cur_track()))
|
||||
audio_next();
|
||||
} else
|
||||
collection_unban(audio_cur_track());
|
||||
playlist_remove("Hidden", audio_cur_track());
|
||||
}
|
||||
|
||||
static int __audio_timeout(gpointer data)
|
||||
|
|
|
@ -169,27 +169,6 @@ void __collection_selection_changed(GtkTreeSelection *selection,
|
|||
}
|
||||
}
|
||||
|
||||
static void *__collection_init(struct queue *queue, void *data)
|
||||
{
|
||||
return gui_queue_alloc(queue, "Collection", GQ_CAN_RANDOM);
|
||||
}
|
||||
|
||||
static void __collection_added(struct queue *queue, unsigned int pos)
|
||||
{
|
||||
gui_queue_added(queue, pos);
|
||||
gui_sidebar_set_size(gui_queue(queue));
|
||||
}
|
||||
|
||||
static bool __collection_erase(struct queue *queue, struct track *track)
|
||||
{
|
||||
return playlist_add("Hidden", track);
|
||||
}
|
||||
|
||||
static void __collection_removed(struct queue *queue, unsigned int pos)
|
||||
{
|
||||
gui_queue_removed(queue, pos);
|
||||
gui_sidebar_set_size(gui_queue(queue));
|
||||
}
|
||||
|
||||
bool __gui_collection_init_idle()
|
||||
{
|
||||
|
@ -233,17 +212,5 @@ void gui_collection_init()
|
|||
gui_sidebar_on_select, NULL, NULL);
|
||||
|
||||
idle_schedule(IDLE_SYNC, __gui_collection_init_idle, NULL);
|
||||
gui_sidebar_set_size(gui_queue(collection_get_queue()));
|
||||
gui_idle_enable();
|
||||
}
|
||||
|
||||
struct queue_ops collection_ops = {
|
||||
.qop_init = __collection_init,
|
||||
.qop_deinit = gui_queue_free,
|
||||
.qop_added = __collection_added,
|
||||
.qop_erase = __collection_erase,
|
||||
.qop_removed = __collection_removed,
|
||||
.qop_cleared = gui_queue_cleared,
|
||||
.qop_save = collection_save,
|
||||
.qop_updated = gui_queue_updated,
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@ const static gchar *OCARINA_NAME = "org.gtk.ocarina-debug";
|
|||
#endif
|
||||
|
||||
struct core_init_data init_data = {
|
||||
&collection_ops,
|
||||
NULL,
|
||||
&history_ops,
|
||||
&playlist_ops,
|
||||
&tempq_ops,
|
||||
|
|
|
@ -124,9 +124,6 @@ void gui_sidebar_init()
|
|||
sb_store = GTK_LIST_STORE(gui_builder_object("o_sidebar_store"));
|
||||
|
||||
gtk_tree_model_get_iter_first(GTK_TREE_MODEL(sb_store), &iter);
|
||||
__sidebar_set_queue(&iter, gui_queue(collection_get_queue()));
|
||||
|
||||
gtk_tree_model_iter_next(GTK_TREE_MODEL(sb_store), &iter);
|
||||
__sidebar_set_queue(&iter, gui_queue(history_get_queue()));
|
||||
|
||||
/* Set sidebar width. */
|
||||
|
|
|
@ -286,7 +286,7 @@ void __view_rc_add_hidden(GtkMenuItem *item, gpointer data)
|
|||
GList *cur = g_list_reverse(rows);
|
||||
|
||||
while (cur) {
|
||||
collection_ban(__view_filter_get_track(cur->data));
|
||||
playlist_add("Hidden", __view_filter_get_track(cur->data));
|
||||
cur = g_list_next(cur);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,4 @@
|
|||
/* Called to initialize the GUI collection code. */
|
||||
void gui_collection_init();
|
||||
|
||||
/* Collection operations passed to core_init() */
|
||||
extern struct queue_ops collection_ops;
|
||||
|
||||
#endif /* OCARINA_GUI_COLLECTION_H */
|
||||
|
|
|
@ -275,12 +275,6 @@
|
|||
<column type="gpointer"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">media-optical</col>
|
||||
<col id="1">menu</col>
|
||||
<col id="2" translatable="yes"><big>Collection</big>
|
||||
0 tracks</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">document-open-recent</col>
|
||||
<col id="1">menu</col>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <core/collection.h>
|
||||
#include <core/idle.h>
|
||||
#include <core/core.h>
|
||||
#include <core/playlist.h>
|
||||
#include <gui/model.h>
|
||||
#include <tests/test.h>
|
||||
|
||||
|
@ -21,10 +22,15 @@ void on_row_changed(GtkTreeModel *model, GtkTreePath *path,
|
|||
GtkTreeIter *iter, gpointer data)
|
||||
{ count_update++; }
|
||||
|
||||
void *test_queue_init(struct queue *queue, void *data) { return NULL; }
|
||||
void test_queue_deinit(struct queue *queue) {}
|
||||
void *test_queue_init(struct queue *queue, void *data)
|
||||
{ return NULL; }
|
||||
void test_queue_deinit(struct queue *queue)
|
||||
{ }
|
||||
void test_queue_added(struct queue *queue, unsigned int row)
|
||||
{ gui_queue_model_add(queue->q_private, row); }
|
||||
{
|
||||
if (queue->q_private)
|
||||
gui_queue_model_add(queue->q_private, row);
|
||||
}
|
||||
void test_queue_removed(struct queue *queue, unsigned int row)
|
||||
{ gui_queue_model_remove(queue->q_private, row); }
|
||||
void test_queue_cleared(struct queue *queue, unsigned int n)
|
||||
|
@ -53,7 +59,7 @@ struct audio_ops test_audio_ops = {
|
|||
};
|
||||
|
||||
struct core_init_data init_data = {
|
||||
.collection_ops = &test_ops,
|
||||
.playlist_ops = &test_ops,
|
||||
.audio_ops = &test_audio_ops,
|
||||
};
|
||||
|
||||
|
@ -63,10 +69,10 @@ static void test_init()
|
|||
GuiQueueModel *model;
|
||||
GType type;
|
||||
|
||||
model = gui_queue_model_new(collection_get_queue());
|
||||
model = gui_queue_model_new(playlist_get_queue("Collection"));
|
||||
test_not_equal((void *)model, NULL);
|
||||
test_equal(GTK_IS_TREE_MODEL(model), true);
|
||||
test_equal((void *)model->gqm_queue, (void *)collection_get_queue());
|
||||
test_equal((void *)model->gqm_queue, (void *)playlist_get_queue("Collection"));
|
||||
|
||||
treemodel = GTK_TREE_MODEL(model);
|
||||
test_equal(gtk_tree_model_get_flags(treemodel), GTK_TREE_MODEL_LIST_ONLY);
|
||||
|
@ -109,7 +115,7 @@ static void test_empty()
|
|||
GtkTreeIter iter;
|
||||
GValue value;
|
||||
|
||||
model = GTK_TREE_MODEL(gui_queue_model_new(collection_get_queue()));
|
||||
model = GTK_TREE_MODEL(gui_queue_model_new(playlist_get_queue("Collection")));
|
||||
memset(&value, 0, sizeof(GValue));
|
||||
|
||||
test_equal(gtk_tree_model_get_iter_first(model, &iter), false);
|
||||
|
@ -154,6 +160,7 @@ static void test_empty()
|
|||
|
||||
static void test_model()
|
||||
{
|
||||
struct db_entry *dbe, *next;
|
||||
struct track *track;
|
||||
GtkTreeModel *model;
|
||||
GtkTreePath *path;
|
||||
|
@ -161,7 +168,10 @@ static void test_model()
|
|||
GValue value;
|
||||
int argc = 0;
|
||||
|
||||
model = GTK_TREE_MODEL(gui_queue_model_new(collection_get_queue()));
|
||||
core_init(&argc, NULL, &init_data);
|
||||
while (idle_run_task() == true) {}
|
||||
|
||||
model = GTK_TREE_MODEL(gui_queue_model_new(playlist_get_queue("Collection")));
|
||||
memset(&value, 0, sizeof(GValue));
|
||||
|
||||
g_signal_connect(model, "row-inserted", (GCallback)on_row_inserted, NULL);
|
||||
|
@ -169,13 +179,12 @@ static void test_model()
|
|||
g_signal_connect(model, "row-changed", (GCallback)on_row_changed, NULL);
|
||||
|
||||
/* Okay, now scan a directory ... */
|
||||
core_init(&argc, NULL, &init_data);
|
||||
collection_get_queue()->q_private = model;
|
||||
playlist_get_queue("Collection")->q_private = model;
|
||||
collection_add("tests/Music/Hyrule Symphony");
|
||||
while (idle_run_task() == true) {}
|
||||
test_equal(queue_size(collection_get_queue()), 13);
|
||||
test_equal(playlist_size("Collection"), 13);
|
||||
test_equal(count_insert, 13);
|
||||
queue_resort(collection_get_queue());
|
||||
queue_resort(playlist_get_queue("Collection"));
|
||||
test_equal(count_update, 13);
|
||||
|
||||
/* ... and test again */
|
||||
|
@ -247,8 +256,8 @@ static void test_model()
|
|||
|
||||
test_equal(gtk_tree_model_iter_parent(model, &iter, &iter), false);
|
||||
|
||||
while (queue_size(collection_get_queue()) > 0)
|
||||
queue_remove(collection_get_queue(), 0);
|
||||
db_for_each(dbe, next, track_db_get())
|
||||
playlist_remove("Collection", TRACK(dbe));
|
||||
test_equal(count_delete, 13);
|
||||
|
||||
core_deinit();
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <core/core.h>
|
||||
#include <core/collection.h>
|
||||
#include <core/idle.h>
|
||||
#include <core/playlist.h>
|
||||
#include <gui/builder.h>
|
||||
#include <gui/queue.h>
|
||||
#include <gui/view.h>
|
||||
|
@ -34,7 +35,7 @@ static struct queue_ops test_ops = {
|
|||
};
|
||||
|
||||
struct core_init_data init_data = {
|
||||
.collection_ops = &test_ops,
|
||||
.playlist_ops = &test_ops,
|
||||
};
|
||||
|
||||
static void test_queue()
|
||||
|
@ -151,6 +152,7 @@ static void test_queue()
|
|||
|
||||
static void test_tracks()
|
||||
{
|
||||
struct db_entry *dbe, *next;
|
||||
struct gui_queue *gq;
|
||||
GtkLabel *runtime;
|
||||
GtkEntry *search;
|
||||
|
@ -160,7 +162,7 @@ static void test_tracks()
|
|||
search = GTK_ENTRY(gui_builder_widget("o_search"));
|
||||
|
||||
core_init(&argc, NULL, &init_data);
|
||||
gq = gui_queue(collection_get_queue());
|
||||
gq = gui_queue(playlist_get_queue("Collection"));
|
||||
|
||||
gui_queue_show(gq);
|
||||
test_equal(gtk_label_get_text(runtime), "");
|
||||
|
@ -181,7 +183,13 @@ static void test_tracks()
|
|||
g_signal_emit_by_name(search, "search-changed");
|
||||
test_equal(gtk_tree_model_iter_n_children(gq->gq_filter, NULL), 13);
|
||||
|
||||
queue_remove(collection_get_queue(), 3);
|
||||
db_for_each(dbe, next, track_db_get()) {
|
||||
if (TRACK(dbe)->tr_track == 4) {
|
||||
playlist_remove("Collection", TRACK(dbe));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
test_equal(gtk_tree_model_iter_n_children(gq->gq_filter, NULL), 12);
|
||||
test_equal(gtk_label_get_text(runtime), "40 minutes, 35 seconds");
|
||||
|
||||
|
|
|
@ -47,10 +47,6 @@ static void test_treeview()
|
|||
|
||||
test_equal(gtk_tree_model_get_iter_first(model, &iter), true);
|
||||
gtk_tree_model_get(model, &iter, 3, &queue, -1);
|
||||
test_equal((void *)queue, (void *)gui_queue(collection_get_queue()));
|
||||
|
||||
test_equal(gtk_tree_model_iter_next(model, &iter), true);
|
||||
gtk_tree_model_get(model, &iter, 3, &queue, -1);
|
||||
test_equal((void *)queue, (void *)gui_queue(history_get_queue()));
|
||||
|
||||
test_equal(gtk_tree_model_iter_next(model, &iter), false);
|
||||
|
|
Loading…
Reference in New Issue