From 1bc43a9e2c6890a7bdd7209542df8e0c8a73de1f Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 3 Aug 2016 07:48:17 -0400 Subject: [PATCH] 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 --- gui/queue.c | 5 +---- include/gui/queue.h | 2 -- tests/gui/queue.c | 13 +++++++------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/gui/queue.c b/gui/queue.c index 384ebe0b..9dbc1718 100644 --- a/gui/queue.c +++ b/gui/queue.c @@ -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); } diff --git a/include/gui/queue.h b/include/gui/queue.h index f649a58b..cddce8d7 100644 --- a/include/gui/queue.h +++ b/include/gui/queue.h @@ -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; }; diff --git a/tests/gui/queue.c b/tests/gui/queue.c index e0b8575f..70513311 100644 --- a/tests/gui/queue.c +++ b/tests/gui/queue.c @@ -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();