gui/queue: Remove unused fields from struct gui_queue

Now that we have a single model and filter there is no need to attach
them to every gui_queue.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-08-03 07:48:17 -04:00
parent 336c0a01af
commit 1bc43a9e2c
3 changed files with 8 additions and 12 deletions

View File

@ -122,7 +122,7 @@ void __queue_filter(GtkSearchEntry *entry, gpointer data)
gq_queue->gq_active = gtk_combo_box_get_active(combo);
}
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(gq_queue->gq_filter));
gtk_tree_model_filter_refilter(gui_view_get_filter());
gui_view_scroll();
}
@ -147,8 +147,6 @@ struct gui_queue *gui_queue_alloc(struct playlist *playlist, struct queue *queue
gq->gq_flags = flags;
gq->gq_text = g_strdup(text);
gq->gq_search = NULL;
gq->gq_model = g_object_ref(gui_queue_model_get());
gq->gq_filter = GTK_TREE_MODEL(gui_view_get_filter());
gq->gq_playlist = playlist;
gq->gq_queue = queue;
@ -165,7 +163,6 @@ void gui_queue_free(struct queue *queue)
gui_view_set_queue(NULL);
if (gq->gq_search)
g_strfreev(gq->gq_search);
g_object_unref(gq->gq_model);
g_free(gq->gq_text);
g_free(gq);
}

View File

@ -19,8 +19,6 @@ struct gui_queue {
gchar *gq_text;
gchar **gq_search;
GuiQueueModel *gq_model;
GtkTreeModel *gq_filter;
struct playlist *gq_playlist;
struct queue *gq_queue;
};

View File

@ -67,7 +67,6 @@ static void test_queue()
queue_init(&q, 0, &test_ops, NULL);
gq = gui_queue(&q);
test_equal((void *)gq->gq_queue, (void *)&q);
test_not_equal((void *)gq->gq_model, NULL);
test_equal(gui_queue_can_random(gq), (bool)true);
test_equal(gui_queue_can_repeat(gq), (bool)true);
@ -154,6 +153,7 @@ static void test_queue()
static void test_tracks()
{
struct db_entry *dbe, *next;
GtkTreeModel *filter;
struct gui_queue *gq;
GtkEntry *search;
int argc = 0;
@ -167,18 +167,19 @@ static void test_tracks()
playlist_new(PL_LIBRARY, "tests/Music/Hyrule Symphony");
while (idle_run_task() == true) {}
filter = GTK_TREE_MODEL(gui_view_get_filter());
test_not_equal((void *)gq, NULL);
test_not_equal((void *)gq->gq_filter, NULL);
test_equal(gtk_tree_model_iter_n_children(gq->gq_filter, NULL), 13);
test_not_equal((void *)filter, NULL);
test_equal(gtk_tree_model_iter_n_children(filter, NULL), 13);
gui_queue_model_set_queue(playlist_get_queue(PL_SYSTEM, "Collection"));
gtk_entry_set_text(search, "zelda");
g_signal_emit_by_name(search, "search-changed");
test_equal(gtk_tree_model_iter_n_children(gq->gq_filter, NULL), 2);
test_equal(gtk_tree_model_iter_n_children(filter, NULL), 2);
gtk_entry_set_text(search, "");
g_signal_emit_by_name(search, "search-changed");
test_equal(gtk_tree_model_iter_n_children(gq->gq_filter, NULL), 13);
test_equal(gtk_tree_model_iter_n_children(filter, NULL), 13);
db_for_each(dbe, next, track_db_get()) {
if (TRACK(dbe)->tr_track == 4) {
@ -187,7 +188,7 @@ static void test_tracks()
}
}
test_equal(gtk_tree_model_iter_n_children(gq->gq_filter, NULL), 12);
test_equal(gtk_tree_model_iter_n_children(filter, NULL), 12);
gui_queue_show(NULL);
core_deinit();